diff --git a/UI/WebServerResources/UIxContactsUserFolders.js b/UI/WebServerResources/UIxContactsUserFolders.js index ded19b9fb..194014695 100644 --- a/UI/WebServerResources/UIxContactsUserFolders.js +++ b/UI/WebServerResources/UIxContactsUserFolders.js @@ -1,4 +1,6 @@ -/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */ +/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ + +var d; function onSearchFormSubmit() { var searchValue = $("searchValue"); @@ -44,7 +46,7 @@ function addUserLineToTree(tree, parent, line) { } } -function buildUsersTree(treeDiv, response) { +function buildUsersTree(treeDiv, response) { d = new dTree("d"); d.config.folderLlinks = true; d.config.hideRoot = true; @@ -132,10 +134,10 @@ function foldersSearchCallback(http) { var dd = $("dd" + nodeId); if (response.length) { - var str = ''; var folders = response.split(";"); var user = http.callbackData["user"]; + var str = ''; for (var i = 1; i < folders.length - 1; i++) str += addFolderBranchToTree (d, user, folders[i], nodeId, i, false); str += addFolderBranchToTree (d, user, folders[folders.length-1], nodeId, @@ -218,10 +220,12 @@ function onConfirmFolderSelection(event) { function onFolderSearchKeyDown(event) { var div = $("folders"); - if (!div.clean - && (event.keyCode == 8 - || event.keyCode >31)) { - div.update(); + if (!div.clean && (event.keyCode == 8 || event.keyCode >31)) { + var oldD = $("d"); + if (oldD) { + oldD.remove(); + delete d; + } div.clean = true; $("addButton").disabled = true; } diff --git a/UI/WebServerResources/dtree.js b/UI/WebServerResources/dtree.js index 856069738..5ad0d944e 100644 --- a/UI/WebServerResources/dtree.js +++ b/UI/WebServerResources/dtree.js @@ -9,6 +9,13 @@ | Updated: 17.04.2003 | |--------------------------------------------------*/ +function dTreeQuote(str) { + return (str + .replace(/\\/g, "\\\\") + .replace(/\"/g, """) + .replace(/\'/g, "'")); +} + // Node object function Node(id, pid, name, isParent, url, dataname, datatype, title, target, icon, iconOpen, open, hasUnseen) { @@ -34,44 +41,52 @@ function Node(id, pid, name, isParent, url, dataname, datatype, title, target, // Tree object function dTree(objName) { - this.obj = objName; - - return this; + this.obj = objName; + this.config = { + target: null, + hideRoot: false, + folderLinks: true, + useSelection: true, + useCookies: false, + useLines: true, + useIcons: true, + useStatusText: false, + closeSameLevel: false, + inOrder: false + }; + this.icon = { + root: 'img/base.gif', + folder: 'img/folder.gif', + folderOpen: 'img/folderopen.gif', + node: 'img/page.gif', + empty: 'img/empty.gif', + line: 'img/line.gif', + join: 'img/join.gif', + joinBottom: 'img/joinbottom.gif', + plus: 'img/plus.gif', + plusBottom: 'img/plusbottom.gif', + minus: 'img/minus.gif', + minusBottom: 'img/minusbottom.gif', + nlPlus: 'img/nolines_plus.gif', + nlMinus: 'img/nolines_minus.gif' + }; + this.aNodes = []; + this.aIndent = []; + this.root = new Node(-1); + this.selectedNode = null; + this.selectedFound = false; + this.completed = false; + + return this; }; dTree.prototype = { obj: null, - config: { - target: null, - hideRoot: false, - folderLinks: true, - useSelection: true, - useCookies: false, - useLines: true, - useIcons: true, - useStatusText: false, - closeSameLevel: false, - inOrder: false - }, - icon: { - root: 'img/base.gif', - folder: 'img/folder.gif', - folderOpen: 'img/folderopen.gif', - node: 'img/page.gif', - empty: 'img/empty.gif', - line: 'img/line.gif', - join: 'img/join.gif', - joinBottom: 'img/joinbottom.gif', - plus: 'img/plus.gif', - plusBottom: 'img/plusbottom.gif', - minus: 'img/minus.gif', - minusBottom: 'img/minusbottom.gif', - nlPlus: 'img/nolines_plus.gif', - nlMinus: 'img/nolines_minus.gif' - }, - aNodes: [], - aIndent: [], - root: new Node(-1), + config: null, + icon: null, + aNodes: null, + aIndent: null, + root: null, selectedNode: null, selectedFound: false, completed: false, @@ -94,6 +109,7 @@ dTree.prototype = { // Outputs the tree to the page toString: function() { + log("toString invoked"); var str = '
\n'; if (document.getElementById) { if (this.config.useCookies) @@ -105,6 +121,10 @@ dTree.prototype = { this.completed = true; return str; }, + valueOf: function() { + log("valueOf invoked"); + return this.toString(); + }, // Creates the tree structure addNode: function(pNode) { @@ -139,14 +159,14 @@ dTree.prototype = { this.aNodes[nodeId] = node; if (this.root.id != node.pid || !this.config.hideRoot) { str += '
'; (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);