/*--------------------------------------------------| | 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, dispName, url, title, target, icon, iconOpen, open) { this.id = id; this.pid = pid; this.name = name; this.dispName = dispName; 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,dn) { this.config = { target : null, folderLinks : true, useSelection : true, useCookies : true, useLines : true, useIcons : true, useStatusText : false, closeSameLevel : false, inOrder : false } this.icon = { root : '/serviceweb/web31/dbsource/dtree/202.gif', folder : '/serviceweb/web31/dbsource/dtree/208.gif', folderOpen : '/serviceweb/web31/dbsource/dtree/209.gif', node : '/serviceweb/web31/dbsource/dtree/220.gif', empty : '/serviceweb/web31/dbsource/dtree/206.gif', line : '/serviceweb/web31/dbsource/dtree/214.gif', join : '/serviceweb/web31/dbsource/dtree/212.gif', joinBottom : '/serviceweb/web31/dbsource/dtree/213.gif', plus : '/serviceweb/web31/dbsource/dtree/221.gif', plusBottom : '/serviceweb/web31/dbsource/dtree/222.gif', minus : '/serviceweb/web31/dbsource/dtree/215.gif', minusBottom : '/serviceweb/web31/dbsource/dtree/216.gif', nlPlus : '/serviceweb/web31/dbsource/dtree/219.gif', nlMinus : '/serviceweb/web31/dbsource/dtree/218.gif' }; this.obj = objName; this.aNodes = []; this.aIndent = []; this.root = new Node(-1); this.selectedNode = null; this.selectedFound = false; this.completed = false; this.curPathList = new Array(); }; // Adds a new node to the node array dTree.prototype.add = function(id, pid, name, dispName, url, title, target, icon, iconOpen, open) { this.aNodes[this.aNodes.length] = new Node(id, pid, name, dispName, url, title, target, icon, iconOpen, open); }; // Open/close all nodes dTree.prototype.openAll = function() { this.oAll(true); }; dTree.prototype.closeAll = function() { this.oAll(false); }; //���curPath�ҵ�Ҫ�򿪵Ľڵ�id���б�curPathList dTree.prototype.parserPath = function(curPath) { this.curPathList = new Array(); var nameList = curPath.split("|"); var len = nameList.length; while (len>1 && nameList[len-1]=="") len--; var fatherId = -1; for (var i=0; i '�ָ�Ķ༶����ǰ��'/'��Ķ� while (true){ var n=0; while (n ")!=0 && name.indexOf(this.aNodes[n].name+"/")!=0))){ n++; } if (n'; } if (node.url) { str += ''; str += node.dispName; if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; str += ''; if (node._hc) { str += '
'; str += this.addNode(node); str += '
'; } this.aIndent.pop(); return str; }; // Adds the empty and line icons dTree.prototype.indent = function(node, nodeId) { var str = ''; if (this.root.id != node.pid) { for (var n=0; n'; (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); if (node._hc) { str += ''; } else str += ''; } return str; }; // Checks if a node has any children and if it is the last sibling dTree.prototype.setCS = function(node) { var lastId; for (var n=0; n