--- /dev/null
+<?=("head")><?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
+<div id="banner">
+<h1><a href="javascript:load_aliases()">↻</a>
+<?_("Global email aliases")></h1>
+</div>
+<div id="content" class="service">
+<?!("COND:AIDE", 1)><?_("You need to be aide to view this.")><?!("X", 1)>
+<??("COND:AIDE", 2)>
+
+<div id="wc_easterbunny77">
+</div>
+
+<form method="POST" action="do_generic">
+ <input type="hidden" name="return_to" value="do_template?template=aide_display_menu">
+ <input type="hidden" name="g_cmd" value="conf putsys|global_alias_table">
+ <textarea name="g_input" id="g_input" rows="20" cols="80" VALUE="" style="display:none;"></textarea>
+ <br><center>
+ <input type="submit" name="ok_button" onClick="javascript:add_alias();" value="<?_("Save")>">
+ <input type="submit" name="cancel_button" value="<?_("Cancel")>"></center>
+</form>
+
+<script type="text/javascript">
+
+load_aliases = async() => {
+ response = await fetch("ajax_servcmd?g_cmd=conf getsys|global_alias_table");
+ data = await(response.text());
+ populate_aliases(data);
+};
+
+function delete_alias(rowid) {
+ var row = document.getElementById(rowid);
+ row.parentNode.removeChild(row);
+ repopulate_the_box();
+}
+
+function populate_aliases(data) {
+ var a = "<table id=killo9867>";
+ lines = data.split("\n");
+ for (var i=1; i<lines.length && lines[i] != "000"; ++i) {
+ config_line = lines[i].split("|");
+ lineid = randomString(10);
+ a += "<tr id=" + lineid + ">" +
+ "<td><a href=\"javascript:delete_alias('" + lineid + "');\">" +
+ "<font color=\"#FF0000\">❌</font></a></td>" +
+ "<td>" + config_line[0] + "</td>" +
+ "<td>" + config_line[1] + "</td>" +
+ "</tr>";
+ }
+ a += "<tr id=\"newentry\">" +
+ "<td><a href=\"javascript:add_alias();\">" +
+ "<font color=\"#FF0000\">✅</font></a></td>" +
+ "<td><input id=\"newalias1\" name=\"newalias1\" width=\"40\"></td>" +
+ "<td><input id=\"newalias2\" name=\"newalias2\" width=\"80\"></td>" +
+ "</tr>";
+ a += "</table>";
+ document.getElementById("wc_easterbunny77").innerHTML = a;
+ repopulate_the_box();
+}
+
+function add_alias() {
+ a = document.getElementById("g_input").innerHTML;
+ if (a != "") {
+ a += "\n";
+ }
+ a += document.getElementById("newentry").cells[1].firstChild.value + "|";
+ a += document.getElementById("newentry").cells[2].firstChild.value;
+ document.getElementById("g_input").innerHTML = a;
+ document.getElementById("newentry").cells[1].firstChild.value = "";
+ document.getElementById("newentry").cells[2].firstChild.value = "";
+ populate_aliases("100 \n" + a);
+ return true;
+}
+
+function repopulate_the_box() {
+ newbox = "";
+ t = document.getElementById("killo9867");
+ for (row of t.rows) {
+ if ( (row.cells[1].innerHTML.trim() != "")
+ && (row.cells[2].innerHTML.trim() != "")
+ && (row.id != "newentry")
+ ) {
+ if (newbox != "") {
+ newbox += "\n";
+ }
+ newbox += row.cells[1].innerHTML.trim() + "|" + row.cells[2].innerHTML.trim();
+ }
+ }
+ document.getElementById("g_input").innerHTML = newbox;
+}
+
+load_aliases();
+
+</script>
+
+
+<??("X", 2)>
+</div>
+</div>
+<?=("trailing")>