- Timestamp:
- 2013-04-18T13:15:34+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/visual-xml-editor.js
r27163 r27218 277 277 var retrieveGSLIBTemplates = function(callback) 278 278 { 279 var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetTemplateListFromFile&s1.locationName=interface&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.fileName=gslib.xsl"; 280 281 $.ajax(url) 282 .success(function(response) 283 { 284 startIndex = response.search("<templateList>") + "<templateList>".length; 285 endIndex = response.search("</templateList>"); 286 287 if(startIndex == "<templateList>".length - 1) 279 if($(document).data("gslibList")) 280 { 281 _elemList["gslib"] = $(document).data("gslibList"); 282 283 if(callback) 284 { 285 callback(); 286 } 287 } 288 else 289 { 290 var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetTemplateListFromFile&s1.locationName=interface&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.fileName=gslib.xsl"; 291 292 $.ajax(url) 293 .success(function(response) 294 { 295 startIndex = response.search("<templateList>") + "<templateList>".length; 296 endIndex = response.search("</templateList>"); 297 298 if(startIndex == "<templateList>".length - 1) 299 { 300 console.log("Error retrieving GSLIB templates"); 301 return; 302 } 303 304 var listString = response.substring(startIndex, endIndex); 305 var list = eval(listString.replace(/"/g, "\"")); 306 var modifiedList = new Array(); 307 308 for(var i = 0; i < list.length; i++) 309 { 310 var current = list[i]; 311 if(current.name) 312 { 313 modifiedList.push(current.name); 314 } 315 } 316 317 _elemList["gslib"] = modifiedList; 318 $(document).data("gslibList", modifiedList); 319 320 if(callback) 321 { 322 callback(); 323 } 324 }) 325 .error(function() 288 326 { 289 327 console.log("Error retrieving GSLIB templates"); 290 return; 291 } 292 293 var listString = response.substring(startIndex, endIndex); 294 var list = eval(listString.replace(/"/g, "\"")); 295 var modifiedList = new Array(); 296 297 for(var i = 0; i < list.length; i++) 298 { 299 var current = list[i]; 300 if(current.name) 301 { 302 modifiedList.push(current.name); 303 } 304 } 305 306 _elemList["gslib"] = modifiedList; 307 308 if(callback) 309 { 310 callback(); 311 } 312 }) 313 .error(function() 314 { 315 console.log("Error retrieving GSLIB templates"); 316 }); 328 }); 329 } 317 330 } 318 331 … … 328 341 329 342 var tab = $("<li>"); 330 var tabLink = $("<a>", {"href": "#ve" + key});343 var tabLink = $("<a>", {"href":document.URL + "#ve" + key}); 331 344 tabLink.css({"font-size":"0.9em", "padding":"5px"}); 332 345 tabLink.text(key); … … 353 366 354 367 var otherTab = $("<li>"); 355 var otherTabLink = $("<a>", {"href": "#veother"});368 var otherTabLink = $("<a>", {"href":document.URL + "#veother"}); 356 369 otherTabLink.css({"font-size":"0.9em", "padding":"5px"}); 357 370 otherTabLink.text("other");
Note:
See TracChangeset
for help on using the changeset viewer.