Moved the global email aliases editing screen to its own page to avoid having to...
[citadel.git] / webcit / static / t / aide / display_aliases.html
1 <?=("head")><?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
2 <div id="banner">
3 <h1><a href="javascript:load_aliases()">&#8635;</a>
4 <?_("Global email aliases")></h1>
5 </div>
6 <div id="content" class="service">
7 <?!("COND:AIDE", 1)><?_("You need to be aide to view this.")><?!("X", 1)>
8 <??("COND:AIDE", 2)>
9
10 <div id="wc_easterbunny77">
11 </div>
12
13 <textarea name="global_aliases" id="global_aliases" VALUE="">
14 </textarea>
15
16 <script type="text/javascript">
17
18 load_aliases = async() => {
19         response = await fetch("ajax_servcmd?g_cmd=LIST");
20         data = await(response.text());
21         populate_aliases(data);
22 };
23
24 function delete_alias(rowid) {
25         var row = document.getElementById(rowid);
26         row.parentNode.removeChild(row);
27         repopulate_the_box();
28 }
29
30 function populate_aliases(data) {
31         var a = "<table id=killo9867>";
32         lines = data.split("\n");
33         for (var i=1; i<lines.length && lines[i] != "000"; ++i) {
34                 config_line = lines[i].split("|");
35                 lineid = randomString(10);
36                 a +=    "<tr id=" + lineid + "><td>" + config_line[0] + "</td><td>" +
37                         config_line[1] + "</td><td>" +
38                         "<a href=\"javascript:delete_alias('" + lineid + "');\">" +
39                         "<font color=#FF0000>&#10006;</font></a></td></tr>";
40         }
41         a += "</table>";
42         document.getElementById("wc_easterbunny77").innerHTML = a;
43         repopulate_the_box();
44 }
45
46 function repopulate_the_box() {
47         newbox = "";
48         t = document.getElementById("killo9867");
49         for (row of t.rows) {
50                 newbox += row.cells[0].innerHTML + " - " + row.cells[1].innerHTML + "\n";
51         }
52         document.getElementById("global_aliases").innerHTML = newbox;
53 }
54
55 load_aliases();
56
57 </script>
58
59
60 <??("X", 2)>
61 </div>
62 </div>
63 <?=("trailing")>