Changeset 24202
- Timestamp:
- 2011-06-27T11:07:20+12:00 (12 years ago)
- Location:
- main/trunk/greenstone3/web/interfaces/oran
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js
r24136 r24202 2 2 console.log("Loading gui_div.js\n"); 3 3 4 // var initialised_iframe = "false"; 4 /* DOCUMENT SPECIFIC FUNCTIONS */ 5 6 function displayTOC(checkbox) 7 { 8 if (checkbox.checked == true) 9 { 10 console.log("Show the TOC!"); 11 displaySideBar(true); 12 $("#tableOfContents").css("display", "block"); 13 } 14 else 15 { 16 console.log("Hide the TOC!"); 17 $("#tableOfContents").css("display", "none"); 18 if ($("#coverImage").css("display") == "none") 19 displaySideBar(false); 20 } 21 22 return; 23 } 24 25 function displayBookCover(checkbox) 26 { 27 if (checkbox.checked == true) 28 { 29 console.log("Show the book cover!"); 30 displaySideBar(true); 31 $("#coverImage").css("display", "block"); 32 } 33 else 34 { 35 console.log("Hide the book cover!"); 36 $("#coverImage").css("display", "none"); 37 if ($("#tableOfContents").css("display") == "none") 38 displaySideBar(false); 39 } 40 41 return; 42 } 43 44 function displaySideBar(toggle) 45 { 46 if (toggle == true) 47 { 48 console.log("Show the sidebar!"); 49 $("#rightSidebar").css("display", "block"); 50 } 51 else 52 { 53 console.log("Hide the sidebar!"); 54 $("#rightSidebar").css("display", "none"); 55 } 56 57 return; 58 } 59 60 61 function checkDocumentRadio() 62 { 63 var selection = $('input[name="documentChanges"]'); //document.quiz.colour; 64 65 for (i=0; i<selection.length; i++) 66 67 if (selection[i].checked == true) 68 return selection[i].value; 69 70 return "this"; 71 } 72 73 function saveDocumentChanges() 74 { 75 console.log("Saving changes to "+checkDocumentRadio()); 76 } 77 78 79 80 /* FUNCTIONS FOR FORMAT EDITING */ 5 81 6 82 function onTextChange(item, text) … … 23 99 //item.setAttribute("selected","selected"); 24 100 } 25 26 101 27 102 //function createFormatStatement() … … 84 159 } 85 160 161 function checkClassifierRadio() 162 { 163 var selection = $('input[name="classifiers"]'); //document.quiz.colour; 164 165 for (i=0; i<selection.length; i++) 166 167 if (selection[i].checked == true) 168 return selection[i].value; 169 170 return "this"; 171 172 } 173 86 174 function updateFormatStatement() 87 175 { 88 176 var formatStatement = getFormatStatement(); 177 178 var thisOrAll = checkClassifierRadio(); 179 console.log(thisOrAll); 180 var myurl = document.URL; 181 182 var collection_name = getSubstring(myurl, "&c", "&"); 183 var service_name = getSubstring(myurl, "&s", "&"); 184 185 if(thisOrAll == "all") 186 service_name = "AllClassifierBrowse"; 187 188 var classifier_name = null; 189 190 if(service_name == "ClassifierBrowse") 191 classifier_name = getSubstring(myurl, "&cl", "&"); 192 193 var post_url = "http://localhost:8989/greenstone3/format?a=f&sa=update&c=" + collection_name +"&s=" + service_name; 194 195 if(classifier_name != null) 196 post_url = post_url + "&cl=" + classifier_name; 197 198 $.post(post_url, {data: formatStatement}, function(data) { 199 //$('.result').innerHTML = data; //html(data); 200 201 // An error is returned because there is no valid XSLT for a format update action, there probably shouldn't be one so we ignore what the post returns. 202 console.log("Successfully updated"); 203 //console.log(data); 204 }, 'html'); 205 } 206 207 function saveFormatStatement() 208 { 209 var formatStatement = getFormatStatement(); 210 var thisOrAll = checkClassifierRadio(); 89 211 90 212 var myurl = document.URL; … … 94 216 var classifier_name = null; 95 217 218 if(thisOrAll == "all") 219 service_name = "AllClassifierBrowse"; 220 96 221 if(service_name == "ClassifierBrowse") 97 222 classifier_name = getSubstring(myurl, "&cl", "&"); 98 223 99 var post_url = "http://localhost:8989/greenstone3/format?a=f&sa= update&c=" + collection_name +"&s=" + service_name;224 var post_url = "http://localhost:8989/greenstone3/format?a=f&sa=save&c=" + collection_name +"&s=" + service_name; 100 225 101 226 if(classifier_name != null) … … 104 229 $.post(post_url, {data: formatStatement}, function(data) { 105 230 //$('.result').innerHTML = data; //html(data); 106 console.log("Success, we have received data"); 107 console.log(data); 231 232 // An error is returned because there is no valid XSLT for a format update action, there probably shouldn't be one so we ignore what the post returns. 233 console.log("Successfully saved"); 234 //console.log(data); 108 235 }, 'html'); 109 236 } 110 237 111 function saveFormatStatement() 112 { 113 var formatStatement = getFormatStatement(); 114 238 function getXSLT(classname) 239 { 115 240 var myurl = document.URL; 116 241 117 242 var collection_name = getSubstring(myurl, "&c", "&"); 118 var service_name = getSubstring(myurl, "&s", "&"); 119 var classifier_name = null; 120 121 if(service_name == "ClassifierBrowse") 122 classifier_name = getSubstring(myurl, "&cl", "&"); 123 124 var post_url = "http://localhost:8989/greenstone3/format?a=f&sa=save&c=" + collection_name +"&s=" + service_name; 125 126 if(classifier_name != null) 127 post_url = post_url + "&cl=" + classifier_name; 128 129 $.post(post_url, {data: formatStatement}, function(data) { 130 //$('.result').innerHTML = data; //html(data); 131 console.log("Success, we have received data"); 132 console.log(data); 133 }, 'html'); 243 var document_id = getSubstring(myurl, "&d", "&"); 244 var document_type = getSubstring(myurl, "&dt", "&"); 245 var prev_action = getSubstring(myurl, "&p.a", "&"); 246 var prev_service = getSubstring(myurl, "&p.s", "&"); 247 //var classifier_name = null; 248 249 //if(service_name == "ClassifierBrowse") 250 // classifier_name = getSubstring(myurl, "&cl", "&"); 251 252 253 //var post_url = "http://localhost:8989/greenstone3/format?a=f&sa=getXSLT&c=" + collection_name +"&s=" + service_name+"&d=" + document_id + "&o=skinandlib"; 254 var post_url = "http://localhost:8989/greenstone3/format?a=d&c=" + collection_name + "&d=" + document_id + "&dt=" + document_type + "&p.a=" + prev_action + "&p.s=" + prev_service + "&o=skinandlib"; 255 256 //if(classifier_name != null) 257 // post_url = post_url + "&cl=" + classifier_name; 258 259 $.post(post_url, {data: classname}, function(data) { 260 //$('.result').innerHTML = data; //html(data); 261 console.log("Success, we have received data"); 262 //console.log(data); 263 classname = "." + classname; 264 console.log(classname); //data.getElementsByTagName("div")); 265 var content = $( data ).find(classname); 266 console.log(content.xml()); 267 $("#XSLTcode").val(content.xml()); 268 }, 'xml'); 134 269 } 135 270 … … 344 479 var CURRENT_SELECT_VALUE = ""; 345 480 481 /* DOCUMENT SPECIFIC FUNCTIONS */ 482 483 $('.sectionHeader').click(function () { 484 console.log('section Header click *'); 485 getXSLT("sectionHeader"); 486 return false; //don't event bubble 487 }); 488 489 $('.sectionContainer').click(function () { 490 console.log('section Container click *'); 491 getXSLT("sectionContainer"); 492 return false; // don't event bubble 493 }); 494 346 495 /* 347 496 var iframe = document.getElementById('iframe'); … … 567 716 //$('.tr').resize_tables($(this)); //equalHeights(); 568 717 718 $('#sectionHeader').click(function () { 719 console.log('section Header click *'); 720 return true; 721 }); 569 722 570 $(' td').click(function () {571 console.log(' tdclick *');572 return false;723 $('#sectionContainer').click(function () { 724 console.log('section Container click *'); 725 return true; 573 726 }); 574 727 -
main/trunk/greenstone3/web/interfaces/oran/transform/layouts/formatmanager.xsl
r24139 r24202 19 19 <!-- Sam2's div code --> 20 20 21 <script type="text/javascript" src="interfaces/oran/js/jquery-1.4.2.js"><xsl:text> </xsl:text></script> 22 <script type="text/javascript" src="interfaces/oran/js/jquery-ui-1.8rc1/ui/jquery-ui.js"><xsl:text> </xsl:text></script> 23 <script type="text/javascript" src="interfaces/oran/js/jquery.selectboxes.js"><xsl:text> </xsl:text></script> 21 24 <script type="text/javascript" src="interfaces/oran/js/innerxhtml.js"><xsl:text> </xsl:text></script> 25 <script type="text/javascript" src="interfaces/oran/js/jquery.xml.js"><xsl:text> </xsl:text></script> 22 26 <script type="text/javascript" src="interfaces/oran/js/gui_div.js"><xsl:text> </xsl:text></script> 23 27 … … 53 57 .droppable_hl { border: dashed 1px #ccc; background-color:#FFFFCC; } 54 58 59 #XSLTcode {width: 99%; } 60 55 61 .elementToolBox {position: fixed; top: 25%; right: 0px; background: none repeat scroll 0% 0% white; width: 250px; } 56 62 … … 62 68 <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/> 63 69 70 71 64 72 <table width="100%" border="1"> 65 73 66 <td width="75%"> 67 68 <button id="updateFormatStatement" type="button" onclick="updateFormatStatement()">Update Format Statement</button> 69 <button id="saveFormatStatement" type="button" onclick="saveFormatStatement()">Save Format Statement</button> 70 71 <div id="formatStatement"> 72 <div id="formatRoot"> 73 74 <xsl:call-template name="xml-to-gui"> 75 <xsl:with-param name="node-set" select="//format"/> <!-- [@type='browse']"/> --> 76 <xsl:with-param name="metadataSets" select="//metadataSetList"/> 77 </xsl:call-template> 78 </div> 79 </div> 80 </td> 81 82 83 <td class="elementToolBox"> 74 <td width="100%"> 75 <xsl:choose> 76 <xsl:when test="/page/pageRequest/@action = 'd'"> 77 <!-- TOC on or off --> 78 <xsl:choose> 79 <xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[(@name='TOC') and (@value='true')]"> 80 <input type="checkbox" name="TOC" checked="checked" onclick="displayTOC(this)">Display Table of Contents (set to true)</input> 81 </xsl:when> 82 <xsl:otherwise> 83 <input type="checkbox" name="TOC" onclick="displayTOC(this)">Display Table of Contents (set to false)</input> 84 </xsl:otherwise> 85 </xsl:choose> <br/> 86 87 <!-- book cover image on or off --> 88 <xsl:choose> 89 <xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[(@name='coverImage') and (@value='true')]"> 90 <input type="checkbox" name="bookCover" checked="checked" onclick="displayBookCover(this)">Display Book Cover Image (set to true)</input> 91 </xsl:when> 92 <xsl:otherwise> 93 <input type="checkbox" name="bookCover" onclick="displayBookCover(this)">Display Book Cover Image (set to false)</input> 94 </xsl:otherwise> 95 </xsl:choose> <br/> 96 97 <textarea id="XSLTcode" rows="5"> 98 The XSLT code for the relevant part of the page will be displayed here. 99 </textarea> 100 <!-- What are we doing? It might be possible to tweak saveFormatStatement() if we are only dealing with format stuff but are we? --> 101 <br/> 102 <table> 103 <td> 104 <button id="saveDocumentChanges" type="button" onclick="saveDocumentChanges()">Save Changes</button> 105 </td> 106 <td> 107 <form> 108 <input name="documentChanges" type="radio" id="applyToDocument" value="document" checked="true"/>Apply to this document only 109 <input name="documentChanges" type="radio" id="applyToCollection" value="collection" />Apply to collection 110 </form> 111 </td> 112 </table> 113 </xsl:when> 114 <xsl:otherwise> 115 <table> 116 <td> 117 <button id="updateFormatStatement" type="button" onclick="updateFormatStatement()">Update Format Statement</button> 118 </td> 119 <td> 120 <button id="saveFormatStatement" type="button" onclick="saveFormatStatement()">Save Format Statement</button> 121 </td> 122 <td> 123 <form> 124 <input name="classifiers" type="radio" id="applyToThis" value="this" checked="true"/>This Classifier 125 <input name="classifiers" type="radio" id="applyToAll" value="all" />All Classifiers 126 </form> 127 </td> 128 </table> 129 130 <div id="formatStatement"> 131 <div id="formatRoot"> 132 <xsl:call-template name="xml-to-gui"> 133 <xsl:with-param name="node-set" select="//format"/> <!-- [@type='browse']"/> --> 134 <xsl:with-param name="metadataSets" select="//metadataSetList"/> 135 </xsl:call-template> 136 </div> 137 </div> 138 </xsl:otherwise> 139 </xsl:choose> 140 </td> 141 </table> 142 143 <div class="elementToolBox"> 84 144 <h2> Elements to add </h2> 85 145 <!-- <div class="header element_type_gsf_template css_gsf_template" title="gsf:template">TEMPLATE</div> --> … … 212 272 <div class="draggable_td css_td" title="gsf:column">NEW TABLE COLUMN</div> 213 273 214 </td> 215 </table> 274 </div> 216 275 217 276 <!-- -
main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl
r24115 r24202 48 48 TEMPLATE FOR DOCUMENTS 49 49 --> 50 <xsl:template match="documentNode"> 50 51 <!--<xsl:template match="documentNode" priority="3">--> 52 <!-- show the document details --> 53 <!--<li class="document"> 54 <a> 55 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&d=<xsl:value-of select="@nodeID"/>&dt=<xsl:value-of select="@docType"/>&p.a=b&p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>&ed=1</xsl:attribute><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/> 56 </a> 57 </li> 58 </xsl:template>--> 59 60 <xsl:template match="documentNode" priority="3"> 51 61 <!-- The book icon --> 52 62 <td> … … 68 78 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/> 69 79 </td> 70 </xsl:template> 80 </xsl:template>--> 71 81 72 82 -
main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl
r24115 r24202 90 90 91 91 <!-- the book's cover image --> 92 <div id="coverImage"><gslib:coverImage/></div> 93 94 <!-- the contents --> 95 <div id="tableOfContents"> 96 <xsl:apply-templates select="documentNode" mode="TOC"/> 97 </div> 92 <!-- COULD BE WORTH SETTING THE STYLE TO DISPLAY:BLOCK OR DISPLAY:NONE BASED ON WHETHER FLAG IS TRUE OR FALSE --> 93 <!-- OTHERWISE, IF FLAG IS FALSE AND WE WANT TO TURN BOOK COVER ON, NEED TO REQUEST THE NEW PAGE WITH FLAG SET --> 94 <xsl:if test="/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']/@value='true'"> 95 <div id="coverImage"><gslib:coverImage/></div> 96 </xsl:if> 97 98 <!-- the contents (if enabled) --> 99 <!-- VALUE=<xsl:value-of select="/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value"/> --> 100 <xsl:if test="/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true'"> 101 <div id="tableOfContents"> 102 <xsl:apply-templates select="documentNode" mode="TOC"/> 103 </div> 104 </xsl:if> 98 105 </div> 99 106 </td></tr> … … 142 149 <a name="{@nodeID}"><xsl:text> </xsl:text></a> 143 150 <!-- Section header --> 144 <table ><tr>151 <table class="sectionHeader"><tr> 145 152 <!-- Expand/collapse button --> 146 153 <td class="headerTD"> … … 163 170 </span> 164 171 </xsl:if> 165 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/> 172 <!-- Display the title for the section regardless of whether automatic section numbering is turned on --> 173 <span class="sectionTitle"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/></span> 166 174 </p> 167 175 </td> -
main/trunk/greenstone3/web/interfaces/oran/transform/pages/pref.xsl
r24009 r24202 146 146 <br class="clear"/> 147 147 148 <!-- format editing --> 149 <div id="formateditprefs"> 150 <xsl:variable name="formatedit"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='formatedit']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='formatedit']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable> 151 <div class="paramLabel"> 152 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.formatedit')"/> 153 </div> 154 <div class="paramValue"> 155 <select name="formatedit"> 156 <option value="on"><xsl:if test="$formatedit='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.formatedit.on')"/></option> 157 <option value="off"><xsl:if test="$formatedit='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.formatedit.off')"/></option> 158 </select> 159 </div> 160 <br class="clear"/> 161 </div> 148 162 </div> 149 163
Note:
See TracChangeset
for help on using the changeset viewer.