/*--------------------------------------------------| | dTree 2.05 | www.destroydrop.com/javascript/tree/ | |---------------------------------------------------| | Copyright (c) 2002-2003 Geir Landrц | | | | This script can be used freely as long as all | | copyright messages are intact. | | | | Updated: 17.04.2003 | |--------------------------------------------------*/ // Node object function Node(id, pid, name, url, title, target, icon, iconOpen, open) { this.id = id; this.pid = pid; this.name = name; this.url = url; this.title = title; this.target = target; this.icon = icon; this.iconOpen = iconOpen; this._io = open || false; this._is = false; this._ls = false; this._hc = false; this._ai = 0; this._p; }; // Tree object function dTree(objName) { this.config = { target : null, folderLinks : true, useSelection : true, useCookies : true, useLines : true, useIcons : true, useStatusText : false, closeSameLevel : false, inOrder : false }; this.path = '/images/dtree/'; this.icon = { root : this.path+'img/base.gif', folder : this.path+'img/folder.gif', folderOpen : this.path+'img/folderopen.gif', node : this.path+'img/page.gif', empty : this.path+'img/empty.gif', line : this.path+'img/line.gif', join : this.path+'img/join.gif', joinBottom : this.path+'img/joinbottom.gif', plus : this.path+'img/plus.gif', plusBottom : this.path+'img/plusbottom.gif', minus : this.path+'img/minus.gif', minusBottom : this.path+'img/minusbottom.gif', nlPlus : this.path+'img/nolines_plus.gif', nlMinus : this.path+'img/nolines_minus.gif' }; this.obj = objName; this.aNodes = []; this.aIndent = []; this.root = new Node(-1); this.selectedNode = null; this.selectedFound = false; this.completed = false; }; dTree.prototype.setConfig = function( cfgObj ) { if( typeof ( cfgObj.folderLinks ) != 'undefined' ) this.config.folderLinks = cfgObj.folderLinks; if( typeof ( cfgObj.target ) != 'undefined' ) this.config.target = cfgObj.target; if( typeof ( cfgObj.useSelection ) != 'undefined' ) this.config.useSelection = cfgObj.useSelection; if( typeof ( cfgObj.useCookies ) != 'undefined' ) this.config.useCookies = cfgObj.useCookies; if( typeof ( cfgObj.useLines ) != 'undefined' ) this.config.useLines = cfgObj.useLines; if( typeof ( cfgObj.useIcons ) != 'undefined' ) this.config.useIcons = cfgObj.useIcons; if( typeof ( cfgObj.useStatusText ) != 'undefined' ) this.config.useStatusText = cfgObj.useStatusText; if( typeof ( cfgObj.closeSameLevel ) != 'undefined' ) this.config.closeSameLevel = cfgObj.closeSameLevel; if( typeof ( cfgObj.inOrder ) != 'undefined' ) this.config.inOrder = cfgObj.inOrder; //alert( 'Hi from setConfig ' + typeof ( cfgObj.folderLinks ) ); } // Adds a new node to the node array dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); }; // Open/close all nodes dTree.prototype.openAll = function() { this.oAll(true); }; dTree.prototype.closeAll = function() { this.oAll(false); }; // Outputs the tree to the page dTree.prototype.toString = function() { var str = '