From: helge Date: Wed, 20 Jul 2005 15:39:06 +0000 (+0000) Subject: added support for bulk deletes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2d209eea03d7cbcc691efad10656b78cf2631da;p=scalable-opengroupware.org added support for bulk deletes use POST for AJAX modification ops git-svn-id: http://svn.opengroupware.org/SOGo/trunk@854 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/WebServerResources/ChangeLog b/SOGo/UI/WebServerResources/ChangeLog index f310a951..85a91b96 100644 --- a/SOGo/UI/WebServerResources/ChangeLog +++ b/SOGo/UI/WebServerResources/ChangeLog @@ -1,5 +1,9 @@ 2005-07-20 Helge Hess + * mailer.js: use POST instead of GET for toggling the mail read flag, + aded uixDeleteSelectedMessages() function to bulk delete mails from + the selection + * UIxAppointmentEditor.js: properly use getDate() instead of getDay() for date comparison (#1478) diff --git a/SOGo/UI/WebServerResources/mailer.js b/SOGo/UI/WebServerResources/mailer.js index 049e78c0..3c8c6645 100644 --- a/SOGo/UI/WebServerResources/mailer.js +++ b/SOGo/UI/WebServerResources/mailer.js @@ -253,8 +253,11 @@ function openMessageWindowsForSelection(sender, action) { 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) { @@ -265,7 +268,7 @@ 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? @@ -312,6 +315,7 @@ function ctxFolderAdd(sender) { if (folderName == "") return false; + // TODO: should use a form-POST or AJAX window.location.href = "createFolder?name=" + escape(folderName); return false; } @@ -320,6 +324,46 @@ function ctxFolderDelete(sender) { 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; +}