Additional work on the alias table. This is taking longer than it ought to because...
[citadel] / webcit / static / t / aide / siteconfig / tab_aliases.html
1 <div class="conftitle">
2 <a href="javascript:load_aliases()">&#8635;</a>
3 <?_("Global email aliases")></div>
4 <hr>
5
6 <div id="wc_easterbunny77">
7 </div>
8
9 <textarea name="global_aliases" id="global_aliases">a
10 </textarea>
11
12 <script type="text/javascript">
13
14 load_aliases = async() => {
15         response = await fetch("ajax_servcmd?g_cmd=LIST");
16         data = await(response.text());
17         populate_aliases(data);
18 };
19
20 function delete_alias(rowid) {
21         var row = document.getElementById(rowid);
22         row.parentNode.removeChild(row);
23         repopulate_the_box();
24 }
25
26 function populate_aliases(data) {
27         var a = "<table id=killo9867>";
28         lines = data.split("\n");
29         for (var i=1; i<lines.length && lines[i] != "000"; ++i) {
30                 config_line = lines[i].split("|");
31                 lineid = randomString(10);
32                 a +=    "<tr id=" + lineid + "><td>" + config_line[0] + "</td><td>" +
33                         config_line[1] + "</td><td>" +
34                         "<a href=\"javascript:delete_alias('" + lineid + "');\">" +
35                         "<font color=#FF0000>&#10006;</font></a></td></tr>";
36         }
37         a += "</table>";
38         document.getElementById("wc_easterbunny77").innerHTML = a;
39         repopulate_the_box();
40 }
41
42 function repopulate_the_box() {
43         newbox = "";
44         t = document.getElementById("killo9867");
45         for (row of t.rows) {
46                 newbox += row.cells[0].innerHTML + " - " + row.cells[1].innerHTML + "\n";
47         }
48         document.getElementById("global_aliases").innerHTML = newbox;
49 }
50
51 load_aliases();
52
53 </script>