[312] | 1 | |
---|
| 2 | function showAssetTreePane(paneDivId, loadingImg, url) { |
---|
| 3 | Effect.Appear(paneDivId,{duration:0.4}); |
---|
| 4 | new Effect.Pulsate($(loadingImg), { pulses: 200, duration: 133 }); |
---|
| 5 | new Ajax.Updater({ success: paneDivId }, url, {asynchronous:true,evalScripts:true}); |
---|
| 6 | } |
---|
| 7 | |
---|
| 8 | function hideAssetTreePane(paneDivId, tableDivId, saveUrl) { |
---|
| 9 | |
---|
| 10 | // Collect the visible div's first. |
---|
| 11 | var visibleDivs = $(tableDivId).select('div').findAll(function(el) { return el.visible(); }) |
---|
| 12 | var params = "assetTreeVisibleBranches="; |
---|
| 13 | |
---|
| 14 | // Hide the pane. |
---|
| 15 | $(paneDivId).toggle(); |
---|
| 16 | |
---|
| 17 | // Add the id of each visible div to params. |
---|
| 18 | visibleDivs.each(function(it) { |
---|
| 19 | params += it.identify(); |
---|
| 20 | params += "," |
---|
| 21 | }); |
---|
| 22 | |
---|
| 23 | // Remove the trailing comma. |
---|
| 24 | params = params.slice(0,params.length-1); |
---|
| 25 | |
---|
| 26 | // Post the id's of all visible divs. |
---|
| 27 | // asynchronous: false is against the prototype recommendations but appears to be needed in this case. |
---|
| 28 | new Ajax.Request(saveUrl, {parameters: params, asynchronous: false}); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | function toggleBranch(divId, imageId, openImgUrl, closedImgUrl) { |
---|
| 32 | |
---|
| 33 | $(divId).toggle(); |
---|
| 34 | |
---|
| 35 | if( $(divId).visible() ) { |
---|
| 36 | $(imageId).src= openImgUrl; |
---|
| 37 | } |
---|
| 38 | else { |
---|
| 39 | $(imageId).src= closedImgUrl; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | } |
---|