mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-09 18:35:10 +00:00
See ChangeLog
Monotone-Parent: 043af14fd2ae984a7c53179d03394ad062129d22 Monotone-Revision: 32554661a85cc9243d30ced4dbf571eab59b4ea3 Monotone-Author: crobert@inverse.ca Monotone-Date: 2008-10-03T19:01:29 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -422,45 +422,49 @@ function onMailboxTreeItemClick(event) {
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
function _onMailboxMenuAction(menuEntry, error, actionName) {
|
||||
var targetMailbox = menuEntry.mailbox.fullName();
|
||||
var messages = new Array();
|
||||
|
||||
if (targetMailbox == Mailer.currentMailbox)
|
||||
window.alert(labels[error]);
|
||||
else {
|
||||
if (document.menuTarget.tagName == "DIV")
|
||||
// Menu called from message content view
|
||||
messages.push(Mailer.currentMessages[Mailer.currentMailbox]);
|
||||
else if (Object.isArray(document.menuTarget))
|
||||
// Menu called from multiple selection in messages list view
|
||||
messages = $(document.menuTarget).collect(function(row) {
|
||||
return row.getAttribute("id").substr(4);
|
||||
});
|
||||
else
|
||||
// Menu called from one selection in messages list view
|
||||
messages.push(document.menuTarget.getAttribute("id").substr(4));
|
||||
|
||||
var url_prefix = URLForFolderID(Mailer.currentMailbox) + "/";
|
||||
messages.each(function(msgid, i) {
|
||||
var url = url_prefix + msgid + "/" + actionName
|
||||
+ "?folder=" + encodeURIComponent(targetMailbox);
|
||||
triggerAjaxRequest(url, folderRefreshCallback,
|
||||
((i == messages.size() - 1)?Mailer.currentMailbox:""));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onMailboxMenuMove(event) {
|
||||
_onMailboxMenuAction(this,
|
||||
"Moving a message into its own folder is impossible!",
|
||||
"move");
|
||||
var targetMailbox = this.mailbox.fullName();
|
||||
var messageList = $("messageList").down("TBODY");
|
||||
var rows = messageList.getSelectedNodes();
|
||||
var uids = new Array(); // message IDs
|
||||
var paths = new Array(); // row IDs
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var uid = rows[i].readAttribute("id").substr(4);
|
||||
var path = Mailer.currentMailbox + "/" + uid;
|
||||
rows[i].hide();
|
||||
uids.push(uid);
|
||||
paths.push(path);
|
||||
}
|
||||
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/moveMessages";
|
||||
var parameters = "uid=" + uids.join(",") + "&folder=" + targetMailbox;
|
||||
var data = { "id": uids, "mailbox": Mailer.currentMailbox, "path": paths, "folder": targetMailbox };
|
||||
triggerAjaxRequest(url, folderRefreshCallback, data, parameters,
|
||||
{ "Content-type": "application/x-www-form-urlencoded" });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function onMailboxMenuCopy(event) {
|
||||
_onMailboxMenuAction(this,
|
||||
"Copying a message into its own folder is impossible!",
|
||||
"copy");
|
||||
var targetMailbox = this.mailbox.fullName();
|
||||
var messageList = $("messageList").down("TBODY");
|
||||
var rows = messageList.getSelectedNodes();
|
||||
var uids = new Array(); // message IDs
|
||||
var paths = new Array(); // row IDs
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var uid = rows[i].readAttribute("id").substr(4);
|
||||
var path = Mailer.currentMailbox + "/" + uid;
|
||||
uids.push(uid);
|
||||
paths.push(path);
|
||||
}
|
||||
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/copyMessages";
|
||||
var parameters = "uid=" + uids.join(",") + "&folder=" + targetMailbox;
|
||||
var data = { "id": uids, "mailbox": Mailer.currentMailbox, "path": paths, "folder": targetMailbox };
|
||||
triggerAjaxRequest(url, folderRefreshCallback, data, parameters,
|
||||
{ "Content-type": "application/x-www-form-urlencoded" });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function refreshMailbox() {
|
||||
@@ -1491,9 +1495,23 @@ function generateMenuForMailbox(mailbox, prefix, callback) {
|
||||
previousMenuDIV.parentNode.removeChild(previousMenuDIV);
|
||||
menuDIV.setAttribute("id", menuID);
|
||||
var menu = document.createElement("ul");
|
||||
menu.style.cssFloat="left";
|
||||
menu.style.styleFloat="left";
|
||||
menuDIV.appendChild(menu);
|
||||
pageContent.appendChild(menuDIV);
|
||||
|
||||
var windowHeight = 0;
|
||||
if ( typeof(window.innerHeight) != "undefined" && window.innerHeight != 0 ) {
|
||||
windowHeight = window.innerHeight;
|
||||
}
|
||||
else {
|
||||
windowHeight = document.body.clientHeight;
|
||||
}
|
||||
var offset = 70;
|
||||
if ( navigator.appVersion.indexOf("Safari") >= 0 ) {
|
||||
offset = 140;
|
||||
}
|
||||
|
||||
var callbacks = new Array();
|
||||
if (mailbox.type != "account") {
|
||||
var newNode = document.createElement("li");
|
||||
@@ -1507,6 +1525,12 @@ function generateMenuForMailbox(mailbox, prefix, callback) {
|
||||
|
||||
var submenuCount = 0;
|
||||
for (var i = 0; i < mailbox.children.length; i++) {
|
||||
if ( menu.offsetHeight > windowHeight-offset ) {
|
||||
menu = document.createElement("ul");
|
||||
menu.style.cssFloat="left";
|
||||
menu.style.styleFloat="left";
|
||||
menuDIV.appendChild(menu);
|
||||
}
|
||||
var child = mailbox.children[i];
|
||||
var newNode = mailboxMenuNode(child.type, child.name);
|
||||
menu.appendChild(newNode);
|
||||
@@ -1521,6 +1545,7 @@ function generateMenuForMailbox(mailbox, prefix, callback) {
|
||||
callbacks.push(callback);
|
||||
}
|
||||
}
|
||||
|
||||
initMenu(menuDIV, callbacks);
|
||||
|
||||
return menuDIV.getAttribute("id");
|
||||
|
||||
@@ -327,7 +327,7 @@ SPAN.toolbarButton:active
|
||||
border-top: 1px solid #fff;
|
||||
border-left: 1px solid #fff;
|
||||
border-right: 1px solid #9e9a92;
|
||||
border-bottom: 1px solid #9e9a92; }
|
||||
/*border-bottom: 1px solid #9e9a92;*/ }
|
||||
|
||||
.menu LI,
|
||||
.popupMenu LI
|
||||
|
||||
Reference in New Issue
Block a user