From 4f5ea3032f0b06ebee63660e666221e0725b5591 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 28 Jul 2006 22:53:57 +0000 Subject: [PATCH] Monotone-Parent: 0be05214b6127ef5b9046d2414f73de51adfca6d Monotone-Revision: 98bec4f36dc30eb4c106922ee20a47dcfbc01e20 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-07-28T22:53:57 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 + UI/WebServerResources/dtree.css | 51 +++++ UI/WebServerResources/dtree.js | 371 ++++++++++++++++++++++++++++++++ 3 files changed, 429 insertions(+) create mode 100644 UI/WebServerResources/dtree.css create mode 100644 UI/WebServerResources/dtree.js diff --git a/ChangeLog b/ChangeLog index 7524cf4b3..c1d015bec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-28 Wolfgang Sourdeau + + * UI/WebServerResources/dtree.{css,js}: new files to handle + javascript-generated mailbox tree. Modified from original version + by integrating the previous code with the one we are using for + selections and mailbox handling. Minor visual enhancements too... + 2006-07-25 Wolfgang Sourdeau * SoObjects/Mailer/SOGoUser+Mail.m: if only one identity is to be diff --git a/UI/WebServerResources/dtree.css b/UI/WebServerResources/dtree.css new file mode 100644 index 000000000..1a53c5803 --- /dev/null +++ b/UI/WebServerResources/dtree.css @@ -0,0 +1,51 @@ +/*--------------------------------------------------| +| dTree 2.05 | www.destroydrop.com/javascript/tree/ | +|---------------------------------------------------| +| Copyright (c) 2002-2003 Geir Landrö | +|--------------------------------------------------*/ + +.dtree +{ + color: #000; + white-space: nowrap; +} + +.dtree img +{ + vertical-align: middle; + border: 0px; + padding: 0px; + margin: 0px; +} + +.dtree a +{ + cursor: default; + color: #000; + text-decoration: none; +} + +.dtree a.node, .dtree a.nodeSel +{ + white-space: nowrap; + padding: 1px 2px; +} + +.dtree a.node:hover, .dtree a.nodeSel:hover +{ + text-decoration: none; +} + +.dtree a.nodeSel +{ + color: #fff; + background-color: #4b6983; +} + +.dtree .clip +{ + overflow: hidden; +} + +DIV.dTreeNode +{ height: 18px; } diff --git a/UI/WebServerResources/dtree.js b/UI/WebServerResources/dtree.js new file mode 100644 index 000000000..a642eedc6 --- /dev/null +++ b/UI/WebServerResources/dtree.js @@ -0,0 +1,371 @@ +/*--------------------------------------------------| + | 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, url, onclick, dataname, datatype, title, target, + icon, iconOpen, open) { + this.id = id; + this.pid = pid; + this.name = name; + this.url = url; + this.onclick = onclick; + this.title = title; + this.target = target; + this.icon = icon; + this.iconOpen = iconOpen; + this.dataname = dataname; + this.datatype = datatype; + this._io = open || false; + this._is = false; + this._ls = false; + this._hc = false; + this._ai = 0; + this._p; +}; + +// Tree object +function dTree(objName) { + this.config = { + target : null, + hideRoot : false, + folderLinks : true, + useSelection : true, + useCookies : true, + 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.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, onclick, datatype, + title, target, icon, iconOpen, open) { + this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, onclick, + datatype, 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 = '
\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 +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