Monotone-Parent: d07959b964a2582bf5674d383b0dac7303346571
Monotone-Revision: 0bf13271077dfd22aaca8a2663fe7490f9d84cb3 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-02-01T15:49:33 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
8bb92ebe43
commit
6951e6a527
|
@ -179,15 +179,14 @@ function mailListMarkMessage(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailListMarkMessageCallback(http) {
|
function mailListMarkMessageCallback(http) {
|
||||||
if (http.readyState == 4)
|
if (isHttpStatus204(http.status)) {
|
||||||
if (isHttpStatus204(http.status)) {
|
var data = http.callbackData;
|
||||||
var data = http.callbackData;
|
markMailInWindow(data["window"], data["msguid"], data["markread"]);
|
||||||
markMailInWindow(data["window"], data["msguid"], data["markread"]);
|
}
|
||||||
}
|
else {
|
||||||
else {
|
alert("Message Mark Failed (" + http.status + "): " + http.statusText);
|
||||||
alert("Message Mark Failed (" + http.status + "): " + http.statusText);
|
window.location.reload();
|
||||||
window.location.reload();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* maillist row highlight */
|
/* maillist row highlight */
|
||||||
|
@ -235,31 +234,29 @@ function deleteSelectedMessages(sender) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteSelectedMessagesCallback(http) {
|
function deleteSelectedMessagesCallback(http) {
|
||||||
if (http.readyState == 4) {
|
if (isHttpStatus204(http.status)) {
|
||||||
if (isHttpStatus204(http.status)) {
|
var data = http.callbackData;
|
||||||
var data = http.callbackData;
|
deleteCachedMessage(data["messageId"]);
|
||||||
deleteCachedMessage(data["messageId"]);
|
deleteMessageRequestCount--;
|
||||||
deleteMessageRequestCount--;
|
if (Mailer.currentMailbox == data["mailbox"]) {
|
||||||
if (Mailer.currentMailbox == data["mailbox"]) {
|
var div = $('messageContent');
|
||||||
var div = $('messageContent');
|
if (Mailer.currentMessages[Mailer.currentMailbox] == data["id"]) {
|
||||||
if (Mailer.currentMessages[Mailer.currentMailbox] == data["id"]) {
|
div.update();
|
||||||
div.update();
|
Mailer.currentMessages[Mailer.currentMailbox] = null;
|
||||||
Mailer.currentMessages[Mailer.currentMailbox] = null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var row = $("row_" + data["id"]);
|
var row = $("row_" + data["id"]);
|
||||||
var nextRow = row.next("tr");
|
var nextRow = row.next("tr");
|
||||||
if (!nextRow)
|
if (!nextRow)
|
||||||
nextRow = row.previous("tr");
|
nextRow = row.previous("tr");
|
||||||
row.parentNode.removeChild(row);
|
row.parentNode.removeChild(row);
|
||||||
// row.addClassName("deleted"); // when we'll offer "mark as deleted"
|
// row.addClassName("deleted"); // when we'll offer "mark as deleted"
|
||||||
|
|
||||||
if (deleteMessageRequestCount == 0) {
|
if (deleteMessageRequestCount == 0) {
|
||||||
if (nextRow) {
|
if (nextRow) {
|
||||||
Mailer.currentMessages[Mailer.currentMailbox] = nextRow.getAttribute("id").substr(4);
|
Mailer.currentMessages[Mailer.currentMailbox] = nextRow.getAttribute("id").substr(4);
|
||||||
nextRow.select();
|
nextRow.select();
|
||||||
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
|
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,8 +485,7 @@ function openMailbox(mailbox, reload, idx) {
|
||||||
currentMessage);
|
currentMessage);
|
||||||
|
|
||||||
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
|
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
|
||||||
document.quotasAjaxRequest
|
triggerAjaxRequest(quotasUrl, quotasCallback);
|
||||||
= triggerAjaxRequest(quotasUrl, quotasCallback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,8 +499,7 @@ function messageListCallback(http) {
|
||||||
var div = $('mailboxContent');
|
var div = $('mailboxContent');
|
||||||
var table = $('messageList');
|
var table = $('messageList');
|
||||||
|
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
document.messageListAjaxRequest = null;
|
document.messageListAjaxRequest = null;
|
||||||
|
|
||||||
if (table) {
|
if (table) {
|
||||||
|
@ -571,8 +566,7 @@ function messageListCallback(http) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function quotasCallback(http) {
|
function quotasCallback(http) {
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
var hasQuotas = false;
|
var hasQuotas = false;
|
||||||
|
|
||||||
if (http.responseText.length > 0) {
|
if (http.responseText.length > 0) {
|
||||||
|
@ -822,18 +816,16 @@ function onICalendarButtonClick(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ICalendarButtonCallback(http) {
|
function ICalendarButtonCallback(http) {
|
||||||
if (http.readyState == 4)
|
if (isHttpStatus204(http.status)) {
|
||||||
if (isHttpStatus204(http.status)) {
|
var oldMsg = http.callbackData;
|
||||||
var oldMsg = http.callbackData;
|
var msg = Mailer.currentMailbox + "/" + Mailer.currentMessages[Mailer.currentMailbox];
|
||||||
var msg = Mailer.currentMailbox + "/" + Mailer.currentMessages[Mailer.currentMailbox];
|
if (oldMsg == msg) {
|
||||||
if (oldMsg == msg) {
|
deleteCachedMessage(oldMsg);
|
||||||
deleteCachedMessage(oldMsg);
|
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
|
||||||
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.alert("received code: " + http.status);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
window.alert("received code: " + http.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizeMailContent() {
|
function resizeMailContent() {
|
||||||
|
@ -878,8 +870,7 @@ function onImageClick(event) {
|
||||||
function messageCallback(http) {
|
function messageCallback(http) {
|
||||||
var div = $('messageContent');
|
var div = $('messageContent');
|
||||||
|
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
document.messageAjaxRequest = null;
|
document.messageAjaxRequest = null;
|
||||||
div.update(http.responseText);
|
div.update(http.responseText);
|
||||||
configureLinksInMessage();
|
configureLinksInMessage();
|
||||||
|
@ -1418,8 +1409,7 @@ function updateMailboxMenus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadMailboxesCallback(http) {
|
function onLoadMailboxesCallback(http) {
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
checkAjaxRequestsState();
|
checkAjaxRequestsState();
|
||||||
if (http.responseText.length > 0) {
|
if (http.responseText.length > 0) {
|
||||||
var newAccount = buildMailboxes(http.callbackData,
|
var newAccount = buildMailboxes(http.callbackData,
|
||||||
|
@ -1489,8 +1479,7 @@ function getFoldersState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFoldersStateCallback(http) {
|
function getFoldersStateCallback(http) {
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
if (http.responseText.length > 0) {
|
if (http.responseText.length > 0) {
|
||||||
// The response text is a JSOn representation
|
// The response text is a JSOn representation
|
||||||
// of the folders that were left opened.
|
// of the folders that were left opened.
|
||||||
|
@ -1501,8 +1490,8 @@ function getFoldersStateCallback(http) {
|
||||||
mailboxTree.o(i);
|
mailboxTree.o(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mailboxTree.autoSync();
|
||||||
}
|
}
|
||||||
mailboxTree.autoSync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveFoldersState() {
|
function saveFoldersState() {
|
||||||
|
@ -1514,8 +1503,7 @@ function saveFoldersState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveFoldersStateCallback(http) {
|
function saveFoldersStateCallback(http) {
|
||||||
if (http.readyState == 4
|
if (isHttpStatus204(http.status)) {
|
||||||
&& isHttpStatus204(http.status)) {
|
|
||||||
log ("folders state saved");
|
log ("folders state saved");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,7 +322,8 @@ function displayFreeBusyForNode(input) {
|
||||||
}
|
}
|
||||||
var sd = $('startTime_date').valueAsShortDateString();
|
var sd = $('startTime_date').valueAsShortDateString();
|
||||||
var ed = $('endTime_date').valueAsShortDateString();
|
var ed = $('endTime_date').valueAsShortDateString();
|
||||||
var urlstr = ( UserFolderURL + "../" + input.uid + "/freebusy.ifb/ajaxRead?"
|
var urlstr = ( UserFolderURL + "../" + input.uid
|
||||||
|
+ "/freebusy.ifb/ajaxRead?"
|
||||||
+ "sday=" + sd + "&eday=" + ed + "&additional=" +
|
+ "sday=" + sd + "&eday=" + ed + "&additional=" +
|
||||||
additionalDays );
|
additionalDays );
|
||||||
document.contactFreeBusyAjaxRequest
|
document.contactFreeBusyAjaxRequest
|
||||||
|
@ -601,7 +602,8 @@ function prepareAttendees() {
|
||||||
$(row).addClassName(attendeesEditor.states[i]);
|
$(row).addClassName(attendeesEditor.states[i]);
|
||||||
var input = $(row).down("input");
|
var input = $(row).down("input");
|
||||||
var value = "";
|
var value = "";
|
||||||
if (attendeesEditor.names[i].length > 0 && attendeesEditor.names[i] != attendeesEditor.emails[i])
|
if (attendeesEditor.names[i].length > 0
|
||||||
|
&& attendeesEditor.names[i] != attendeesEditor.emails[i])
|
||||||
value += attendeesEditor.names[i] + " ";
|
value += attendeesEditor.names[i] + " ";
|
||||||
value += "<" + attendeesEditor.emails[i] + ">";
|
value += "<" + attendeesEditor.emails[i] + ">";
|
||||||
input.value = value;
|
input.value = value;
|
||||||
|
|
|
@ -309,39 +309,47 @@ function appendDifferentiator(url) {
|
||||||
return url_nocache;
|
return url_nocache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onAjaxRequestStateChange(http) {
|
||||||
|
try {
|
||||||
|
if (http.readyState == 4
|
||||||
|
&& activeAjaxRequests > 0) {
|
||||||
|
if (!http.aborted)
|
||||||
|
http.callback(http);
|
||||||
|
activeAjaxRequests--;
|
||||||
|
checkAjaxRequestsState();
|
||||||
|
http.onreadystatechange = Prototype.emptyFunction;
|
||||||
|
http.callback = Prototype.emptyFunction;
|
||||||
|
http.callbackData = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
activeAjaxRequests--;
|
||||||
|
checkAjaxRequestsState();
|
||||||
|
http.onreadystatechange = Prototype.emptyFunction;
|
||||||
|
http.callback = Prototype.emptyFunction;
|
||||||
|
http.callbackData = null;
|
||||||
|
log("AJAX Request, Caught Exception: " + e.name);
|
||||||
|
log(e.message);
|
||||||
|
log(backtrace());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
||||||
var http = createHTTPClient();
|
var http = createHTTPClient();
|
||||||
|
|
||||||
activeAjaxRequests += 1;
|
activeAjaxRequests++;
|
||||||
document.animTimer = setTimeout("checkAjaxRequestsState();", 50);
|
document.animTimer = setTimeout("checkAjaxRequestsState();", 250);
|
||||||
//url = appendDifferentiator(url);
|
//url = appendDifferentiator(url);
|
||||||
|
|
||||||
if (http) {
|
if (http) {
|
||||||
http.open("POST", url, true);
|
http.open("POST", url, true);
|
||||||
http.url = url;
|
http.url = url;
|
||||||
http.onreadystatechange
|
http.callback = callback;
|
||||||
= function() {
|
http.callbackData = userdata;
|
||||||
// log ("state changed (" + http.readyState + "): " + url);
|
http.onreadystatechange = function() { onAjaxRequestStateChange(http) };
|
||||||
try {
|
// = function() {
|
||||||
if (http.readyState == 4
|
// // log ("state changed (" + http.readyState + "): " + url);
|
||||||
&& activeAjaxRequests > 0) {
|
// };
|
||||||
if (!http.aborted) {
|
|
||||||
if (userdata)
|
|
||||||
http.callbackData = userdata;
|
|
||||||
callback(http);
|
|
||||||
}
|
|
||||||
activeAjaxRequests -= 1;
|
|
||||||
checkAjaxRequestsState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
activeAjaxRequests -= 1;
|
|
||||||
checkAjaxRequestsState();
|
|
||||||
log("AJAX Request, Caught Exception: " + e.name);
|
|
||||||
log(e.message);
|
|
||||||
log(backtrace());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var hasContentLength = false;
|
var hasContentLength = false;
|
||||||
if (headers) {
|
if (headers) {
|
||||||
for (var i in headers) {
|
for (var i in headers) {
|
||||||
|
@ -367,36 +375,31 @@ function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
||||||
|
|
||||||
function startAnimation(parent, nextNode) {
|
function startAnimation(parent, nextNode) {
|
||||||
var anim = $("progressIndicator");
|
var anim = $("progressIndicator");
|
||||||
if (anim) return anim;
|
if (!anim) {
|
||||||
|
anim = createElement("img", "progressIndicator", null,
|
||||||
anim = document.createElement("img");
|
{src: ResourcesURL + "/busy.gif"});
|
||||||
anim = $(anim);
|
anim.setStyle({ visibility: "hidden" });
|
||||||
anim.id = "progressIndicator";
|
if (nextNode)
|
||||||
anim.src = ResourcesURL + "/busy.gif";
|
parent.insertBefore(anim, nextNode);
|
||||||
anim.setStyle({ visibility: "hidden" });
|
else
|
||||||
if (nextNode)
|
parent.appendChild(anim);
|
||||||
parent.insertBefore(anim, nextNode);
|
anim.setStyle({ visibility: "visible" });
|
||||||
else
|
}
|
||||||
parent.appendChild(anim);
|
|
||||||
anim.setStyle({ visibility: "visible" });
|
|
||||||
|
|
||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAjaxRequestsState() {
|
function checkAjaxRequestsState() {
|
||||||
var toolbar = document.getElementById("toolbar");
|
var progressImage = $("progressIndicator");
|
||||||
if (toolbar) {
|
if (activeAjaxRequests > 0
|
||||||
if (activeAjaxRequests > 0
|
&& !progressImage) {
|
||||||
&& !document.busyAnim) {
|
var toolbar = $("toolbar");
|
||||||
document.busyAnim = startAnimation(toolbar);
|
if (toolbar)
|
||||||
}
|
startAnimation(toolbar);
|
||||||
else if (activeAjaxRequests == 0
|
|
||||||
&& document.busyAnim
|
|
||||||
&& document.busyAnim.parentNode) {
|
|
||||||
document.busyAnim.parentNode.removeChild(document.busyAnim);
|
|
||||||
document.busyAnim = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (!activeAjaxRequests
|
||||||
|
&& progressImage)
|
||||||
|
progressImage.parentNode.removeChild(progressImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSafari3() {
|
function isSafari3() {
|
||||||
|
|
Loading…
Reference in a new issue