- Timestamp:
- 2013-03-21T16:52:48+13:00 (11 years ago)
- Location:
- main/trunk/greenstone3/web/interfaces/default
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/debug_scripts.js
r27082 r27110 4 4 //Private member variables 5 5 //************************ 6 7 //The this variable 8 var _greenbug = this; 6 9 7 10 //Debugger state-keeping variables … … 19 22 var _vEditor; 20 23 24 var _navArea; 25 var _fileSelector; 21 26 var _templateSelector; 22 27 var _editor; … … 29 34 30 35 //Editor state-keeping variables 31 var _currentFilepath; 36 var _currentFileName; 37 var _currentLocation; 32 38 var _currentNodename; 33 39 var _currentName; … … 86 92 } 87 93 88 var createDebugDiv = function() 89 { 90 _mainDiv = $("<div>", {"id":"debugDiv"}); 91 _mainDiv.css( 92 { 93 "position":"fixed", 94 "font-size":"0.8em", 95 "bottom":"0px", 96 "width":"100%", 97 "background":"white", 98 "border":"1px black solid", 99 "padding":"5px", 100 "z-index":100 101 }); 102 103 _editingDiv = $("<div>"); 104 var toolBarDiv = $("<div>"); 105 toolBarDiv.css({"height":"40px"}); 106 107 var buttonDiv = $("<div>"); 108 toolBarDiv.append(buttonDiv); 109 110 _templateSelector = $("<div>", {"id":"templateSelector"}); 111 _templateSelector.css({"overflow":"auto", "width":"100%"}); 112 113 var pickElementButton = $("<button>Enable debugging</button>"); 94 var createButtonDiv = function(buttonDiv) 95 { 96 var pickElementButton = $("<button>Enable selector</button>"); 114 97 pickElementButton.click(function() 115 98 { 116 99 if(!_debugOn) 117 100 { 118 pickElementButton.button("option", "label", "Disable debugging");101 pickElementButton.button("option", "label", "Disable selector"); 119 102 $("a").click(function(e) 120 103 { … … 125 108 else 126 109 { 127 pickElementButton.button("option", "label", "Enable debugging");110 pickElementButton.button("option", "label", "Enable selector"); 128 111 $("a").off("click"); 129 112 clearAll(); … … 191 174 192 175 var url = gs.xsltParams.library_name; 193 var parameters = {"a":"g", "rt":"r", "s":"SaveXMLTemplateToFile", "s1. filePath":_currentFilepath, "s1.namespace":_currentNamespace, "s1.nodename":_currentNodename, "s1.xml":xmlString};176 var parameters = {"a":"g", "rt":"r", "s":"SaveXMLTemplateToFile", "s1.locationName":_currentLocation, "s1.fileName":_currentFileName, "s1.interfaceName":gs.xsltParams.interface_name, "s1.siteName":gs.xsltParams.site_name, "s1.collectionName":gs.cgiParams.c, "s1.namespace":_currentNamespace, "s1.nodename":_currentNodename, "s1.xml":xmlString}; 194 177 195 178 if(_currentName && _currentName.length > 0){parameters["s1.name"] = _currentName;} … … 284 267 }); 285 268 _styleFunctions.push(function(){undoButton.button({icons:{primary:"ui-icon-arrowreturnthick-1-w"}})}); 286 269 270 buttonDiv.append(pickElementButton); 271 buttonDiv.append(_unpauseButton); 272 buttonDiv.append(_closeEditorButton); 273 buttonDiv.append(_saveButton); 274 buttonDiv.append(_swapEditorButton); 275 buttonDiv.append(undoButton); 276 } 277 278 var createXMLStatusBar = function(buttonDiv) 279 { 287 280 _xmlStatusBar = $("<span>"); 288 281 _xmlStatusBar.css("padding", "5px"); … … 327 320 328 321 }, 2000); 329 330 var clear = $("<span>");331 clear.css("clear", "both");332 toolBarDiv.append(clear);333 334 buttonDiv.append(pickElementButton);335 buttonDiv.append(_unpauseButton);336 buttonDiv.append(_closeEditorButton);337 buttonDiv.append(_saveButton);338 buttonDiv.append(_swapEditorButton);339 buttonDiv.append(undoButton);340 322 buttonDiv.append(_xmlStatusBar); 323 } 324 325 var createDebugDiv = function() 326 { 327 _mainDiv = $("<div>", {"id":"debugDiv"}); 328 _mainDiv.css( 329 { 330 "position":"fixed", 331 "font-size":"0.8em", 332 "bottom":"0px", 333 "width":"100%", 334 "background":"white", 335 "border":"1px black solid", 336 "padding":"5px", 337 "z-index":100 338 }); 339 340 _editingDiv = $("<div>"); 341 var toolBarDiv = $("<div>"); 342 toolBarDiv.css({"height":"40px"}); 343 toolBarDiv.append("<div>", {style:"clear:both;"}); 344 345 var buttonDiv = $("<div>"); 346 toolBarDiv.append(buttonDiv); 347 createButtonDiv(buttonDiv); 348 createXMLStatusBar(buttonDiv); 349 350 _navArea = $("<div>", {"id":"veNavArea"}); 351 _templateSelector = $("<div>", {"id":"veTemplateSelector"}); 352 _fileSelector = $("<div>", {"id":"veFileSelector", "class":"ui-state-default ui-corner-all"}); 353 _navArea.append(_fileSelector); 354 _navArea.append(_templateSelector); 355 _navArea.append("<div>", {style:"clear:both;"}); 356 357 //Populate the file selector 358 var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetXSLTFilesForCollection&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c; 359 $.ajax(url) 360 .success(function(response) 361 { 362 var listStartIndex = response.indexOf("<fileListJSON>") + "<fileListJSON>".length; 363 var listEndIndex = response.indexOf("</fileListJSON>"); 364 365 var listString = response.substring(listStartIndex, listEndIndex).replace(/"/g, "\"").replace(/\\/g, "/"); 366 var list = eval(listString); 367 368 var selectBox = $("<select>"); 369 selectBox.append($("<option>-- Select a file --</option>", {value:"none"})); 370 _fileSelector.append("<span>Files: </span>"); 371 _fileSelector.append(selectBox); 372 for(var i = 0; i < list.length; i++) 373 { 374 var item = list[i]; 375 var option = $("<option>" + item.path + " (" + item.location + ")</option>", {value:item.path}); 376 option.data("fileItem", item); 377 selectBox.append(option); 378 } 379 380 selectBox.change(function() 381 { 382 var selectedItem = selectBox.find(":selected"); 383 384 var getURL = gs.xsltParams.library_name + "?a=g&rt=r&s=GetTemplateListFromFile&s1.fileName=" + selectedItem.data("fileItem").path + "&s1.locationName=" + selectedItem.data("fileItem").location + "&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c; 385 $.ajax(getURL) 386 .success(function(templateResponse) 387 { 388 var templateListStart = templateResponse.indexOf("<templateList>") + "<templateList>".length; 389 var templateListEnd = templateResponse.indexOf("</templateList>"); 390 var templateListString = templateResponse.substring(templateListStart, templateListEnd).replace(/"/g, "\""); 391 var templateList = eval(templateListString); 392 393 clearAll(); 394 395 for(var i = 0; i < templateList.length; i++) 396 { 397 var fileName = selectedItem.data("fileItem").path; 398 var location = selectedItem.data("fileItem").location; 399 var namespace = templateList[i].namespace; 400 var nodename = "template"; 401 var name = templateList[i].name; 402 var match = templateList[i].match; 403 404 if(name) 405 { 406 name = templateList[i].name.replace(/'/g, "'").replace(/"/g, "\"").replace(/&/g, "&"); 407 } 408 if(match) 409 { 410 match = templateList[i].match.replace(/'/g, "'").replace(/"/g, "\"").replace(/&/g, "&"); 411 } 412 413 var infoContainer = $("<div>", {"class":"gbTemplateContainer ui-state-default ui-corner-all"}); 414 415 _elements.push(infoContainer); 416 417 addMouseEventsToInfoContainer(infoContainer, fileName, location, nodename, namespace, name, match); 418 419 if(name && name.length > 0) 420 { 421 infoContainer.text(name); 422 } 423 if(match && match.length > 0) 424 { 425 infoContainer.text(match); 426 } 427 428 if(_templateSelector.children("div").length > 0) 429 {/* 430 var spacer = $("<div>>></div>"); 431 spacer.addClass("gbSpacer"); 432 433 _templateSelector.prepend(spacer); 434 _elements.push(spacer); 435 */ 436 } 437 438 _templateSelector.prepend(infoContainer); 439 440 //resizeContainers(); 441 } 442 }); 443 }); 444 }) 445 .error(function() 446 { 447 console.log("Error retrieving XSLT files"); 448 }); 341 449 342 450 _styleFunctions.push(function(){$(".ui-button").css({"margin-right":"0.5em"});}); … … 344 452 _mainDiv.append(toolBarDiv); 345 453 _mainDiv.append(_editingDiv); 346 _mainDiv.append("<div>Templates:</div>"); 347 _mainDiv.append(_templateSelector); 454 _mainDiv.append(_navArea); 348 455 } 349 456 … … 377 484 } 378 485 379 var addMouseEventsToInfoContainer = function(infoContainer, filepath, nodename, namespace, name, match) 486 this.changeCurrentTemplate = function(location, fileName, nodename, namespace, name, match) 487 { 488 var responseName = "requestedNameTemplate"; 489 490 var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetXMLTemplateFromFile&s1.fileName=" + fileName + "&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c + "&s1.locationName=" + location + "&s1.namespace=" + namespace + "&s1.nodename=" + nodename; 491 if(match && match.length > 0){url += "&s1.match=" + match; responseName = "requestedMatchTemplate";} 492 if(name && name.length > 0){url += "&s1.name=" + name;} 493 494 $.ajax(url) 495 .success(function(response) 496 { 497 var template; 498 if(response.search(responseName) != -1) 499 { 500 var startIndex = response.indexOf("<" + responseName + ">") + responseName.length + 2; 501 var endIndex = response.indexOf("</" + responseName + ">"); 502 template = response.substring(startIndex, endIndex); 503 } 504 else 505 { 506 return; 507 } 508 509 _textEditor = $("<div>", {"id":"textEditor"}); 510 _textEditor.css({"width":"100%", "height":"300px"}); 511 _textEditor.val(template); 512 513 if(_isVisualEditor) 514 { 515 _textEditor.hide(); 516 } 517 518 _editingDiv.empty(); 519 _editingDiv.append($("<p>Location: " + location + " <br/>Filename: " + fileName + "</p>")); 520 _editingDiv.append(_textEditor); 521 522 _vEditor = new visualXMLEditor(template); 523 _editingDiv.append(_vEditor.getMainDiv()); 524 _vEditor.setGreenbug(_greenbug); 525 _vEditor.selectRootElement(); 526 527 if(!_isVisualEditor) 528 { 529 _vEditor.getMainDiv().hide(); 530 } 531 532 _editor = ace.edit("textEditor"); 533 _editor.getSession().setMode("ace/mode/xml"); 534 _editor.getSession().setUseSoftTabs(false); 535 _editor.setValue(template); 536 _editor.clearSelection(); 537 var UndoManager = require("ace/undomanager").UndoManager; 538 _editor.getSession().setUndoManager(new UndoManager()); 539 540 _textEditor.css({"min-height":"200px", "border-top":"5px solid #444"}); 541 _textEditor.resizable({handles: 'n', resize:function() 542 { 543 _textEditor.css({top:"0px"}); 544 _editor.resize(); 545 }}); 546 547 _closeEditorButton.button("option", "disabled", false); 548 if(_closeEditorButton.button("option", "label") == "Open editor") 549 { 550 _closeEditorButton.button("option", "label", "Close editor"); 551 _editingDiv.show(); 552 } 553 }) 554 .error(function() 555 { 556 console.log("ERROR"); 557 }); 558 } 559 560 var addMouseEventsToInfoContainer = function(infoContainer, fileName, location, nodename, namespace, name, match) 380 561 { 381 562 infoContainer.click(function() … … 389 570 _selectedTemplate.css("border", "red 1px solid"); 390 571 391 _currentFilepath = filepath; 572 _currentFileName = fileName; 573 _currentLocation = location; 392 574 _currentNodename = nodename; 393 575 _currentNamespace = namespace; … … 395 577 _currentMatch = match; 396 578 397 var responseName = "requestedNameTemplate"; 398 399 var url = gs.xsltParams.library_name + "?a=g&rt=r&s=RetrieveXMLTemplateFromFile&s1.filePath=" + _currentFilepath + "&s1.namespace=" + _currentNamespace + "&s1.nodename=" + _currentNodename; 400 if(_currentMatch && _currentMatch.length > 0){url += "&s1.match=" + _currentMatch; responseName = "requestedMatchTemplate";} 401 if(_currentName && _currentName.length > 0){url += "&s1.name=" + _currentName;} 402 $.ajax(url) 403 .success(function(response) 404 { 405 var template; 406 if(response.search(responseName) != -1) 407 { 408 var startIndex = response.indexOf("<" + responseName + ">") + responseName.length + 2; 409 var endIndex = response.indexOf("</" + responseName + ">"); 410 template = response.substring(startIndex, endIndex); 411 } 412 else 413 { 414 return; 415 } 416 417 _textEditor = $("<div>", {"id":"textEditor"}); 418 _textEditor.css({"width":"100%", "height":"300px"}); 419 _textEditor.val(template); 420 421 if(_isVisualEditor) 422 { 423 _textEditor.hide(); 424 } 425 426 _editingDiv.empty(); 427 _editingDiv.append($("<p>" + filepath + "</p>")); 428 _editingDiv.append(_textEditor); 429 430 _vEditor = new visualXMLEditor(template); 431 _editingDiv.append(_vEditor.getMainDiv()); 432 _vEditor.selectRootElement(); 433 434 if(!_isVisualEditor) 435 { 436 _vEditor.getMainDiv().hide(); 437 } 438 439 _editor = ace.edit("textEditor"); 440 _editor.getSession().setMode("ace/mode/xml"); 441 _editor.getSession().setUseSoftTabs(false); 442 _editor.setValue(template); 443 _editor.clearSelection(); 444 var UndoManager = require("ace/undomanager").UndoManager; 445 _editor.getSession().setUndoManager(new UndoManager()); 446 447 _textEditor.css({"min-height":"200px", "border-top":"5px solid #444"}); 448 _textEditor.resizable({handles: 'n', resize:function() 449 { 450 _textEditor.css({top:"0px"}); 451 _editor.resize(); 452 }}); 453 454 _closeEditorButton.button("option", "disabled", false); 455 if(_closeEditorButton.button("option", "label") == "Open editor") 456 { 457 _closeEditorButton.button("option", "label", "Close editor"); 458 _editingDiv.show(); 459 } 460 }) 461 .error(function() 462 { 463 console.log("ERROR"); 464 }); 579 _greenbug.changeCurrentTemplate(location, fileName, nodename, namespace, name, match); 465 580 }); 466 581 infoContainer.mouseover(function() 467 582 { 468 $(this). data("background", $(this).css("background"));469 $(this). css("background", "yellow");583 $(this).removeClass("ui-state-default"); 584 $(this).addClass("ui-state-active"); 470 585 }); 471 586 infoContainer.mouseout(function() 472 587 { 473 $(this).css("background", $(this).data("background")); 588 $(this).addClass("ui-state-default"); 589 $(this).removeClass("ui-state-active"); 474 590 }); 475 591 } … … 490 606 if(_debugOn && !_pauseSelector) 491 607 { 608 _fileSelector.find("select").val("none"); 609 492 610 var nodes = new Array(); 493 611 if($(this).is("table, tr")) … … 518 636 nodes.push(this); 519 637 } 520 638 521 639 $(nodes).each(function() 522 640 { … … 528 646 var name = $(this).attr("name"); 529 647 var match = $(this).attr("match"); 530 531 var infoContainer = $("<div>"); 532 infoContainer.addClass("gbTemplateContainer"); 533 648 649 var location; 650 var fileName; 651 if(filepath.search(/[\/\\]interfaces[\/\\]/) != -1) 652 { 653 location = "interface"; 654 fileName = filepath.replace(/.*[\/\\]transform[\/\\]/, ""); 655 } 656 else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/) != -1) 657 { 658 location = "collectionConfig"; 659 fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/, ""); 660 } 661 else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/) != -1) 662 { 663 location = "collection"; 664 fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/, ""); 665 } 666 else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/) != -1) 667 { 668 location = "site"; 669 fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/, ""); 670 } 671 672 var infoContainer = $("<div>", {"class":"gbTemplateContainer ui-state-default ui-corner-all"}); 673 534 674 _elements.push(infoContainer); 535 536 addMouseEventsToInfoContainer(infoContainer, filepath, nodename, namespace, name, match); 537 538 /* 539 var attrstr = ""; 540 var illegalNames = ["nodename", "filename", "style", "debug", "id", "class"]; 541 542 var attributes = ((this.tempAttrs) ? this.tempAttrs : this.attributes); 543 544 $(attributes).each(function() 545 { 546 for(var i = 0; i < illegalNames.length; i++) 547 { 548 if(this.name == illegalNames[i]){return;} 549 } 550 attrstr += this.name + "=\"" + this.value + "\" "; 551 }); 552 553 infoContainer.text("<" + fullNodename + " " + attrstr + ">"); 554 */ 555 675 676 addMouseEventsToInfoContainer(infoContainer, fileName, location, nodename, namespace, name, match); 677 556 678 if(name && name.length > 0) 557 679 { … … 562 684 infoContainer.text(match); 563 685 } 564 686 565 687 if(_templateSelector.children("div").length > 0) 566 688 { 689 /* 567 690 var spacer = $("<div>>></div>"); 568 691 spacer.addClass("gbSpacer"); … … 570 693 _templateSelector.prepend(spacer); 571 694 _elements.push(spacer); 572 } 573 695 */ 696 } 697 574 698 _templateSelector.prepend(infoContainer); 575 576 resizeContainers();699 700 //resizeContainers(); 577 701 }); 578 702 … … 626 750 var url = document.URL; 627 751 url = url.replace("debug=0", ""); 628 if(url.indexOf("?") != -1) 752 753 if(url.indexOf("?") == url.length - 1) 754 { 755 document.location.href = url += "debug=1"; 756 } 757 else if(url.indexOf("?") != -1) 629 758 { 630 759 document.location.href = url += "&debug=1"; 631 }632 else if(url.indexOf("?") == url.length - 1)633 {634 document.location.href = url += "debug=1";635 760 } 636 761 else -
main/trunk/greenstone3/web/interfaces/default/js/visual-xml-editor.js
r27072 r27110 6 6 function visualXMLEditor(xmlString) 7 7 { 8 var thisEditor = this; 8 var _thisEditor = this; 9 var _greenbug; 9 10 10 11 var _globalID = 0; … … 89 90 }; 90 91 92 this.setGreenbug = function(gb) 93 { 94 _greenbug = gb; 95 } 96 91 97 this.getXML = function() 92 98 { … … 243 249 var retrieveGSLIBTemplates = function(callback) 244 250 { 245 var url = gs.xsltParams.library_name + "?a=g&rt=r&s=Get GSLIBElementsFromFile&s1.interfaceName=" + gs.xsltParams.interface_name;251 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"; 246 252 247 253 $.ajax(url) … … 253 259 var listString = response.substring(startIndex, endIndex); 254 260 var list = eval(listString.replace(/"/g, "\"")); 255 256 _elemList["gslib"] = list; 261 var modifiedList = new Array(); 262 263 for(var i = 0; i < list.length; i++) 264 { 265 var current = list[i]; 266 if(current.name) 267 { 268 modifiedList.push(current.name); 269 } 270 } 271 272 _elemList["gslib"] = modifiedList; 257 273 258 274 if(callback) … … 569 585 570 586 var _textEditor = $("<div>"); 571 var _textTitle = $("<div>Text:</div>");572 587 var _nodeText = $("<div>"); 573 588 _nodeText.text(_xmlNode.nodeValue); 574 589 575 _textEditor.append(_textTitle);576 590 _textEditor.append(_nodeText); 577 591 … … 1068 1082 this.populateInformationDiv = function() 1069 1083 { 1070 thisEditor.savePendingEdits();1084 _thisEditor.savePendingEdits(); 1071 1085 _infoDiv.empty(); 1072 1086 1073 var nameElement = $("<p>");1074 1087 if(_xmlNode.nodeType == 1) 1075 1088 { 1076 nameElement.text("Name: " + _xmlNode.nodeName); 1089 var nameElementTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"}).text("Element name:"); 1090 _infoDiv.append(nameElementTitle); 1091 _infoDiv.append($("<p>").text(_xmlNode.nodeName)); 1077 1092 } 1078 1093 else 1079 1094 { 1080 nameElement.text("[text node]");1081 }1082 _infoDiv.append(nameElement);1095 var textElementTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"}).text("Text node:"); 1096 _infoDiv.append(textElementTitle); 1097 } 1083 1098 1084 1099 if(_xmlNode.nodeType == 1) 1085 1100 { 1086 var attributeTableTitle = $("<p>Attributes:<p/>"); 1101 var attributeTableTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"}); 1102 attributeTableTitle.text("Attributes:"); 1087 1103 var attributeTable = $("<table>"); 1088 1104 attributeTable.addClass("veAttributeTableContainer"); … … 1099 1115 _infoDiv.append(attributeTable); 1100 1116 1117 var addDiv = $("<div>", {"class":"veInfoDivTitle"}); 1101 1118 var addSelect = $("<select>"); 1102 1119 addSelect.append("<option>[blank]</option>", {value:"[blank]"}); … … 1149 1166 _transactions.push({type:"addAttr", row:row}) 1150 1167 }); 1151 _infoDiv.append(addSelect); 1152 _infoDiv.append(addButton); 1168 addDiv.append(addSelect); 1169 addDiv.append(addButton); 1170 _infoDiv.append(addDiv); 1153 1171 addButton.button(); 1172 1173 /* 1174 if(_xmlNode.tagName == "xsl:call-template" && _xmlNode.getAttribute("name").length > 0) 1175 { 1176 var extraOptionsTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"}).text("Additional options:"); 1177 var visitTemplateOption = $("<button>View called template</button>"); 1178 1179 _infoDiv.append(extraOptionsTitle); 1180 _infoDiv.append(visitTemplateOption); 1181 1182 visitTemplateOption.button(); 1183 visitTemplateOption.click(function() 1184 { 1185 var template = ""; 1186 template += '<xsl:template match="/">'; 1187 template += '<calledTemplate>'; 1188 var params = $(_xmlNode).children("xsl\\:with-param"); 1189 if(!params.length) 1190 { 1191 template += '<xsl:call-template name="' + _xmlNode.getAttribute("name") + '"/>'; 1192 } 1193 else 1194 { 1195 template += '<xsl:call-template name="' + _xmlNode.getAttribute("name") + '">'; 1196 for(var i = 0; i < params.length; i++) 1197 { 1198 var param = params.eq(i); 1199 template += "<xsl:with-param"; 1200 for(var j = 0; j < param[0].attributes.length; j++) 1201 { 1202 var attr = param[0].attributes[j]; 1203 template += " " + attr.name + "=\"" + attr.value + "\""; 1204 } 1205 template += "/>"; 1206 } 1207 template += '</xsl:call-template>'; 1208 } 1209 template += '</calledTemplate>'; 1210 template += '</xsl:template>'; 1211 template = template.replace(" ", "%20"); 1212 1213 var url = document.URL; 1214 if(url.indexOf("?") == url.length - 1) 1215 { 1216 url += "ilt=" + template; 1217 } 1218 else if(url.indexOf("?") != -1) 1219 { 1220 url += "&ilt=" + template; 1221 } 1222 else 1223 { 1224 url += "?ilt=" + template; 1225 } 1226 1227 $.ajax(url) 1228 .success(function(response) 1229 { 1230 var xml = $.parseXML(response); 1231 var debug = $(xml).find("calledTemplate debug"); 1232 1233 _greenbug.changeCurrentTemplate(debug[0].getAttribute("filename"), "template", "xsl", debug[0].getAttribute("name"), null); 1234 $(".gbTemplateContainer").css("border", "1px dashed #AAAAAA"); 1235 }); 1236 }); 1237 } 1238 */ 1154 1239 } 1155 1240 … … 1159 1244 _infoDiv.append(textNode.getDiv()); 1160 1245 } 1161 }1162 1163 this.remove = function()1164 {1165 var divParent = _div.parents(".veElement");1166 _transactions.push({type:"remMvElem", vElemParent:_div.parent(), vElemPos:_div.index(), vElem:_div});1167 _div.data("expanded", "normal");1168 $(_xmlNode).remove();1169 _div.detach();1170 _infoDiv.empty();1171 1172 if(divParent.length)1173 {1174 divParent.first().trigger("click");1175 }1176 1177 $("#veTrash").children("img").attr("src", gs.imageURLs.trashFull);1178 1246 } 1179 1247 … … 1247 1315 return false; 1248 1316 } 1317 1318 this.remove = function() 1319 { 1320 var divParent = _div.parents(".veElement"); 1321 _transactions.push({type:"remMvElem", vElemParent:_div.parent(), vElemPos:_div.index(), vElem:_div}); 1322 _div.data("expanded", "normal"); 1323 $(_xmlNode).remove(); 1324 _div.detach(); 1325 _infoDiv.empty(); 1326 1327 if(divParent.length) 1328 { 1329 divParent.first().trigger("click"); 1330 } 1331 1332 $("#veTrash").children("img").attr("src", gs.imageURLs.trashFull); 1333 } 1249 1334 1250 1335 this.expand = function() -
main/trunk/greenstone3/web/interfaces/default/style/core.css
r27080 r27110 897 897 float:left; 898 898 cursor:pointer; 899 border:1px dashed #AAAAAA; 900 margin:0; 899 margin:0 1em; 901 900 font-size:1.1em; 902 901 text-align:center; 902 overflow:hidden; 903 min-width:4em; 904 padding: 0.5em; 903 905 } 904 906 … … 914 916 margin:0; 915 917 padding:0; 918 } 919 920 #veNavArea{ 921 width:100%; 922 } 923 924 #veTemplateSelector{ 925 width:75%; 926 float:right; 927 } 928 929 #veFileSelector{ 930 float:left; 931 padding:0.5em; 916 932 } 917 933 … … 1010 1026 } 1011 1027 1028 .veInfoDivTitle{ 1029 text-align:center; 1030 margin-bottom:1em; 1031 } 1032 1012 1033 .veAttributeTableContainer{ 1013 1034 text-align:center; 1014 1035 width:100%; 1015 margin-bottom: 2em;1036 margin-bottom:1em; 1016 1037 } 1017 1038
Note:
See TracChangeset
for help on using the changeset viewer.