Activate mouse-up events on rooms in the mail folder list.
authorArt Cancro <ajc@citadel.org>
Mon, 13 Mar 2023 17:50:57 +0000 (13:50 -0400)
committerArt Cancro <ajc@citadel.org>
Mon, 13 Mar 2023 17:50:57 +0000 (13:50 -0400)
This will be used for drag-and-drop.

webcit-ng/static/js/mail_folder_list.js
webcit-ng/static/js/view_mail.js
webcit-ng/static/js/views.js

index c4c18e65de2d6ce5b466e5343dec9b7823427d28..54db61d6a42df02c177e11577252122aee2b68eb 100644 (file)
@@ -1,6 +1,6 @@
 // Display the mail folder list
 //
-// Copyright (c) 2016-2022 by the citadel.org team
+// Copyright (c) 2016-2023 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or
 // disclosure are subject to the GNU General Public License v3.
@@ -50,9 +50,12 @@ function render_mail_folder_list(roomlist_json) {
        rendered_list += "<ul class=\"ctdl_mail_folders\">\n";
        for (let i=0; i<roomlist_json.length; ++i) {
                if (roomlist_json[i].current_view == views.VIEW_MAILBOX) {
-                       rendered_list += "<li onClick=\"gotoroom('" + roomlist_json[i].name + "');\">";
-                       rendered_list += ((roomlist_json[i].name == "Mail") ? _("INBOX") : escapeHTML(roomlist_json[i].name));
-                       rendered_list += "</li>\n";
+                       rendered_list += "<li "
+                                       + "onmouseup=\"mail_mouseup('" + roomlist_json[i].name + "');\" "
+                                       + "onClick=\"gotoroom('" + roomlist_json[i].name + "');\">"
+                                       + ((roomlist_json[i].name == "Mail") ? _("INBOX") : escapeHTML(roomlist_json[i].name))
+                                       + "</li>\n"
+                       ;
                }
        }
        rendered_list += "</ul>";
@@ -60,3 +63,15 @@ function render_mail_folder_list(roomlist_json) {
 
        return rendered_list;
 }
+
+
+// The user released the mouse button over a folder name -- this is probably a drop event
+function mail_mouseup(roomname) {
+       console.log("mail_mouseup " + roomname);
+
+       // todo:
+       // 1. First check to see if a drag operation is in progress.  Exit if there is no such case.
+       // 2. Perform the MOVE operation on the selected rows.
+
+}
+
index d5b13141bb411b8cd8e1364f5406ac2372c90be2..43c930aa8ccbdbfacddaa047f77bd906cadea111 100644 (file)
@@ -17,7 +17,7 @@ var newmail_notify = {
 
 // This is the async back end for mail_delete_selected()
 mail_delete_func = async(table, row) => {
-       let m = parseInt(row["id"].substring(12));      // derive msgnum from row id
+       let m = parseInt(row["id"].substring(12));                              // derive msgnum from row id
 
        if (is_trash_folder) {
                response = await fetch(
@@ -37,7 +37,7 @@ mail_delete_func = async(table, row) => {
                );
        }
 
-       if (response.ok) {                              // If the server accepted the delete, blank out the message div.
+       if (response.ok) {                              // If the server accepted the delete, blank out the message div
                table.deleteRow(row.rowIndex);
                if (m == displayed_message) {
                        document.getElementById("ctdl-mailbox-reading-pane").innerHTML = "";
index 2d65edb3bdde01e93332f6c9fe7a5a27cae4f357..5292050bc9205970e4d0eace5b516efaf988a973 100644 (file)
@@ -1,10 +1,9 @@
-// Copyright (c) 2016-2022 by the citadel.org team
+// Copyright (c) 2016-2023 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or
 // disclosure are subject to the GNU General Public License v3.
 
 
-
 // Clear the sidebar buttons of any style indicating that one is selected
 function clear_sidebar_selection() {
        var items = document.getElementById("ctdl-sidebar").getElementsByTagName("*");