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 // Set up the mailbox view
14 function mail_display() {
15 target_div = document.getElementById("ctdl-main");
16 target_div.innerHTML = "<div id=\"ctdl-mailbox-pane\">mailbox pane</div><div id=\"ctdl-reading-pane\">reading pane</div>";
17 mailbox_pane = document.getElementById("ctdl-mailbox-pane");
18 reading_pane = document.getElementById("ctdl-reading-pane");
20 activate_loading_modal();
21 url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/mailbox";
22 fetch_mailbox = async() => {
23 response = await fetch(url);
24 msgs = await(response.json());
27 box = "<table class=\"w3-table-all\" width=100%>"
28 + "<tr class=\"w3-blue\">"
29 + "<th>" + _("Subject") + "</th>"
30 + "<th>" + _("Sender") + "</th>"
31 + "<th>" + _("Date") + "</th>"
35 for (var i=0; i<msgs.length; ++i) {
37 + "id=\"ctdl-msgsum-" + msgs[i]["msgnum"] + "\""
38 + "onClick=\"select_message(" + msgs[i]["msgnum"] + ")\""
40 + "<td>" + msgs[i]["subject"] + "</td>"
41 + "<td>" + msgs[i]["author"] + " <" + msgs[i]["addr"] + "></td>"
42 + "<td>" + convertTimestamp(msgs[i]["time"]) + "</td>"
43 + "<td>" + msgs[i]["msgnum"] + "</td>"
48 mailbox_pane.innerHTML = box;
52 deactivate_loading_modal();