* migrate the WHO struct to strbuf
[citadel.git] / webcit / siteconfig.c
index 5a2ee2e6f4f780db460788e1d6513f24fe9ad12c..25e8ae034235c5afbb39b4d7581cba35bb892b4d 100644 (file)
@@ -8,6 +8,39 @@
 #include "webcit.h"
 #include "webserver.h"
 
+
+HashList *ZoneHash = NULL;
+
+
+
+void LoadZoneFiles(void)
+{
+       icalarray *zones;
+       int z;
+       long len;
+       char this_zone[128];
+       char *ZName;
+       HashPos  *it;
+
+       ZoneHash = NewHash(1, NULL);
+       len = sizeof("UTC") + 1;
+       ZName = malloc(len + 1);
+       memcpy(ZName, "UTC", len + 1);
+       Put(ZoneHash, ZName, len, ZName, NULL);
+       zones = icaltimezone_get_builtin_timezones();
+       for (z = 0; z < zones->num_elements; ++z) {
+               strcpy(this_zone, icaltimezone_get_location(icalarray_element_at(zones, z)));
+               len = strlen(this_zone);
+               ZName = (char*)malloc(len +1);
+               memcpy(ZName, this_zone, len + 1);
+               Put(ZoneHash, ZName, len, ZName, NULL);
+       }
+       SortByHashKey(ZoneHash, 0);
+}
+
+
+
+
 /*
  * \brief display all configuration items
  */
@@ -15,6 +48,8 @@ void display_siteconfig(void)
 {
        char buf[SIZ];
        int i, j;
+       struct wcsession *WCC = WC;
+       const char *VCZname;
 
        char general[65536];
        char access[SIZ];
@@ -113,7 +148,7 @@ void display_siteconfig(void)
                );
                
        wprintf("<form method=\"post\" action=\"siteconfig\">\n");
-       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WCC->nonce);
        
        sprintf(&general[strlen(general)], "<tr><td><a href=\"display_edithello\"> %s </a></td>",           _("Change Login Logo"));
        sprintf(&general[strlen(general)],     "<td><a href=\"display_editgoodbuye\"> %s </a></td></tr>\n", _("Change Logout Logo"));
@@ -520,7 +555,7 @@ void display_siteconfig(void)
                        }
                        SortByHashKey(List, 0);
                        it = GetNewHashPos();
-                       while (GetNextHashPos(List, it, &len, &ZName, &ZNamee)) {
+                       while (GetNextHashPos(List, it, &len, &VCZname, &ZNamee)) {
                                sprintf(&general[strlen(general)], "<option %s value=\"%s\">%s</option>\n",
                                        (!strcasecmp((char*)ZName, buf) ? "selected" : ""),
                                        ZName, ZName
@@ -729,15 +764,15 @@ void display_siteconfig(void)
 
        tabbed_dialog(9, tabnames);
 
-       begin_tab(0, 9);        client_write(general, strlen(general));          end_tab(0, 9);
-       begin_tab(1, 9);        client_write(access, strlen(access));            end_tab(1, 9);
-       begin_tab(2, 9);        client_write(network, strlen(network));          end_tab(2, 9);
-       begin_tab(3, 9);        client_write(tuning, strlen(tuning));            end_tab(3, 9);
-       begin_tab(4, 9);        client_write(directory, strlen(directory));      end_tab(4, 9);
-       begin_tab(5, 9);        client_write(purger, strlen(purger));            end_tab(5, 9);
-       begin_tab(6, 9);        client_write(idxjnl, strlen(idxjnl));            end_tab(6, 9);
-       begin_tab(7, 9);        client_write(funambol, strlen(funambol));        end_tab(7, 9);
-       begin_tab(8, 9);        client_write(pop3, strlen(pop3));                end_tab(8, 9);
+       begin_tab(0, 9);        StrBufAppendBufPlain(WCC->WBuf, general, strlen(general), 0);            end_tab(0, 9);
+       begin_tab(1, 9);        StrBufAppendBufPlain(WCC->WBuf, access, strlen(access), 0);              end_tab(1, 9);
+       begin_tab(2, 9);        StrBufAppendBufPlain(WCC->WBuf, network, strlen(network), 0);            end_tab(2, 9);
+       begin_tab(3, 9);        StrBufAppendBufPlain(WCC->WBuf, tuning, strlen(tuning), 0);              end_tab(3, 9);
+       begin_tab(4, 9);        StrBufAppendBufPlain(WCC->WBuf, directory, strlen(directory), 0);        end_tab(4, 9);
+       begin_tab(5, 9);        StrBufAppendBufPlain(WCC->WBuf, purger, strlen(purger), 0);              end_tab(5, 9);
+       begin_tab(6, 9);        StrBufAppendBufPlain(WCC->WBuf, idxjnl, strlen(idxjnl), 0);              end_tab(6, 9);
+       begin_tab(7, 9);        StrBufAppendBufPlain(WCC->WBuf, funambol, strlen(funambol), 0);  end_tab(7, 9);
+       begin_tab(8, 9);        StrBufAppendBufPlain(WCC->WBuf, pop3, strlen(pop3), 0);          end_tab(8, 9);
        wprintf("<div class=\"tabcontent_submit\">");
        wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
        wprintf("&nbsp;");