]> code.citadel.org Git - citadel.git/blobdiff - webcit/calendar_tools.c
Removed monthname() and replaced with proper strftime() calls.
[citadel.git] / webcit / calendar_tools.c
index be8e16f98f45f4dc66c02e5f520230d6a0778713..d62cb8296907e4f39606297176ea92b3350e4675 100644 (file)
@@ -3,39 +3,12 @@
  */
 /**
  * \defgroup MiscCal Miscellaneous functions which handle calendar components.
+ * \ingroup Calendaring
  */
 /*@{*/
 #include "webcit.h"
 #include "webserver.h"
 
-/* \todo FIXME ... this needs to be internationalized */
-/** Month Strings. */
-char *months[] = { 
-       "January",
-       "February",
-       "March",
-       "April",
-       "May",
-       "June",
-       "July",
-       "August",
-       "September",
-       "October",
-       "November",
-       "December"
-};
-
-/** Day Strings */
-char *days[] = { 
-       "Sunday",
-       "Monday",
-       "Tuesday",
-       "Wednesday",
-       "Thursday",
-       "Friday",
-       "Saturday"
-};
-
 /** Hour strings */
 char *hourname[] = {
        "12am", "1am", "2am", "3am", "4am", "5am", "6am",
@@ -76,6 +49,9 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
        struct tm tm;
        const int span = 10;
        int all_day_event = 0;
+       time_t monthselect_time;
+       struct tm monthselect_tm;
+       char monthselect_str[32];
        char calhourformat[16];
 
        get_preference("calhourformat", calhourformat, sizeof calhourformat);
@@ -97,10 +73,13 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
        wprintf(_("Month: "));
        wprintf("<SELECT NAME=\"%s_month\" SIZE=\"1\">\n", prefix);
        for (i=0; i<=11; ++i) {
+               monthselect_time = 1137997451 + (i * 2592000);
+               localtime_r(&monthselect_time, &monthselect_tm);
+               wc_strftime(monthselect_str, sizeof monthselect_str, "%B", &monthselect_tm);
                wprintf("<OPTION %s VALUE=\"%d\">%s</OPTION>\n",
                        ((tm.tm_mon == i) ? "SELECTED" : ""),
                        i+1,
-                       months[i]
+                       monthselect_str
                );
        }
        wprintf("</SELECT>\n");