/*--------------------------------------------------| | 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 for egw 29-12-03 ndee // 27-01-04 ndee: amended function dtree() with parameter for php based icondir // Node object function Node(id, pid, name, url, urlClick, urlOut, title, target, icon, iconOpen, open) { this.id = id; this.pid = pid; this.name = name; this.url = url; this.urlClick = urlClick; this.urlOut = urlOut; 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,icondir) { iconPath = (icondir !='') ? icondir : '/egroupware/phpgwapi/templates/default/images'; this.icon = { root : iconPath+'/foldertree_base.gif', folder : iconPath+'/foldertree_folder.gif', folderOpen : iconPath+'/foldertree_folderopen.gif', node : iconPath+'/foldertree_folder.gif', empty : iconPath+'/foldertree_empty.gif', line : iconPath+'/foldertree_line.gif', join : iconPath+'/foldertree_join.gif', joinBottom : iconPath+'/foldertree_joinbottom.gif', plus : iconPath+'/foldertree_plus.gif', plusBottom : iconPath+'/foldertree_plusbottom.gif', minus : iconPath+'/foldertree_minus.gif', minusBottom : iconPath+'/foldertree_minusbottom.gif', nlPlus : iconPath+'/foldertree_nolines_plus.gif', nlMinus : iconPath+'/foldertree_nolines_minus.gif' }; this.config = { target : null, folderLinks : true, useSelection : true, useCookies : true, useLines : true, useIcons : true, useStatusText : false, //must be set to false for drag and drop! change-me! closeSameLevel : false, inOrder : false, useJSCode : true } 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, urlClick, urlOut, title, target, icon, iconOpen, open) { this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, urlClick, urlOut, 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 = '