Index: main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js	(revision 23276)
+++ main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js	(revision 23298)
@@ -44,5 +44,34 @@
         });
 }); */
-
+/*
+function loadXMLDoc()
+{
+    if (window.XMLHttpRequest)
+    {// code for IE7+, Firefox, Chrome, Opera, Safari
+        xmlhttp=new XMLHttpRequest();
+    }
+    else
+    {// code for IE6, IE5
+        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
+    }
+    
+    xmlhttp.onreadystatechange=function()
+    {  
+        console.log("state changed to " + xmlhttp.readyState);
+        console.log("status is " + xmlhttp.status);
+        if (xmlhttp.readyState==4 && xmlhttp.status==200)
+        {
+            console.log("get code");
+            console.log(xmlhttp.responseText);
+            document.getElementById("gs_content").innerHTML=xmlhttp.responseText;
+        }
+    }
+    
+    xmlhttp.open("GET","http://localhost:8080/greenstone3/format?a=b&rt=s&s=ClassifierBrowse&c=simpleht&cl=CL1&excerptid=gs_content",true);
+    //xmlhttp.open("GET","http://www.cs.waikato.ac.nz",true);
+    //xmlhttp.open("GET","http://wand.net.nz/~sjb48/index.html",true);
+    xmlhttp.send();
+}
+*/
 $(document).ready(function(){
 
@@ -51,5 +80,4 @@
     var CURRENT_SELECT_VALUE = "";
 
-    /*
     var iframe = document.getElementById('iframe');
     var iframe_document = iframe.document;
@@ -65,8 +93,29 @@
         console.log("Chose content window");
     }
+
+    // Edit the hrefs in preview_html - search for <a href="format?a=b&rt=r&s=ClassifierBrowse&c=simpleht&cl=CL1.2">
+    var start_index = 0;
+    var end_index = 0;
+    while(start_index != -1)
+    {
+        start_index = preview_html.indexOf("href=\"format", start_index);
+        console.log("start index = " + start_index);
+        if(start_index != -1)
+        {
+            end_index = preview_html.indexOf("\">", start_index);
+            console.log("end_index = " + end_index);
+            a = preview_html.substring(0,end_index);
+            b = preview_html.substring(end_index);
+            preview_html = a.concat("&excerptid=gs_content", b);
+            console.log(preview_html);
+            start_index = end_index + "&excerptid=gs_content\">".length;
+        }
+    }
+
     // Put the content in the iframe
     if(initialised_iframe == "false")
     {
         console.log("Initialised iframe with preview html");
+        console.log(preview_html);
         iframe_document.open();
         iframe_document.writeln(preview_html); //.concat("&excerptid=gs_content"));
@@ -74,5 +123,6 @@
         initialised_iframe = "true";
     }
-    
+
+    /*    
     $(iframe_document.documentElement.innerHTML).find('a').each(function() {
             console.log("data "+$(this).data('href'));
@@ -132,7 +182,7 @@
     })
 
-    $(".draggable_text").draggable({
-            cursor: 'crosshair',
-            connectToSortable: '.gsf_otherwise, .gsf_link, .gsf_choose, .gsf_when',
+    $(".draggable_gsf_text").draggable({
+            cursor: 'crosshair',
+            connectToSortable: '.td-div, .gsf_when, .gsf_otherwise, .gsf_link, .gsf_choose_metadata, .gsf_default',
             helper: 'clone',
             revert: 'invalid'
@@ -185,5 +235,5 @@
     $(".draggable_gsf_icon").draggable({
             cursor: 'crosshair',
-            connectToSortable: '.gsf_link',
+            connectToSortable: '.td-div, .gsf_link, .gsf_choose, .gsf_when, .gsf_otherwise',
             helper: 'clone',
             revert: 'invalid'
Index: main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl	(revision 23276)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl	(revision 23298)
@@ -177,5 +177,5 @@
 
     <xsl:call-template name="xml-to-gui">
-        <xsl:with-param name="node-set" select="//format[@type='browse']"/> 
+        <xsl:with-param name="node-set" select="//format"/> <!-- [@type='browse']"/>  -->
         <xsl:with-param name="metadataSets" select="//metadataSetList"/> 
     </xsl:call-template> 
@@ -212,5 +212,5 @@
         <div class="draggable_gsf_icon css_gsf_icon block" title="gsf:icon"><table class="header"><tbody><tr><td class="header">ICON<select><option value = "document" selected = "document">Document</option><option value = "classifier">Classifier</option><option value = "source">Source</option></select></td><td><a href="#" class="remove ui-icon ui-icon-closethick">[x]</a></td></tr></tbody></table></div>
         <br/>
-        <div class="draggable_gsf_text css_text" title="text">TEXT</div>
+        <div class="draggable_gsf_text css_text" title="text"><table class="header"><tbody><tr><td class="header"><input type="text" name="rawtextinput" size="10" value=""/></td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table></div>
         <div class="draggable_table css_table" title="gsf:table">NEW TABLE</div>
         <div class="draggable_tr css_tr" title="gsf:row">NEW TABLE ROW</div>
@@ -239,7 +239,8 @@
 <!-- *************************************************************************************** -->
 <H2>Preview</H2>
-                    <!-- <iframe name="preview" id="iframe" width="98%" height="300">Your browser does not support iframes</iframe> -->
-
-                    <!-- <xsl:variable name="preview"> -->
+                    <iframe name="preview" id="iframe" width="98%" height="300">Your browser does not support iframes</iframe> 
+
+                    <xsl:variable name="preview"> 
+                    <!-- <button type="button" onclick="loadXMLDoc()">Change Content</button> -->
 					<div id="gs_content">
 						<!--
@@ -250,9 +251,9 @@
 
 					</div>
-                    <!-- </xsl:variable> -->
-
-                    <!-- <script type="text/javascript">
+                    </xsl:variable>
+
+                    <script type="text/javascript">
                         preview_html = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$preview"/><xsl:text disable-output-escaping="yes">';</xsl:text>
-                    </script> -->
+                    </script>
 
 					<div id="gs_footer">
Index: main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui-templates.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui-templates.xsl	(revision 23276)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui-templates.xsl	(revision 23298)
@@ -129,4 +129,18 @@
             gsf_icon_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$icon"/><xsl:text disable-output-escaping="yes">';</xsl:text>
         </script>
+
+    <!-- ******** TEXT ************ -->
+
+        <xsl:variable name="text">
+        <div class="block leaf gsf_text" title="gsf:text">
+                <xsl:variable name="rawtext"><xsl:value-of select="."/></xsl:variable>
+                <table class="header"><tbody><tr><td class="header"><input type="text" name="rawtextinput" size="10" value=""/></td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table>
+        </div>
+        </xsl:variable>
+
+        <script type="text/javascript">
+            gsf_text_element = <xsl:text disable-output-escaping="yes">'</xsl:text><xsl:copy-of select="$text"/><xsl:text disable-output-escaping="yes">';</xsl:text>
+        </script>
+
     </xsl:template>
 
