- Timestamp:
- 2012-12-05T14:56:21+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/debug_scripts.js
r26492 r26554 92 92 $(this).val("Open editor"); 93 93 _editingDiv.hide(); 94 _mainDiv.css("height", "300px");94 _mainDiv.css("height", (_mainDiv.height() - 200) + "px"); 95 95 } 96 96 else … … 98 98 $(this).val("Close editor"); 99 99 _editingDiv.show(); 100 _mainDiv.css("height", "500px");100 _mainDiv.css("height", (_mainDiv.height() + 200) + "px"); 101 101 } 102 102 }); … … 129 129 _xmlStatusBar.css({"color":"white", "background": "green"}); 130 130 _xmlStatusBar.removeAttr("title"); 131 _saveButton.removeAttr("disabled"); 131 if(_saveButton.val() == "Save changes") 132 { 133 _saveButton.removeAttr("disabled"); 134 } 132 135 } 133 136 … … 155 158 156 159 if(_currentName && _currentName.length > 0){parameters["s1.name"] = _currentName;} 157 if(_currentMatch && _currentMath.length > 0){parameters["s1.match"] = _currentMatch;} 160 if(_currentMatch && _currentMatch.length > 0){parameters["s1.match"] = _currentMatch;} 161 162 _saveButton.val("Saving..."); 163 _saveButton.attr("disabled", "disabled"); 158 164 159 165 $.post(url, parameters) 160 166 .success(function() 161 167 { 162 alert("The template has been saved successfully."); 168 $.ajax(gs.xsltParams.library_name + "?a=s&sa=c") 169 .success(function() 170 { 171 alert("The template has been saved successfully."); 172 }) 173 .error(function() 174 { 175 alert("Error reloading collection."); 176 }) 177 .complete(function() 178 { 179 _saveButton.val("Save changes"); 180 _saveButton.removeAttr("disabled"); 181 }); 163 182 }) 164 183 .error(function() … … 242 261 _currentMatch = match; 243 262 263 var responseName = "requestedNameTemplate"; 264 244 265 var url = gs.xsltParams.library_name + "?a=g&rt=r&s=RetrieveXMLTemplateFromFile&s1.filePath=" + _currentFilepath + "&s1.namespace=" + _currentNamespace + "&s1.nodename=" + _currentNodename; 266 if(_currentMatch && _currentMatch.length > 0){url += "&s1.match=" + _currentMatch; responseName = "requestedMatchTemplate";} 245 267 if(_currentName && _currentName.length > 0){url += "&s1.name=" + _currentName;} 246 if(_currentMatch && _currentMatch.length > 0){url += "&s1.match=" + _currentMatch;}247 268 $.ajax(url) 248 269 .success(function(response) 249 270 { 250 271 var template; 251 if(response.search( /<requestedTemplate>/) != -1)252 { 253 var startIndex = response.indexOf("< requestedTemplate>") + ("<requestedTemplate>").length;254 var endIndex = response.indexOf("</ requestedTemplate>");272 if(response.search(responseName) != -1) 273 { 274 var startIndex = response.indexOf("<" + responseName + ">") + responseName.length + 2; 275 var endIndex = response.indexOf("</" + responseName + ">"); 255 276 template = response.substring(startIndex, endIndex); 256 277 } … … 303 324 if(_debugOn && !_pauseSelector) 304 325 { 305 var infoContainer = $("<div>"); 306 infoContainer.css({"cursor":"pointer", "border":"1px dashed #AAAAAA", "margin":"5px"}); 307 var fromDIV = $("<div>"); 308 var elementDIV = $("<div>"); 309 310 elementDIV.css("font-size", "1.1em"); 311 fromDIV.css("font-size", "0.9em"); 312 313 infoContainer.append(fromDIV); 314 infoContainer.append(elementDIV); 315 316 _elements.push(infoContainer); 317 318 var filepath = $(this).attr("filename"); 319 var fullNodename = $(this).attr("nodename"); 320 var colonIndex = fullNodename.indexOf(":"); 321 var namespace = fullNodename.substring(0, colonIndex); 322 var nodename = fullNodename.substring(colonIndex + 1); 323 var name = $(this).attr("name"); 324 var match = $(this).attr("match"); 325 326 addMouseEventsToInfoContainer(infoContainer, filepath, nodename, namespace, name, match); 327 328 var nodeName = $(this).attr("nodename"); 329 var filename = $(this).attr("filename"); 330 var attrstr = ""; 331 var illegalNames = ["nodename", "filename", "style", "debug", "id", "class"]; 332 333 $(this.attributes).each(function() 334 { 335 for(var i = 0; i < illegalNames.length; i++) 326 var nodes = new Array(); 327 if($(this).is("table, tr")) 328 { 329 var size = parseInt($(this).attr("debugSize")); 330 for(var i = 0; i < size; i++) 336 331 { 337 if(this.name == illegalNames[i]){return;} 332 var tempNode = $("<div>"); 333 tempNode.tempAttrs = new Array(); 334 $(this.attributes).each(function() 335 { 336 if(this.value.charAt(0) == '[') 337 { 338 var values = eval(this.value); 339 if(values[i] == "") 340 { 341 return; 342 } 343 tempNode.attr(this.name, values[i]); 344 tempNode.tempAttrs.push({name:this.name, value:values[i]}); 345 } 346 }); 347 nodes.push(tempNode); 338 348 } 339 attrstr += this.name + "=\"" + this.value + "\" "; 349 } 350 else 351 { 352 nodes.push(this); 353 } 354 355 $(nodes).each(function() 356 { 357 var filepath = $(this).attr("filename"); 358 var fullNodename = $(this).attr("nodename"); 359 var colonIndex = fullNodename.indexOf(":"); 360 var namespace = fullNodename.substring(0, colonIndex); 361 var nodename = fullNodename.substring(colonIndex + 1); 362 var name = $(this).attr("name"); 363 var match = $(this).attr("match"); 364 365 var infoContainer = $("<div>"); 366 infoContainer.css({"cursor":"pointer", "border":"1px dashed #AAAAAA", "margin":"5px"}); 367 var fromDIV = $("<div>"); 368 var elementDIV = $("<div>"); 369 370 elementDIV.css("font-size", "1.1em"); 371 fromDIV.css("font-size", "0.9em"); 372 373 infoContainer.append(fromDIV); 374 infoContainer.append(elementDIV); 375 376 _elements.push(infoContainer); 377 378 addMouseEventsToInfoContainer(infoContainer, filepath, nodename, namespace, name, match); 379 380 var attrstr = ""; 381 var illegalNames = ["nodename", "filename", "style", "debug", "id", "class"]; 382 383 var attributes = ((this.tempAttrs) ? this.tempAttrs : this.attributes); 384 385 $(attributes).each(function() 386 { 387 for(var i = 0; i < illegalNames.length; i++) 388 { 389 if(this.name == illegalNames[i]){return;} 390 } 391 attrstr += this.name + "=\"" + this.value + "\" "; 392 }); 393 394 fromDIV.text("From " + filepath + ":"); 395 elementDIV.text("<" + fullNodename + " " + attrstr + ">"); 396 397 _textDiv.prepend(infoContainer); 340 398 }); 341 342 fromDIV.text("From " + filename + ":");343 elementDIV.text("<" + nodeName + " " + attrstr + ">");344 345 _textDiv.prepend(infoContainer);346 399 347 400 if(!_itemSelected)
Note:
See TracChangeset
for help on using the changeset viewer.