1 // Copyright (c) 2016-2022 by the citadel.org team
3 // This program is open source software. Use, duplication, or
4 // disclosure are subject to the GNU General Public License v3.
7 // A message has been selected...
8 function select_message(msgnum) {
9 reading_pane = document.getElementById("ctdl-reading-pane").innerHTML = "message selected " + msgnum ;
13 // render one row in the mailbox table (this could be called from one of several places)
14 function mail_render_row(msg) {
16 + "id=\"ctdl-msgsum-" + msg["msgnum"] + "\""
17 + "onClick=\"select_message(" + msg["msgnum"] + ")\""
19 + "<td>" + msg["subject"] + "</td>"
20 + "<td>" + msg["author"] + " <" + msg["addr"] + "></td>"
21 + "<td>" + convertTimestamp(msg["time"]) + "</td>"
22 + "<td>" + msg["msgnum"] + "</td>"
28 // Set up the mailbox view
29 function mail_display() {
30 target_div = document.getElementById("ctdl-main");
31 target_div.innerHTML = "<div id=\"ctdl-mailbox-pane\">mailbox pane</div><div id=\"ctdl-reading-pane\">reading pane</div>";
32 mailbox_pane = document.getElementById("ctdl-mailbox-pane");
33 reading_pane = document.getElementById("ctdl-reading-pane");
35 activate_loading_modal();
36 url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/mailbox";
37 fetch_mailbox = async() => {
38 response = await fetch(url);
39 msgs = await(response.json());
42 box = "<table class=\"w3-table-all\" width=100%>"
43 + "<tr class=\"w3-blue\">"
44 + "<th>" + _("Subject") + "</th>"
45 + "<th>" + _("Sender") + "</th>"
46 + "<th>" + _("Date") + "</th>"
50 for (var i=0; i<msgs.length; ++i) {
51 box += mail_render_row(msgs[i]);
55 mailbox_pane.innerHTML = box;
59 deactivate_loading_modal();