mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-23 22:09:29 +00:00
See ChangeLog.
Monotone-Parent: 0de048fc2845b8e712e21700f4604fa0cd9eeea4 Monotone-Revision: 7c436d762d93b096889be8f7c7eede7e227b0efd Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2010-05-28T19:18:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -479,7 +479,6 @@ function onMailboxTreeItemClick(event) {
|
||||
topNode.selectedEntry = this;
|
||||
|
||||
search = {};
|
||||
sorting = {};
|
||||
$("searchValue").value = "";
|
||||
initCriteria();
|
||||
|
||||
@@ -518,6 +517,8 @@ function toggleAddressColumn(search, replace) {
|
||||
if (i >= 0)
|
||||
UserDefaults["SOGoMailListViewColumnsOrder"][i] = replace.capitalize();
|
||||
}
|
||||
if (sorting["attribute"] == search)
|
||||
sorting["attribute"] = replace;
|
||||
}
|
||||
|
||||
function onMailboxMenuMove(event) {
|
||||
@@ -627,7 +628,7 @@ function openMailbox(mailbox, reload, updateStatus) {
|
||||
if (!reload) {
|
||||
var messageContent = $("messageContent");
|
||||
messageContent.update();
|
||||
$("messageCountHeader").down().update();
|
||||
$("messageCountHeader").down().update(' ');
|
||||
lastClickedRow = -1; // from generic.js
|
||||
}
|
||||
|
||||
@@ -695,10 +696,6 @@ function messageListCallback(row, data, isNew) {
|
||||
row.writeAttribute('labels', (data['labels']?data['labels']:""));
|
||||
|
||||
var columnsOrder = UserDefaults["SOGoMailListViewColumnsOrder"];
|
||||
// if (typeof columnsOrder == "undefined") {
|
||||
// columnsOrder = defaultColumnsOrder;
|
||||
// }
|
||||
|
||||
var cells;
|
||||
if (Prototype.Browser.IE)
|
||||
cells = row.childNodes;
|
||||
@@ -1510,6 +1507,7 @@ function onHeaderClick(event) {
|
||||
sorting["attribute"] = newSortAttribute;
|
||||
sorting["ascending"] = true;
|
||||
}
|
||||
|
||||
refreshCurrentFolder();
|
||||
|
||||
Event.stop(event);
|
||||
@@ -1605,9 +1603,16 @@ function openInbox(node) {
|
||||
}
|
||||
|
||||
function initMailer(event) {
|
||||
// Default sort options
|
||||
sorting["attribute"] = "date";
|
||||
sorting["ascending"] = false;
|
||||
// Restore sorting from user settings
|
||||
if (UserSettings["Mail"] && UserSettings["Mail"]["SortingState"]) {
|
||||
sorting["attribute"] = UserSettings["Mail"]["SortingState"][0];
|
||||
sorting["ascending"] = parseInt(UserSettings["Mail"]["SortingState"][1]) > 0;
|
||||
if (sorting["attribute"] == 'to') sorting["attribute"] = 'from'; // initial mailbox is always the inbox
|
||||
}
|
||||
else {
|
||||
sorting["attribute"] = "date";
|
||||
sorting["ascending"] = false;
|
||||
}
|
||||
|
||||
// Define columns order
|
||||
if (typeof UserDefaults["SOGoMailListViewColumnsOrder"] == "undefined") {
|
||||
@@ -1631,7 +1636,10 @@ function initMailer(event) {
|
||||
|
||||
var messageListHeader = $("messageListHeader");
|
||||
messageListHeader.addInterface(SOGoResizableTableInterface);
|
||||
|
||||
if (UserSettings["Mail"] && UserSettings["Mail"]["ColumnsState"]) {
|
||||
messageListHeader.restore($H(UserSettings["Mail"]["ColumnsState"]));
|
||||
}
|
||||
|
||||
configureMessageListEvents($("messageListHeader"), $("messageListBody"));
|
||||
|
||||
initMailboxTree();
|
||||
|
||||
@@ -62,6 +62,7 @@ var SOGoDataTableInterface = {
|
||||
if (this.dataSource) this.dataSource.destroy();
|
||||
this._emptyTable();
|
||||
this.dataSource = new window[dataSourceClass](this, url);
|
||||
this.scrollTop = 0;
|
||||
this.load(params);
|
||||
},
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ SOGoMailDataSource = Class.create({
|
||||
else
|
||||
params = "";
|
||||
|
||||
// log ("MailDataSource.load() " + params);
|
||||
log ("MailDataSource.load() " + params);
|
||||
triggerAjaxRequest(this.url + "/uids",
|
||||
this._loadCallback.bind(this),
|
||||
null,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
var SOGoResizableTableInterface = {
|
||||
|
||||
delayedResize: null,
|
||||
ratios: null,
|
||||
|
||||
bind: function() {
|
||||
var i;
|
||||
@@ -23,17 +24,17 @@ var SOGoResizableTableInterface = {
|
||||
}
|
||||
SOGoResizableTable._resize(this, $(cell), i, null, cell.getWidth());
|
||||
}
|
||||
Event.observe(window, "resize", this.restore.bind(this));
|
||||
Event.observe(window, "resize", this.resize.bind(this));
|
||||
},
|
||||
|
||||
restore: function(e) {
|
||||
resize: function(e) {
|
||||
// Only resize the columns after a certain delay, otherwise it slow
|
||||
// down the interface.
|
||||
if (this.delayedResize) window.clearTimeout(this.delayedResize);
|
||||
this.delayedResize = this._restore.bind(this).delay(0.2);
|
||||
this.delayedResize = this._resize.bind(this).delay(0.2);
|
||||
},
|
||||
|
||||
_restore: function() {
|
||||
_resize: function() {
|
||||
if (Prototype.Browser.IE)
|
||||
while (SOGoResizableTable._stylesheet.styleSheet.rules.length)
|
||||
SOGoResizableTable._stylesheet.styleSheet.removeRule();
|
||||
@@ -41,13 +42,58 @@ var SOGoResizableTableInterface = {
|
||||
while (SOGoResizableTable._stylesheet.firstChild)
|
||||
SOGoResizableTable._stylesheet.removeChild(SOGoResizableTable._stylesheet.firstChild);
|
||||
|
||||
// TODO : widths ratios should be computed and columns restored accordingly.
|
||||
var tableWidth = this.getWidth()/100;
|
||||
var cells = $(this).down('tr').childElements();
|
||||
for (i = 0; i < cells.length; i++) {
|
||||
var cell = cells[i];
|
||||
SOGoResizableTable._resize(this, $(cell), i, null, cell.getWidth());
|
||||
var ratio = this.ratios.get(cell.id);
|
||||
SOGoResizableTable._resize(this, $(cell), i, null, ratio*tableWidth);
|
||||
}
|
||||
},
|
||||
|
||||
restore: function(relativeWidths) {
|
||||
var tableWidth = this.getWidth()/100;
|
||||
var cells = $(this).down('tr').childElements();
|
||||
for (i = 0; i < cells.length; i++) {
|
||||
var cell = cells[i];
|
||||
var ratio = relativeWidths.get(cell.id);
|
||||
SOGoResizableTable._resize(this, $(cell), i, null, ratio*tableWidth);
|
||||
}
|
||||
this.ratios = relativeWidths;
|
||||
},
|
||||
|
||||
saveColumnsState: function() {
|
||||
this.ratios = new Hash();
|
||||
var tableWidth = 100/this.getWidth();
|
||||
var cells = $(this).down('tr').childElements();
|
||||
for (i = 0; i < cells.length; i++) {
|
||||
var cell = cells[i];
|
||||
if (cell.hasClassName('resizable'))
|
||||
this.ratios.set(cell.id, Math.round(cell.getWidth()*tableWidth));
|
||||
}
|
||||
if (!$(document.body).hasClassName("popup")) {
|
||||
var url = ApplicationBaseURL + "saveColumnsState";
|
||||
var data = this.ratios;
|
||||
var columns = data.keys();
|
||||
var params = "columns=" + columns.join(",")
|
||||
+ "&widths=" + columns.collect(function(c) { return data.get(c); }).join(",");
|
||||
triggerAjaxRequest(url,
|
||||
this.saveColumnsStateCallback,
|
||||
null,
|
||||
params,
|
||||
{ "Content-type": "application/x-www-form-urlencoded" });
|
||||
}
|
||||
},
|
||||
|
||||
saveColumnsStateCallback: function(http) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
log ("ResizableTable.saveColumnsStateCallback() Columns state saved");
|
||||
}
|
||||
else if (http.readyState == 4) {
|
||||
log ("ResizableTable.saveColumnsStateCallback() Can't save columns state");
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
SOGoResizableTable = {
|
||||
@@ -89,6 +135,8 @@ SOGoResizableTable = {
|
||||
var w = nextResizableCell.getWidth() - delta;
|
||||
SOGoResizableTable._resize(table, nextResizableCell, i, null, w, true);
|
||||
}
|
||||
|
||||
table.saveColumnsState();
|
||||
},
|
||||
|
||||
_resize: function(table, cell, index, nextResizableCell, w, isAdjustment) {
|
||||
|
||||
Reference in New Issue
Block a user