See ChangeLog

Monotone-Parent: 73de56ded7f5b5ba79857c706ecef4d70ac3113b
Monotone-Revision: 5c6353cb6270d51a457d46a8fe98dadae4f37193

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-07-07T13:58:50
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2011-07-07 13:58:50 +00:00
parent 485e53258f
commit 34f2904f0d
9 changed files with 106 additions and 42 deletions
+16 -10
View File
@@ -315,8 +315,8 @@ function mailListToggleMessagesFlagged(row) {
}
}
if (selectedRowsId.length > 0) {
var firstTd = row.childElements().first();
var img = firstTd.childElements().first();
var td = row.down("td.messageFlagColumn");
var img = td.childElements().first();
var action = "markMessageFlagged";
var flagged = true;
@@ -476,15 +476,16 @@ function deleteSelectedMessages(sender) {
var nextUid = nextRow.id.substr(4);
var nextIndex = Mailer.dataTable.dataSource.indexOf(nextUid);
Mailer.dataTable.dataSource.uids[nextIndex][2] = 1; // mark it as "first"
Mailer.dataTable.invalidate(nextUid, true);
Mailer.dataTable.dataSource.invalidate(nextUid); // next refresh will reload headers for row
}
if (nextRow.id.startsWith('row_')) {
Mailer.currentMessages[Mailer.currentMailbox] = nextRow.id.substr(4);
nextRow.selectElement();
if (loadMessage(Mailer.currentMessages[Mailer.currentMailbox]) && !refreshFolder)
if (loadMessage(Mailer.currentMessages[Mailer.currentMailbox]) && !refreshFolder) {
// Seen state has changed
Mailer.dataTable.invalidate(Mailer.currentMessages[Mailer.currentMailbox], true);
Mailer.dataTable.dataSource.invalidate(Mailer.currentMessages[Mailer.currentMailbox]);
refreshFolder = true;
}
}
}
else {
@@ -496,7 +497,8 @@ function deleteSelectedMessages(sender) {
lastClickedRow = nextRow.rowIndex;
lastClickedRowId = nextRow.id;
}
deleteCachedMailboxByType("trash");
if (Mailer.currentMailboxType != "trash")
deleteCachedMailboxByType("trash");
}
else {
Mailer.dataTable.remove(uid);
@@ -522,8 +524,11 @@ function deleteSelectedMessages(sender) {
}
function deleteSelectedMessagesCallback(http) {
if (isHttpStatus204(http.status)) {
if (http.status == 200) {
var data = http.callbackData;
var rdata = http.responseText.evalJSON(true);
if (rdata.quotas && data["mailbox"].startsWith('/0/'))
updateQuotas(rdata.quotas);
if (data["refreshUnseenCount"])
// TODO : the unseen count should be returned when calling the batchDelete remote action,
// in order to avoid this extra AJAX call.
@@ -539,7 +544,8 @@ function deleteSelectedMessagesCallback(http) {
}
else {
var html = new Element('div').update(http.responseText);
log ("Messages deletion failed (" + http.status + ") : " + html.down('p').innerHTML);
log ("Messages deletion failed (" + http.status + ") : ");
log (html.down('p').innerHTML);
showAlertDialog(_("Operation failed"));
refreshCurrentFolder();
}
@@ -1637,7 +1643,7 @@ function loadMessageCallback(http) {
// Warning: If the user can't set the read/unread flag, it won't
// be reflected in the view unless we force the refresh.
if (http.callbackData.seenStateHasChanged)
Mailer.dataTable.invalidate(msguid, true);
Mailer.dataTable.dataSource.invalidate(msguid);
}
var cachedMessage = new Array();
cachedMessage['idx'] = Mailer.currentMailbox + '/' + msguid;
@@ -2068,7 +2074,7 @@ function updateQuotas(quotas) {
if (quotas)
Mailer.quotas = quotas;
if (Mailer.quotas && parseInt(Mailer.quotas.maxQuota) > 0) {
log ("updating quotas");
log ("updating quotas " + Mailer.quotas.usedSpace + "/" + Mailer.quotas.maxQuota);
var treeContent = $("folderTreeContent");
var tree = $("mailboxTree");
var quotaDiv = $("quotaIndicator");
+1
View File
@@ -292,6 +292,7 @@ var SOGoDataTableInterface = {
invalidate: function(uid, withoutRefresh) {
// Refetch the data for uid. Only refresh the data table if
// necessary.
// log ("DataTable.invalidate(" + uid + ", with" + (withoutRefresh?"out":"") + " refresh)");
var index = this.dataSource.invalidate(uid);
this.currentRenderID = index + "-" + 1;
this.dataSource.getData(this.currentRenderID,
+12 -7
View File
@@ -35,6 +35,7 @@ SOGoMailDataSource = Class.create({
},
remove: function(uid) {
// log ("MailDataSource.remove(" + uid + ")");
var index = this.invalidate(uid);
if (index >= 0) {
this.uids.splice(index, 1);
@@ -43,7 +44,7 @@ SOGoMailDataSource = Class.create({
return index;
},
init: function(uids, threaded, headers) {
init: function(uids, threaded, headers, quotas) {
this.uids = uids;
if (typeof threaded != "undefined") {
this.threaded = threaded;
@@ -52,6 +53,9 @@ SOGoMailDataSource = Class.create({
}
// log ("MailDataSource.init() " + this.uids.length + " uids loaded");
if (quotas && Object.isFunction(updateQuotas))
updateQuotas(quotas);
if (headers) {
var keys = headers[0];
for (var i = 1; i < headers.length; i++) {
@@ -89,7 +93,7 @@ SOGoMailDataSource = Class.create({
if (http.responseText.length > 0) {
var data = http.responseText.evalJSON(true);
if (data.uids)
this.init(data.uids, data.threaded, data.headers);
this.init(data.uids, data.threaded, data.headers, data.quotas);
else
this.init(data);
if (this.delayedGetData) {
@@ -146,7 +150,8 @@ SOGoMailDataSource = Class.create({
for (i = 0, j = start; j < end; j++) {
var uid = this.threaded? this.uids[j][0] : this.uids[j];
if (!this.cache.get(uid)) {
missingUids[i] = uid;
// log ("MailDataSource._getData missing headers of uid " + uid + " at index " + j + (this.threaded? " (":" (non-") + "threaded)");
missingUids[i] = uid;
i++;
}
}
@@ -168,9 +173,9 @@ SOGoMailDataSource = Class.create({
if (this.ajaxGetData) {
this.ajaxGetData.aborted = true;
this.ajaxGetData.abort();
// log ("MailDataSource._getData() aborted previous AJAX request");
// log ("MailDataSource._getRemoteData() aborted previous AJAX request");
}
// log ("MailDataSource._getData() fetching headers of " + urlParams);
// log ("MailDataSource._getRemoteData() fetching headers of " + urlParams);
this.ajaxGetData = triggerAjaxRequest(this.url + "/headers",
this._getRemoteDataCallback.bind(this),
callbackData,
@@ -191,7 +196,7 @@ SOGoMailDataSource = Class.create({
header[keys[j]] = headers[i][j];
this.cache.set(header["uid"], header);
}
if (data["callbackFunction"])
this._returnData(data["callbackFunction"], data["id"], data["start"], data["end"]);
}
@@ -211,7 +216,7 @@ SOGoMailDataSource = Class.create({
// Add thread-related data
if (parseInt(this.uids[i][2]) > 0)
data[j]['Thread'] = '&nbsp;'; //'<img class="messageThread" src="' + ResourcesURL + '/arrow-down.png">';
else
else if (data[j]['Thread'])
delete data[j]['Thread'];
if (parseInt(this.uids[i][1]) > -1)
data[j]['ThreadLevel'] = this.uids[i][1];