mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-22 03:45:25 +00:00
Monotone-Parent: 00cf2c07fbd93b89ceb6598dafd2eec92b7b1c83
Monotone-Revision: c9fe71973aed95296138ce4dd5fd00105a55b4c6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-18T20:29:50 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -252,7 +252,7 @@ function uixDeleteSelectedMessages(sender) {
|
||||
var messageId = currentMailbox + "/" + rowId;
|
||||
url = ApplicationBaseURL + messageId + "/trash?jsonly=1";
|
||||
http = createHTTPClient();
|
||||
http.open("GET", url, false /* not async */);
|
||||
http.open("POST", url, false /* not async */);
|
||||
http.send("");
|
||||
if (http.status != 200) { /* request failed */
|
||||
failCount++;
|
||||
@@ -404,10 +404,14 @@ function openMailbox(mailbox, reload, idx) {
|
||||
var url = ApplicationBaseURL + mailbox + "/view?noframe=1";
|
||||
var messageContent = $("messageContent");
|
||||
messageContent.innerHTML = '';
|
||||
|
||||
if (currentMessages[mailbox]) {
|
||||
loadMessage(currentMessages[mailbox]);
|
||||
url += '&pageforuid=' + currentMessages[mailbox];
|
||||
|
||||
var currentMessage;
|
||||
if (!idx) {
|
||||
currentMessage = currentMessages[mailbox];
|
||||
if (currentMessage) {
|
||||
loadMessage(currentMessage);
|
||||
url += '&pageforuid=' + currentMessage;
|
||||
}
|
||||
}
|
||||
|
||||
var searchValue = search["value"];
|
||||
@@ -438,7 +442,7 @@ function openMailbox(mailbox, reload, idx) {
|
||||
|
||||
document.messageListAjaxRequest
|
||||
= triggerAjaxRequest(url, messageListCallback,
|
||||
currentMessages[mailbox]);
|
||||
currentMessage);
|
||||
|
||||
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
|
||||
document.quotasAjaxRequest
|
||||
|
||||
@@ -144,6 +144,7 @@ function clickedEditorSend(sender) {
|
||||
if (!validateEditorInput(sender))
|
||||
return false;
|
||||
|
||||
window.shouldPreserve = true;
|
||||
document.pageform.action = "send";
|
||||
document.pageform.submit();
|
||||
|
||||
@@ -152,7 +153,6 @@ function clickedEditorSend(sender) {
|
||||
|
||||
function clickedEditorAttach(sender) {
|
||||
var area = $("attachmentsArea");
|
||||
|
||||
area.setStyle({ display: "block" });
|
||||
|
||||
var inputs = area.getElementsByTagName("input");
|
||||
@@ -210,20 +210,13 @@ function createAttachment(node, list) {
|
||||
}
|
||||
|
||||
function clickedEditorSave(sender) {
|
||||
window.shouldPreserve = true;
|
||||
document.pageform.action = "save";
|
||||
document.pageform.submit();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function clickedEditorDelete(sender) {
|
||||
document.pageform.action = "delete";
|
||||
document.pageform.submit();
|
||||
window.close();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function initMailEditor() {
|
||||
var list = $("attachments");
|
||||
$(list).attachMenu("attachmentsMenu");
|
||||
@@ -232,8 +225,14 @@ function initMailEditor() {
|
||||
Event.observe(elements[i], "click",
|
||||
onRowClick.bindAsEventListener(elements[i]));
|
||||
}
|
||||
|
||||
var listContent = $("attachments").childNodesWithTag("li");
|
||||
if (listContent.length > 0)
|
||||
$("attachmentsArea").setStyle({ display: "block" });
|
||||
|
||||
onWindowResize(null);
|
||||
Event.observe(window, "resize", onWindowResize);
|
||||
Event.observe(window, "beforeunload", onMailEditorClose);
|
||||
}
|
||||
|
||||
function getMenus() {
|
||||
@@ -252,8 +251,31 @@ function onRemoveAttachments() {
|
||||
input.parentNode.removeChild(input);
|
||||
list.removeChild(nodes[i]);
|
||||
}
|
||||
else {
|
||||
var filename = "";
|
||||
var childNodes = nodes[i].childNodes;
|
||||
for (var j = 0; j < childNodes.length; j++) {
|
||||
if (childNodes[j].nodeType == 3)
|
||||
filename += childNodes[j].nodeValue;
|
||||
}
|
||||
var url = "" + window.location;
|
||||
var parts = url.split("/");
|
||||
parts[parts.length-1] = "deleteAttachment?filename=" + encodeURIComponent(filename);
|
||||
url = parts.join("/");
|
||||
triggerAjaxRequest(url, attachmentDeleteCallback,
|
||||
nodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function attachmentDeleteCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (http.status == 204) {
|
||||
var node = http.callbackData;
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
else
|
||||
window.alert("Server attachments not handled");
|
||||
log("attachmentDeleteCallback: an error occured: " + http.responseText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,4 +296,19 @@ function onWindowResize(event) {
|
||||
log ("onWindowResize new number of rows = " + textarea.rows);
|
||||
}
|
||||
|
||||
function onMailEditorClose(event) {
|
||||
if (window.shouldPreserve)
|
||||
window.shouldPreserve = false;
|
||||
else {
|
||||
var url = "" + window.location;
|
||||
var parts = url.split("/");
|
||||
parts[parts.length-1] = "delete";
|
||||
url = parts.join("/");
|
||||
|
||||
http = createHTTPClient();
|
||||
http.open("POST", url, false /* not async */);
|
||||
http.send("");
|
||||
}
|
||||
}
|
||||
|
||||
addEvent(window, 'load', initMailEditor);
|
||||
|
||||
Reference in New Issue
Block a user