diff --git a/UI/WebServerResources/dtree.js b/UI/WebServerResources/dtree.js index b2eedb938..57dbed7c1 100644 --- a/UI/WebServerResources/dtree.js +++ b/UI/WebServerResources/dtree.js @@ -73,294 +73,295 @@ function dTree(objName) { return this; }; -// Adds a new node to the node array -dTree.prototype.add = function(id, pid, name, isParent, url, datatype, - title, target, icon, iconOpen, open, hasUnseen) { - this.aNodes[this.aNodes.length] = new Node(id, pid, name, isParent, url, - datatype, title, target, icon, - iconOpen, open, false, hasUnseen); -}; +dTree.prototype = { + // Adds a new node to the node array + add: function(id, pid, name, isParent, url, datatype, + title, target, icon, iconOpen, open, hasUnseen) { + this.aNodes[this.aNodes.length] = new Node(id, pid, name, isParent, url, + datatype, title, target, icon, + iconOpen, open, false, hasUnseen); + }, -// Open/close all nodes -dTree.prototype.openAll = function() { - this.oAll(true); -}; -dTree.prototype.closeAll = function() { - this.oAll(false); -}; + // Open/close all nodes + openAll: function() { + this.oAll(true); + }, + closeAll: function() { + this.oAll(false); + }, -// Outputs the tree to the page -dTree.prototype.toString = function() { - var str = '
\n'; - if (document.getElementById) { - if (this.config.useCookies) - this.selectedNode = this.getSelected(); - str += this.addNode(this.root); - } else str += 'Browser not supported.'; - str += '
'; - if (!this.selectedFound) this.selectedNode = null; - this.completed = true; - return str; -}; + // Outputs the tree to the page + toString: function() { + var str = '
\n'; + if (document.getElementById) { + if (this.config.useCookies) + this.selectedNode = this.getSelected(); + str += this.addNode(this.root); + } else str += 'Browser not supported.'; + str += '
'; + if (!this.selectedFound) this.selectedNode = null; + this.completed = true; + return str; + }, -// Creates the tree structure -dTree.prototype.addNode = function(pNode) { - var str = ''; - var n=0; - if (this.config.inOrder) n = pNode._ai; - for (n; n'; + if (this.config.useIcons) { + if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node); + if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node; + if (this.root.id == node.pid) { + node.icon = this.icon.root; + node.iconOpen = this.icon.root; + } + str += ''; + } + str += '' + node.name + ''; + 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 + 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 + setCS: function(node) { + var lastId; + for (var n=0; n'; - if (this.config.useIcons) { - if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node); - if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node; - if (this.root.id == node.pid) { - node.icon = this.icon.root; - node.iconOpen = this.icon.root; - } - str += ''; - } - str += '' + node.name + ''; - 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