/*--------------------------------------------------| | 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 | |--------------------------------------------------*/ //modified by wallimn. 20070831 //to support checkbox object //updated 2009-02-13 //welcome to visit my blog: http://blog.csdn.net/wallimn //please keep these message. // 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;//TRUE all open false all close this._is = false; this._ls = false; this._hc = false; this._ai = 0; this._p; }; // Tree object function dTree(objName,iconPath) { this.config = { target : null, folderLinks : true, useSelection : true, useCookies : true, useLines : true, useIcons : true, useStatusText : false, closeSameLevel : false, inOrder : false, check:false //added by wallimn 2009-02-05, to control whether checkbox is showed }; //modified by wallimn 2009-02-05, in order to make client can modify path of icons; if(!iconPath)iconPath="img/";//set the default value, be compatible with dtree this.icon = { root : iconPath+'base.gif', folder : iconPath+'folder.gif', folderOpen : iconPath+'folderopen.gif', node : iconPath+'page.gif', empty : iconPath+'empty.gif', line : iconPath+'line.gif', join : iconPath+'join.gif', joinBottom : iconPath+'joinbottom.gif', plus : iconPath+'plus.gif', plusBottom : iconPath+'plusbottom.gif', minus : iconPath+'minus.gif', minusBottom : iconPath+'minusbottom.gif', nlPlus : iconPath+'nolines_plus.gif', nlMinus : iconPath+'nolines_minus.gif' }; //added by wallimn, to cache checkbox object and improve speed of set checked status this.cbCollection = new Object(); this.obj = objName; this.aNodes = []; this.aIndent = []; this.root = new Node(-1); this.selectedNode = null; this.selectedFound = false; this.completed = false; }; // 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 = '