Moved the global email aliases editing screen to its own page to avoid having to...
authorArt Cancro <ajc@citadel.org>
Fri, 3 Sep 2021 03:45:00 +0000 (03:45 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 3 Sep 2021 03:45:00 +0000 (03:45 +0000)
webcit/siteconfig.c
webcit/static/t/aide/display_aliases.html [new file with mode: 0644]
webcit/static/t/aide/display_sitewide_config.html
webcit/static/t/aide/global_config.html
webcit/static/t/aide/siteconfig/tab_aliases.html [deleted file]

index 2d5755b..b82b0d2 100644 (file)
@@ -36,8 +36,8 @@ ConstStr ExpirePolicyStrings[][2] = {
        { { CStrOf(mailboxespolicy)} , { strof(mailboxespolicy)"_value", sizeof(strof(mailboxespolicy)"_value") - 1 } }
 };
 
-void LoadExpirePolicy(GPEXWhichPolicy which)
-{
+
+void LoadExpirePolicy(GPEXWhichPolicy which) {
        StrBuf *Buf;
        long State;
        const char *Pos = NULL;
@@ -55,8 +55,8 @@ void LoadExpirePolicy(GPEXWhichPolicy which)
        FreeStrBuf(&Buf);
 }
 
-void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which)
-{
+
+void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which) {
        StrBuf *Buf;
        long State;
 
@@ -73,8 +73,8 @@ void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which)
        FreeStrBuf(&Buf);
 }
 
-int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP)
-{
+
+int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP) {
        GPEXWhichPolicy which;
        int CompareWith;
 
@@ -86,8 +86,8 @@ int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP)
        return WC->Policy[which].expire_mode == CompareWith;
 }
 
-void tmplput_ExpireValue(StrBuf *Target, WCTemplputParams *TP)
-{
+
+void tmplput_ExpireValue(StrBuf *Target, WCTemplputParams *TP) {
        GPEXWhichPolicy which;
                
        which = GetTemplateTokenNumber(Target, TP, 0, 0);
@@ -96,8 +96,7 @@ void tmplput_ExpireValue(StrBuf *Target, WCTemplputParams *TP)
 }
 
 
-void tmplput_ExpireMode(StrBuf *Target, WCTemplputParams *TP)
-{
+void tmplput_ExpireMode(StrBuf *Target, WCTemplputParams *TP) {
        GPEXWhichPolicy which;
                
        which = GetTemplateTokenNumber(Target, TP, 2, 0);
@@ -106,8 +105,7 @@ void tmplput_ExpireMode(StrBuf *Target, WCTemplputParams *TP)
 }
 
 
-void LoadZoneFiles(void)
-{
+void LoadZoneFiles(void) {
        icalarray *zones;
        int z;
        long len;
@@ -222,12 +220,10 @@ CfgMapping ServerConfig[] = {
 };
 
 
-
 /*
  *  display all configuration items
  */
-void load_siteconfig(void)
-{
+void load_siteconfig(void) {
        StrBuf *Buf;
        HashList *Cfg;
        long len;
@@ -279,12 +275,10 @@ void load_siteconfig(void)
 }
 
 
-
 /*
  * parse siteconfig changes 
  */
-void siteconfig(void)
-{
+void siteconfig(void) {
        int i, value;
        StrBuf *Line;
 
@@ -345,8 +339,7 @@ void siteconfig(void)
 
 
 // if WebCit Classic wasn't obsolete we would replace this with a "CONF GETVAL" type of thing
-void tmplput_servcfg(StrBuf *Target, WCTemplputParams *TP)
-{
+void tmplput_servcfg(StrBuf *Target, WCTemplputParams *TP) {
        void *vBuf;
        StrBuf *Buf;
 
@@ -359,24 +352,8 @@ void tmplput_servcfg(StrBuf *Target, WCTemplputParams *TP)
        }
 }
 
-// output the global alias table
-void tmplput_servcfg_globalaliases(StrBuf *Target, WCTemplputParams *TP) {
-       TRACE;
-       StrBufAppendTemplate(Target, TP, "wow\n", 0);
-       TRACE;
-}
-
-
-
-
-
 
-
-
-
-
-int ConditionalServCfg(StrBuf *Target, WCTemplputParams *TP)
-{
+int ConditionalServCfg(StrBuf *Target, WCTemplputParams *TP) {
        void *vBuf;
        StrBuf *Buf;
 
@@ -406,8 +383,7 @@ int ConditionalServCfg(StrBuf *Target, WCTemplputParams *TP)
        else return 0;
 }
 
-int ConditionalServCfgCTXStrBuf(StrBuf *Target, WCTemplputParams *TP)
-{
+int ConditionalServCfgCTXStrBuf(StrBuf *Target, WCTemplputParams *TP) {
        void *vBuf;
        StrBuf *Buf;
        StrBuf *ZoneToCheck = (StrBuf*) CTX(CTX_STRBUF);
@@ -501,7 +477,6 @@ InitModule_SITECONFIG
        WebcitAddUrlHandler(HKEY("siteconfig"), "", 0, siteconfig, CTX_NONE);
 
        RegisterNamespace("SERV:CFG", 1, 2, tmplput_servcfg, NULL, CTX_NONE);
-       RegisterNamespace("SERV:GLOBALALIASES", 0, 1, tmplput_servcfg_globalaliases, NULL, CTX_NONE);
        RegisterConditional("COND:SERVCFG", 3, ConditionalServCfg, CTX_NONE);
        RegisterConditional("COND:SERVCFG:CTXSTRBUF", 4, ConditionalServCfgCTXStrBuf, CTX_STRBUF);
        RegisterIterator("PREF:ZONE", 0, ZoneHash, NULL, NULL, NULL, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
diff --git a/webcit/static/t/aide/display_aliases.html b/webcit/static/t/aide/display_aliases.html
new file mode 100644 (file)
index 0000000..c5c6a3e
--- /dev/null
@@ -0,0 +1,63 @@
+<?=("head")><?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
+<div id="banner">
+<h1><a href="javascript:load_aliases()">&#8635;</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>
+
+<textarea name="global_aliases" id="global_aliases" VALUE="">
+</textarea>
+
+<script type="text/javascript">
+
+load_aliases = async() => {
+       response = await fetch("ajax_servcmd?g_cmd=LIST");
+       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>" + config_line[0] + "</td><td>" +
+                       config_line[1] + "</td><td>" +
+                       "<a href=\"javascript:delete_alias('" + lineid + "');\">" +
+                       "<font color=#FF0000>&#10006;</font></a></td></tr>";
+       }
+       a += "</table>";
+       document.getElementById("wc_easterbunny77").innerHTML = a;
+       repopulate_the_box();
+}
+
+function repopulate_the_box() {
+       newbox = "";
+       t = document.getElementById("killo9867");
+       for (row of t.rows) {
+               newbox += row.cells[0].innerHTML + " - " + row.cells[1].innerHTML + "\n";
+       }
+       document.getElementById("global_aliases").innerHTML = newbox;
+}
+
+load_aliases();
+
+</script>
+
+
+<??("X", 2)>
+</div>
+</div>
+<?=("trailing")>
index 08ccf7a..4d9a6d7 100644 (file)
@@ -14,7 +14,6 @@
        _("SMTP"),                      ="aide_siteconfig_tab_smtp", 
        _("IMAP4"),                     ="aide_siteconfig_tab_imap", 
        _("Pop3"),                      ="aide_siteconfig_tab_pop3", 
-       _("Global email aliases"),      ="aide_siteconfig_tab_aliases",
        _("Indexing/Journaling"),       ="aide_siteconfig_tab_indexing",
        _("Access"),                    ="aide_siteconfig_tab_access",
        _("Directory"),                 ="aide_siteconfig_tab_directory",
index 8ff8ba4..80106a1 100644 (file)
@@ -2,4 +2,5 @@
 <li><a href="do_template?template=aide_display_sitewide_config"><?_("Edit site-wide configuration")></a></li>
 <li><a href="do_template?template=aide_display_inetconf"><?_("Domain names and Internet mail configuration")></a></li>
 <li><a href="dotskip?room=__CitadelSMTPspoolout__&view=11"><?_("View the outbound SMTP queue")></a></li>
+<li><a href="do_template?template=aide_display_aliases"><?_("Global email aliases")></a></li>
 </ul>
diff --git a/webcit/static/t/aide/siteconfig/tab_aliases.html b/webcit/static/t/aide/siteconfig/tab_aliases.html
deleted file mode 100644 (file)
index 58bb161..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<div class="conftitle">
-<a href="javascript:load_aliases()">&#8635;</a>
-<?_("Global email aliases")></div>
-<hr>
-
-<div id="wc_easterbunny77">
-</div>
-
-<textarea name="global_aliases" id="global_aliases" VALUE="<?SERV:GLOBALALIASES>">
-</textarea>
-
-<fcript type="text/javascript">
-
-load_aliases = async() => {
-       response = await fetch("ajax_servcmd?g_cmd=LIST");
-       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>" + config_line[0] + "</td><td>" +
-                       config_line[1] + "</td><td>" +
-                       "<a href=\"javascript:delete_alias('" + lineid + "');\">" +
-                       "<font color=#FF0000>&#10006;</font></a></td></tr>";
-       }
-       a += "</table>";
-       document.getElementById("wc_easterbunny77").innerHTML = a;
-       repopulate_the_box();
-}
-
-function repopulate_the_box() {
-       newbox = "";
-       t = document.getElementById("killo9867");
-       for (row of t.rows) {
-               newbox += row.cells[0].innerHTML + " - " + row.cells[1].innerHTML + "\n";
-       }
-       document.getElementById("global_aliases").innerHTML = newbox;
-}
-
-load_aliases();
-
-</fcript>