- Timestamp:
- 2011-06-27T11:07:20+12:00 (13 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.