1 var stpicopen = '../../../images/slimtree/folder.gif';
2 var stpicclose = '../../../images/slimtree/folderopen.gif';
3 var stpicblank = '../../../images/slimtree/page.gif';
4 var stpicline = '../../../images/slimtree/line.gif';
5 var stpicjoin = '../../../images/slimtree/join.gif';
6 var stpicjoinb = '../../../images/slimtree/joinbottom.gif';
8 var stimgopen = elem('img',{src:stpicopen,border:0});
9 var stimgclose = elem('img',{src:stpicclose,border:0});
10 var stimgblank = elem('img',{src:stpicblank,border:0});
11 var stimgline = elem('img',{src:stpicline,border:0});
12 var stimgjoin = elem('img',{src:stpicjoin,border:0, style:'display:inline;'});
14 function SlimTree(context) { this.context = context; }
16 SlimTree.prototype.addNode = function( id, pid, name, action ) {
18 var div = elem('div',{id:id});
19 var topdiv = elem('div',{style:'vertical-align:middle'});
20 var link = elem('a', {id:'stlink_' + id});
21 var actionref = elem('a',{href:action}, name);
22 var contdiv = elem('div',{id:'stcont_' + id});
24 topdiv.appendChild(link);
25 topdiv.appendChild(actionref);
26 div.appendChild(topdiv);
27 div.appendChild(contdiv);
31 this.context.appendChild(div);
32 link.appendChild(stimgblank.cloneNode(true));
34 if(pid == this.rootid) stOpen(pid);
36 getId(pid).setAttribute('haschild','1');
37 link.appendChild(stimgblank.cloneNode(true));
38 div.style.paddingLeft = '18px';
39 div.style.backgroundImage = 'url('+stpicjoinb+')';
40 div.style.backgroundRepeat = 'no-repeat';
41 getId('stcont_' + pid).appendChild(div);
42 if (div.previousSibling) {
43 div.previousSibling.firstChild.appendChild(stimgjoin.cloneNode(true));
44 div.previousSibling.firstChild.appendChild(div.previousSibling.firstChild.firstChild);
45 div.previousSibling.firstChild.appendChild(div.previousSibling.firstChild.firstChild);
46 div.previousSibling.firstChild.firstChild.style.marginLeft = '-18px';
48 div.previousSibling.style.backgroundImage = 'url('+stpicline+')';
49 div.previousSibling.style.backgroundRepeat = 'repeat-y';
54 SlimTree.prototype.expandAll = function() { stFlex(this.rootid, 'open'); }
55 SlimTree.prototype.closeAll = function() { stFlex(this.rootid,'close', this.rootid); }
56 function stFlex(id, type, root) {
57 if(type=='open') stOpen(id);
58 else { if (id != root) stClose(id); }
59 var n = getId('stcont_' + id);
60 for( var c = 0; c != n.childNodes.length; c++ ) {
61 var ch = n.childNodes[c];
62 if(ch.nodeName.toLowerCase() == 'div') {
63 if(getId(ch.id).getAttribute('haschild') == '1')
69 function stOpen( id ) {
70 var link = getId('stlink_' + id);
72 link.appendChild(stimgclose.cloneNode(true));
73 link.setAttribute('href','javascript:stClose("'+id+'");');
74 unHideMe(getId('stcont_' + id));
77 function stClose( id ) {
78 var link = getId('stlink_' + id);
80 link.appendChild(stimgopen.cloneNode(true));
81 link.setAttribute('href','javascript:stOpen("'+id+'");');
82 hideMe(getId('stcont_' + id));