]> code.citadel.org Git - citadel.git/commitdiff
Rendering a single row in a mailbox now has its own function
authorArt Cancro <ajc@citadel.org>
Sun, 3 Jul 2022 21:04:46 +0000 (17:04 -0400)
committerArt Cancro <ajc@citadel.org>
Sun, 3 Jul 2022 21:04:46 +0000 (17:04 -0400)
webcit-ng/static/js/defs.js
webcit-ng/static/js/util.js
webcit-ng/static/js/view_mail.js

index 571afc03d7431826fdb3cef4f52694f4947fcf1e..5a7397e9933fd5b2a58606226887095c6848380e 100644 (file)
@@ -1,4 +1,3 @@
-//
 // Copyright (c) 2016-2022 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or
@@ -26,7 +25,6 @@ var march_list = [] ;
 
 
 // List of defined views shamelessly swiped from libcitadel headers
-//
 var views = {
        VIEW_BBS                : 0,    // Bulletin board view
        VIEW_MAILBOX            : 1,    // Mailbox summary
index e25921eb3e410e3eaeea56fa254341bcd52796dc..629f0713455f0cd70ed7a40c3bdb699607a4cdf7 100644 (file)
@@ -1,4 +1,3 @@
-//
 // Copyright (c) 2016-2022 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or
index f3ee2acfab91bf6b4b2546cd1b3ab41106c119a2..ec40e6718f38191268bb71482f74683138e8c4c5 100644 (file)
@@ -10,6 +10,21 @@ function select_message(msgnum) {
 }
 
 
+// render one row in the mailbox table (this could be called from one of several places)
+function mail_render_row(msg) {
+       row     = "<tr "
+               + "id=\"ctdl-msgsum-" + msg["msgnum"] + "\""
+               + "onClick=\"select_message(" + msg["msgnum"] + ")\""
+               + ">"
+               + "<td>" + msg["subject"] + "</td>"
+               + "<td>" + msg["author"] + " &lt;" + msg["addr"] + "&gt;</td>"
+               + "<td>" + convertTimestamp(msg["time"]) + "</td>"
+               + "<td>" + msg["msgnum"] + "</td>"
+               + "</tr>";
+       return(row);
+}
+
+
 // Set up the mailbox view
 function mail_display() {
        target_div = document.getElementById("ctdl-main");
@@ -33,15 +48,7 @@ function mail_display() {
                                + "</tr>";
 
                        for (var i=0; i<msgs.length; ++i) {
-                               box +=  "<tr "
-                                       + "id=\"ctdl-msgsum-" + msgs[i]["msgnum"] + "\""
-                                       + "onClick=\"select_message(" + msgs[i]["msgnum"] + ")\""
-                                       + ">"
-                                       + "<td>" + msgs[i]["subject"] + "</td>"
-                                       + "<td>" + msgs[i]["author"] + " &lt;" + msgs[i]["addr"] + "&gt;</td>"
-                                       + "<td>" + convertTimestamp(msgs[i]["time"]) + "</td>"
-                                       + "<td>" + msgs[i]["msgnum"] + "</td>"
-                                       + "</tr>";
+                               box += mail_render_row(msgs[i]);
                        }
 
                        box +=  "</table>";