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 // Set up the mailbox view
8 function mail_display() {
9 target_div = document.getElementById("ctdl-main");
10 target_div.innerHTML = "<div id=\"ctdl-mailbox-pane\">mailbox pane</div><div id=\"ctdl-reading-pane\">reading pane</div>";
11 mailbox_pane = document.getElementById("ctdl-mailbox-pane");
12 reading_pane = document.getElementById("ctdl-reading-pane");
14 activate_loading_modal();
15 url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/mailbox";
16 fetch_mailbox = async() => {
17 response = await fetch(url);
18 msgs = await(response.json());
21 box = "<table border=1 width=100%><tr>"
22 + "<th>" + _("Subject") + "</th>"
23 + "<th>" + _("Sender") + "</th>"
24 + "<th>" + _("Date") + "</th>"
29 for (var i=0; i<msgs.length; ++i) {
30 box += "<tr id=\"ctdl-msgsum-" + msgs[i]["msgnum"] + "\">"
31 + "<td>" + msgs[i]["subject"] + "</td>"
32 + "<td>" + msgs[i]["author"] + " <" + msgs[i]["addr"] + "></td>"
33 + "<td>" + convertTimestamp(msgs[i]["time"]) + "</td>"
34 + "<td>" + msgs[i]["msgnum"] + "</td>"
39 mailbox_pane.innerHTML = box;
43 deactivate_loading_modal();