]> code.citadel.org Git - citadel.git/blobdiff - webcit/calendar_tools.c
* minor cleanup
[citadel.git] / webcit / calendar_tools.c
index 77f478ee4ee926b4d536a7c3913a33d0e6020a6b..49fbcb7642310420283712fec97cf6b07b1bf691 100644 (file)
 #include "webcit.h"
 #include "webserver.h"
 
-#ifdef HAVE_ICAL_H
-
 char *months[] = {
        "January", "February", "March", "April", "May", "June", "July",
        "August", "September", "October", "November", "December"
 };
 
+char *days[] = {
+       "Sunday", "Monday", "Tuesday", "Wednesday",
+       "Thursday", "Friday", "Saturday"
+};
+
+#ifdef HAVE_ICAL_H
+
+
 void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
        int i;
        time_t now;
@@ -105,6 +111,10 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
        }
        wprintf("</SELECT>\n");
 
+       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"%s_alldayevent\" "
+               "VALUE=\"yes\" %s> All day event",
+               prefix,
+               ((t->is_date) ? "CHECKED" : ""));
 }
 
 
@@ -122,11 +132,29 @@ struct icaltimetype icaltime_from_webform(char *prefix) {
        sprintf(vname, "%s_hour", prefix);      t.hour = atoi(bstr(vname));
        sprintf(vname, "%s_minute", prefix);    t.minute = atoi(bstr(vname));
 
+       sprintf(vname, "%s_alldayevent", prefix);
+       if (!strcasecmp(bstr(vname), "yes")) {
+               t.hour = 0;
+               t.minute = 0;
+               t.is_date = 1;
+       }
+
        t = icaltime_normalize(t);
        return(t);
 }
 
 
+/*
+ * Generae a new, globally unique UID parameter for a calendar object.
+ */
+void generate_new_uid(char *buf) {
+       static int seq = 0;
+
+       sprintf(buf, "%ld-%d@%s",
+               (long)time(NULL),
+               (seq++),
+               serv_info.serv_fqdn);
+}
 
 
 #endif