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:
Wolfgang Sourdeau
2007-08-18 20:29:50 +00:00
parent a61d3e91fb
commit 2d9c462116
2 changed files with 57 additions and 16 deletions
+10 -6
View File
@@ -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
+47 -10
View File
@@ -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);