mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-09 05:25:26 +00:00
Monotone-Parent: e2123af89707f4bc2b9f980dfef0f57731970142
Monotone-Revision: 433aaeac45e4077236372a5e04d1bbb6ff3c569f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-08-06T18:24:39 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
2010-08-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/MailerUI.js: (initMailboxTree): make use
|
||||
of the new class below and drop all code related to keeping track
|
||||
of active requests.
|
||||
|
||||
* UI/WebServerResources/generic.js: (AjaxRequestsChain): new class
|
||||
that implements the chaining of ajax requests.
|
||||
|
||||
|
||||
@@ -1787,11 +1787,34 @@ function initMailboxTree() {
|
||||
|
||||
mailboxTree.add(0, -1, '');
|
||||
|
||||
mailboxTree.pendingRequests = mailAccounts.length;
|
||||
activeAjaxRequests += mailAccounts.length;
|
||||
var chainRq = new AjaxRequestsChain(initMailboxTreeCB);
|
||||
for (var i = 0; i < mailAccounts.length; i++) {
|
||||
var url = ApplicationBaseURL + i + "/mailboxes";
|
||||
triggerAjaxRequest(url, onLoadMailboxesCallback, i);
|
||||
chainRq.requests.push([url, onLoadMailboxesCallback, i]);
|
||||
}
|
||||
chainRq.start();
|
||||
}
|
||||
|
||||
function initMailboxTreeCB() {
|
||||
updateMailboxTreeInPage();
|
||||
updateMailboxMenus();
|
||||
getStatusFolders();
|
||||
checkAjaxRequestsState();
|
||||
getFoldersState();
|
||||
configureDroppables();
|
||||
}
|
||||
|
||||
function onLoadMailboxesCallback(http) {
|
||||
if (http.status == 200) {
|
||||
checkAjaxRequestsState();
|
||||
if (http.responseText.length > 0) {
|
||||
var accountIdx = http.callbackData;
|
||||
var newAccount = buildMailboxes(accountIdx, http.responseText);
|
||||
accounts[accountIdx] = newAccount;
|
||||
mailboxTree.addMailAccount(newAccount);
|
||||
}
|
||||
else
|
||||
log ("onLoadMailboxesCallback " + http.status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1945,30 +1968,6 @@ function updateMailboxMenus() {
|
||||
}
|
||||
}
|
||||
|
||||
function onLoadMailboxesCallback(http) {
|
||||
if (http.status == 200) {
|
||||
checkAjaxRequestsState();
|
||||
if (http.responseText.length > 0) {
|
||||
var accountIdx = parseInt(http.callbackData);
|
||||
var newAccount = buildMailboxes(accountIdx, http.responseText);
|
||||
accounts[accountIdx] = newAccount;
|
||||
mailboxTree.addMailAccount(newAccount);
|
||||
mailboxTree.pendingRequests--;
|
||||
activeAjaxRequests--;
|
||||
if (!mailboxTree.pendingRequests) {
|
||||
updateMailboxTreeInPage();
|
||||
updateMailboxMenus();
|
||||
getStatusFolders();
|
||||
checkAjaxRequestsState();
|
||||
getFoldersState();
|
||||
configureDroppables();
|
||||
}
|
||||
}
|
||||
else
|
||||
log ("onLoadMailboxesCallback " + http.status);
|
||||
}
|
||||
}
|
||||
|
||||
function buildMailboxes(accountIdx, encoded) {
|
||||
var account = new Mailbox("account", "" + accountIdx,
|
||||
undefined, //necessary, null will cause issues
|
||||
|
||||
Reference in New Issue
Block a user