X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fsiteconfig.c;h=2f3d91cb5dcfec2f6b4fd3a66bfad500b1e45a3f;hp=a68a6c7464a38f7707556adee384fdb1f85d2f30;hb=f0cd12e35149b38761b187f22794782b7ba9c0ff;hpb=31bf95c2e8693ad528162812122735c87c25cc5a diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index a68a6c746..2f3d91cb5 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -1,848 +1,446 @@ /* - * $Id$ - * * Administrative screen for site-wide configuration + * + * Copyright (c) 1996-2011 by the citadel.org team + * + * This program is open source software. You can redistribute it and/or + * modify it under the terms of the GNU General Public License, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. */ - #include "webcit.h" #include "webserver.h" -/* - * \brief display all configuration items - */ -void display_siteconfig(void) +HashList *ZoneHash = NULL; + +ConstStr ExpirePolicyString = {CStrOf(roompolicy) }; + +ConstStr ExpirePolicyStrings[][2] = { + { { CStrOf(roompolicy) } , { strof(roompolicy) "_value", sizeof(strof(roompolicy) "_value") - 1 } }, + { { CStrOf(floorpolicy) } , { strof(floorpolicy) "_value", sizeof(strof(floorpolicy) "_value") - 1 } }, + { { CStrOf(sitepolicy) } , { strof(sitepolicy) "_value", sizeof(strof(sitepolicy) "_value") - 1 } }, + { { CStrOf(mailboxespolicy)} , { strof(mailboxespolicy)"_value", sizeof(strof(mailboxespolicy)"_value") - 1 } } +}; + +void LoadExpirePolicy(GPEXWhichPolicy which) { - char buf[SIZ]; - int i, j; - - char general[65536]; - char access[SIZ]; - char network[SIZ]; - char tuning[SIZ]; - char directory[SIZ]; - char purger[SIZ]; - char idxjnl[SIZ]; - char funambol[SIZ]; - char pop3[SIZ]; + StrBuf *Buf; + wcsession *WCC = WC; + long State; + const char *Pos = NULL; + + serv_printf("GPEX %s", ExpirePolicyStrings[which][0].Key); + Buf = NewStrBuf(); + StrBuf_ServGetln(Buf); + WCC->Policy[which].loaded = 1; + if (GetServerStatus(Buf, &State) == 2) { + Pos = ChrPtr(Buf) + 4; + WCC->Policy[which].expire_mode = StrBufExtractNext_long(Buf, &Pos, '|'); + WCC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|'); + } + else if (State == 550) + AppendImportantMessage(_("Higher access is required to access this function."), -1); + FreeStrBuf(&Buf); +} + +void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which) +{ + StrBuf *Buf; + long State; + + serv_printf("SPEX %s|%d|%d", + ExpirePolicyStrings[which][0].Key, + ibcstr( ExpirePolicyStrings[which][1] ), + ibcstr( ExpirePolicyStrings[which][1] ) ); + + Buf = NewStrBuf(); + StrBuf_ServGetln(Buf); + GetServerStatus(Buf, &State); + if (State == 550) + AppendImportantMessage(_("Higher access is required to access this function."), -1); + FreeStrBuf(&Buf); +} + +int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + GPEXWhichPolicy which; + int CompareWith; + + which = GetTemplateTokenNumber(Target, TP, 2, 0); + CompareWith = GetTemplateTokenNumber(Target, TP, 3, 0); + + if (WCC->Policy[which].loaded == 0) LoadExpirePolicy(which); - /** expire policy settings */ - int sitepolicy = 0; - int sitevalue = 0; - int mboxpolicy = 0; - int mboxvalue = 0; + return WCC->Policy[which].expire_mode == CompareWith; +} - output_headers(1, 1, 2, 0, 0, 0); - wprintf("
\n"); +void tmplput_ExpireValue(StrBuf *Target, WCTemplputParams *TP) +{ + GPEXWhichPolicy which; + wcsession *WCC = WC; + + which = GetTemplateTokenNumber(Target, TP, 0, 0); + if (WCC->Policy[which].loaded == 0) LoadExpirePolicy(which); + StrBufAppendPrintf(Target, "%d", WCC->Policy[which].expire_value); +} - wprintf("");
-
- char *tabnames[] = {
- _("General"),
- _("Access"),
- _("Network"),
- _("Tuning"),
- _("Directory"),
- _("Auto-purger"),
- _("Indexing/Journaling"),
- _("Push Email"),
- _("Pop3 Fetching")
- };
-
- sprintf(general, "%s");
- wprintf("", _("Save changes"));
- wprintf(" ");
- wprintf("\n", _("Cancel"));
- wprintf(" \n");
- wprintf(" |