mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-28 20:56:24 +00:00
Monotone-Parent: b8d56bd5a31be825cfe66b8fe9f9a15269a09fbc
Monotone-Revision: c22c8fd82f5da327a3d3e8441ba41c1e18f66b7d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-12T23:39:02 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 = '<div class="dtree" id="' + this.obj + '">\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 += '<div class="dTreeNode"';
|
||||
if (node.datatype) str += ' datatype="' + node.datatype + '"';
|
||||
if (node.dataname) str += ' dataname="' + node.dataname + '"';
|
||||
if (node.datatype) str += ' datatype="' + dTreeQuote(node.datatype) + '"';
|
||||
if (node.dataname) str += ' dataname="' + dTreeQuote(node.dataname) + '"';
|
||||
str += '>' + this.indent(node, nodeId);
|
||||
if (node.url) {
|
||||
str += '<a id="s' + this.obj + nodeId + '" class="node" href="' + node.url + '"';
|
||||
if (node.title) str += ' title="' + node.title + '"';
|
||||
if (node.target) str += ' target="' + node.target + '"';
|
||||
if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
|
||||
str += '<a id="s' + this.obj + nodeId + '" class="node" href="' + dTreeQuote(node.url) + '"';
|
||||
if (node.title) str += ' title="' + dTreeQuote(node.title) + '"';
|
||||
if (node.target) str += ' target="' + dTreeQuote(node.target) + '"';
|
||||
if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + dTreeQuote(node.name) + '\';return true;" onmouseout="window.status=\'\';return true;" ';
|
||||
if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
|
||||
str += ' onclick="' + this.obj + '.s(' + nodeId + ');"';
|
||||
str += '>';
|
||||
@@ -177,6 +197,7 @@ dTree.prototype = {
|
||||
str += '</div>';
|
||||
}
|
||||
this.aIndent.pop();
|
||||
|
||||
return str;
|
||||
},
|
||||
|
||||
@@ -185,6 +206,7 @@ dTree.prototype = {
|
||||
var str = '';
|
||||
if (this.root.id != node.pid)
|
||||
{
|
||||
|
||||
for (var n=0; n<this.aIndent.length; n++)
|
||||
str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
|
||||
(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
|
||||
|
||||
Reference in New Issue
Block a user