mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-02 23:34:21 +00:00
See Changelog
Monotone-Parent: bb6767d882b80a6dcb30d6487153b189ee367d0d Monotone-Revision: 58cf6fbba1f009a9bedc373454f61ed082ccfae0 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2010-11-05T21:32:00 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
2010-11-05 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* UI/MailerUI/UIxMailListActions.m (-getSortedUIDsAction): now
|
||||
accepts the form parameter "no_headers" so only the UIDs are
|
||||
returned, without the prefetched headers.
|
||||
|
||||
* UI/WebServerResources/SOGoMailDataSource.js (init): made the
|
||||
headers argument optional.
|
||||
(_loadCallback): handled the case when the server doesn't send the
|
||||
prefetched headers.
|
||||
|
||||
* UI/WebServerResources/SOGoDataTable.js (_refresh): new method to
|
||||
force the refresh of the data table with the data of the data source.
|
||||
(remove): don't update the internal variables (index and count) if
|
||||
the UID was not found in the data source.
|
||||
|
||||
* UI/WebServerResources/MailerUI.js (openMailbox): when reloading
|
||||
a mailbox, only fetch the messages UIDs (without the headers).
|
||||
(loadMessageCallback): only reload the headers if the seen state
|
||||
has changed.
|
||||
|
||||
2010-11-04 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
SoObjects/SOGo/SOGoMailer.m
|
||||
|
||||
@@ -558,17 +558,25 @@
|
||||
|
||||
- (id <WOActionResults>) getSortedUIDsAction
|
||||
{
|
||||
NSDictionary *data;
|
||||
id data;
|
||||
NSString *noHeaders;
|
||||
SOGoMailFolder *folder;
|
||||
WORequest *request;
|
||||
WOResponse *response;
|
||||
|
||||
request = [context request];
|
||||
response = [context response];
|
||||
folder = [self clientObject];
|
||||
data = [self getUIDsAndHeadersInFolder: folder];
|
||||
[response setHeader: @"text/plain; charset=utf-8"
|
||||
forKey: @"content-type"];
|
||||
folder = [self clientObject];
|
||||
noHeaders = [request formValueForKey: @"no_headers"];
|
||||
if ([noHeaders length])
|
||||
data = [self getSortedUIDsInFolder: folder];
|
||||
else
|
||||
data = [self getUIDsAndHeadersInFolder: folder];
|
||||
|
||||
[response appendContentString: [data jsonRepresentation]];
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,7 @@ var SOGoDataTableInterface = {
|
||||
count = end - start;
|
||||
|
||||
this.currentRenderID = index + "-" + count;
|
||||
|
||||
// Query the data source only if at least one row is not loaded
|
||||
if (refresh === true ||
|
||||
this.renderedIndex < 0 ||
|
||||
@@ -168,12 +169,16 @@ var SOGoDataTableInterface = {
|
||||
this.dataSource.getData(this.currentRenderID,
|
||||
index,
|
||||
count,
|
||||
this._render.bind(this),
|
||||
(refresh === true)?this._refresh.bind(this):this._render.bind(this),
|
||||
this.renderDelay);
|
||||
}
|
||||
},
|
||||
|
||||
_render: function(renderID, start, max, data) {
|
||||
_refresh: function(renderID, start, max, data) {
|
||||
this._render(renderID, start, max, data, true);
|
||||
},
|
||||
|
||||
_render: function(renderID, start, max, data, refresh) {
|
||||
if (this.currentRenderID != renderID) {
|
||||
// log ("DataTable._render() ignore render for " + renderID + " (current is " + this.currentRenderID + ")");
|
||||
return;
|
||||
@@ -201,17 +206,16 @@ var SOGoDataTableInterface = {
|
||||
this.renderedCount = 0;
|
||||
}
|
||||
|
||||
if (start > (this.renderedIndex + this.renderedCount) ||
|
||||
if (refresh === true ||
|
||||
start > (this.renderedIndex + this.renderedCount) ||
|
||||
start + data.length < this.renderedIndex) {
|
||||
// No reusable row in the viewport;
|
||||
// refresh the complete view port
|
||||
|
||||
for (i = 0, j = start;
|
||||
i < this.renderedCount && i < data.length;
|
||||
i++, j++) {
|
||||
// Render all existing rows with new data
|
||||
var row = rows[i+1]; // must skip the first row (this.rowTop)
|
||||
row.removeClassName('_selected');
|
||||
this.rowRenderCallback(row, data[i], false);
|
||||
}
|
||||
|
||||
@@ -314,11 +318,12 @@ var SOGoDataTableInterface = {
|
||||
}
|
||||
var index = this.dataSource.remove(uid);
|
||||
// log ("DataTable.remove(" + uid + ") at index " + index);
|
||||
if (this.renderedIndex > index)
|
||||
this.renderedIndex--;
|
||||
else if ((this.renderedIndex + this.renderedCount) > index)
|
||||
this.renderedCount--;
|
||||
|
||||
if (index >= 0) {
|
||||
if (this.renderedIndex > index)
|
||||
this.renderedIndex--;
|
||||
else if ((this.renderedIndex + this.renderedCount) > index)
|
||||
this.renderedCount--;
|
||||
}
|
||||
return index;
|
||||
},
|
||||
|
||||
|
||||
@@ -45,12 +45,14 @@ SOGoMailDataSource = Class.create({
|
||||
init: function(uids, headers) {
|
||||
this.uids = uids;
|
||||
|
||||
var keys = headers[0];
|
||||
for (var i = 1; i < headers.length; i++) {
|
||||
var header = [];
|
||||
for (var j = 0; j < keys.length; j++)
|
||||
header[keys[j]] = headers[i][j];
|
||||
this.cache.set(header["uid"], header);
|
||||
if (headers) {
|
||||
var keys = headers[0];
|
||||
for (var i = 1; i < headers.length; i++) {
|
||||
var header = [];
|
||||
for (var j = 0; j < keys.length; j++)
|
||||
header[keys[j]] = headers[i][j];
|
||||
this.cache.set(header["uid"], header);
|
||||
}
|
||||
}
|
||||
|
||||
this.loaded = true;
|
||||
@@ -78,7 +80,10 @@ SOGoMailDataSource = Class.create({
|
||||
if (http.status == 200) {
|
||||
if (http.responseText.length > 0) {
|
||||
var data = http.responseText.evalJSON(true);
|
||||
this.init(data.uids, data.headers);
|
||||
if (data.uids)
|
||||
this.init(data.uids, data.headers);
|
||||
else
|
||||
this.init(data);
|
||||
this.loaded = true;
|
||||
if (this.delayedGetData) {
|
||||
this.delayedGetData();
|
||||
|
||||
Reference in New Issue
Block a user