source: trunk/web-app/js/assetTree.js @ 312

Last change on this file since 312 was 312, checked in by gav, 14 years ago

Refactor asset tree taglib to populate the asset tree table via an ajax call to AssetTreeService.
Move assetTree javascript to it's own js file and util javascript to a util.js file and service.

File size: 1.2 KB
Line 
1
2function 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
8function 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
31function 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}
Note: See TracBrowser for help on using the repository browser.