var rows = collectSelectedRows();
var idset = "";
- for (var i = 0; i < rows.length; i++)
- win = openMessageWindow(sender, rows[i], rows[i] + "/" + action);
+ for (var i = 0; i < rows.length; i++) {
+ win = openMessageWindow(sender,
+ rows[i] /* msguid */,
+ rows[i] + "/" + action /* url */);
+ }
}
function mailListMarkMessage(sender, action, msguid, markread) {
if (http) {
// TODO: add parameter to signal that we are only interested in OK
- http.open("GET", url + "&jsonly=1", false);
+ http.open("POST", url + "&jsonly=1", false /* not async */);
http.send(null);
if (http.status != 200) {
// TODO: refresh page?
if (folderName == "")
return false;
+ // TODO: should use a form-POST or AJAX
window.location.href = "createFolder?name=" + escape(folderName);
return false;
}
if (!confirm("Delete current folder?"))
return false;
+ // TODO: should use a form-POST or AJAX
window.location.href = "deleteFolder";
return false;
}
+
+/* bulk delete of messages */
+
+function uixDeleteSelectedMessages(sender) {
+ var rows;
+ var failCount = 0;
+
+ rows = collectSelectedRows();
+ for (var i = 0; i < rows.length; i++) {
+ var url, http, rowElem;
+
+ /* send AJAX request (synchronously) */
+
+ url = "" + rows[i] + "/trash?jsonly=1";
+
+ http = createHTTPClient();
+ http.open("POST", url, false /* not async */);
+ http.send(null);
+ if (http.status != 200) { /* request failed */
+ failCount++;
+ http = null;
+ continue;
+ }
+ http = null;
+
+ /* remove from page */
+
+ /* line-through would be nicer, but hiding is OK too */
+ rowElem = document.getElementById("row_" + rows[i]);
+ rowElem.style.display = "none";
+
+ }
+
+ if (failCount > 0)
+ alert("Could not delete " + failCount + " messages!");
+
+ window.location.reload();
+ return false;
+}