]> code.citadel.org Git - citadel.git/blobdiff - webcit/calendar_tools.c
* Added a "preferences and settings" screen for each user.
[citadel.git] / webcit / calendar_tools.c
index b36497a98c3f86943398931a76dbfeb3d3b7a572..d67ffd1d41017e840d212734043c268fae7fe05e 100644 (file)
@@ -72,6 +72,9 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
        struct tm tm;
        const int span = 10;
        int all_day_event = 0;
+       char calhourformat[16];
+
+       get_preference("calhourformat", calhourformat, sizeof calhourformat);
 
        now = time(NULL);
        localtime_r(&now, &tm_now);
@@ -129,10 +132,20 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
        wprintf("Hour: ");
        wprintf("<SELECT NAME=\"%s_hour\" SIZE=\"1\">\n", prefix);
        for (i=0; i<=23; ++i) {
-               wprintf("<OPTION %s VALUE=\"%d\">%s</OPTION>\n",
-                       ((tm.tm_hour == i) ? "SELECTED" : ""),
-                       i, hourname[i]
-               );
+
+               if (!strcasecmp(calhourformat, "24")) {
+                       wprintf("<OPTION %s VALUE=\"%d\">%d</OPTION>\n",
+                               ((tm.tm_hour == i) ? "SELECTED" : ""),
+                               i, i
+                       );
+               }
+               else {
+                       wprintf("<OPTION %s VALUE=\"%d\">%s</OPTION>\n",
+                               ((tm.tm_hour == i) ? "SELECTED" : ""),
+                               i, hourname[i]
+                       );
+               }
+
        }
        wprintf("</SELECT>\n");