Monotone-Parent: 88aa0604fa28680daef426d3364f7f10665edb11

Monotone-Revision: 917c16cbc72247a3b9d3bc68547572f93349255c

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2007-12-13T21:07:09
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle committed 2007-12-13 21:07:09 +00:00
1 parent 6b5da3c2ea
commit 438e9bb635
6 files changed
+138 -6

No files matched your search

+25 -2
View File
@@ -29,8 +29,31 @@ var MailerUIdTreeExtension = {
this._addFolder(thisCounter, folder.children[i]);
},
addMailAccount: function (mailAccount) {
this._addFolder(0, mailAccount);
}
this._addFolder(0, mailAccount);
},
setCookie: function(cookieName, cookieValue, expires, path, domain, secure) {
},
getCookie: function(cookieName) {
return ("");
},
updateCookie: function () {
if (Mailer.foldersStateTimer)
clearTimeout(Mailer.foldersStateTimer);
Mailer.foldersStateTimer = setTimeout('saveFoldersState()', 3000); // 3 seconds
},
getFoldersState: function () {
var expandedFolders = new Array();
for (var n = 0; n < this.aNodes.length; n++) {
if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
expandedFolders.push(this.aNodes[n].dataname);
}
}
return expandedFolders.toJSON();
},
autoSync: function() {
this.config.useCookies = true;
}
};
Object.extend(dTree.prototype, MailerUIdTreeExtension);
+43 -2
View File
@@ -14,7 +14,8 @@ var Mailer = {
currentMailboxType: "",
currentMessages: {},
maxCachedMessages: 20,
cachedMessages: new Array()
cachedMessages: new Array(),
foldersStateTimer: false
};
var usersRightsWindowHeight = 320;
@@ -1254,7 +1255,7 @@ function initMailer(event) {
initMailboxTree();
initMessageCheckTimer();
}
// Default sort options
sorting["attribute"] = "date";
sorting["ascending"] = false;
@@ -1434,6 +1435,7 @@ function onLoadMailboxesCallback(http) {
updateMailboxTreeInPage();
updateMailboxMenus();
checkAjaxRequestsState();
getFoldersState();
}
}
}
@@ -1482,6 +1484,45 @@ function buildMailboxes(accountName, encoded) {
return account;
}
function getFoldersState() {
if (mailAccounts.length > 0) {
var urlstr = ApplicationBaseURL + "foldersState";
triggerAjaxRequest(urlstr, getFoldersStateCallback);
}
}
function getFoldersStateCallback(http) {
if (http.readyState == 4
&& http.status == 200) {
if (http.responseText.length > 0) {
// The response text is a JSOn representation
// of the folders that were left opened.
var data = http.responseText.evalJSON(true);
for (var i = 1; i < mailboxTree.aNodes.length; i++) {
if ($(data).indexOf(mailboxTree.aNodes[i].dataname) > 0)
// If the folder is found, open it
mailboxTree.o(i);
}
}
}
mailboxTree.autoSync();
}
function saveFoldersState() {
if (mailAccounts.length > 0) {
var foldersState = mailboxTree.getFoldersState();
var urlstr = ApplicationBaseURL + "saveFoldersState" + "?expandedFolders=" + foldersState;
triggerAjaxRequest(urlstr, saveFoldersStateCallback);
}
}
function saveFoldersStateCallback(http) {
if (http.readyState == 4
&& isHttpStatus204(http.status)) {
log ("folders state saved");
}
}
function onMenuCreateFolder(event) {
var name = window.prompt(labels["Name :"], "");
if (name && name.length > 0) {