Saving events from a web form now uses icaltime_from_timet_with_zone().
authorArt Cancro <ajc@citadel.org>
Thu, 20 Nov 2008 22:33:24 +0000 (22:33 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 20 Nov 2008 22:33:24 +0000 (22:33 +0000)
This did not have the effect that I thought it would.  It's converting to UTC, which results in the correct time being used, but I wanted the timezone to be attached as a parameter so a reader would convert
it on the fly.

webcit/calendar_tools.c
webcit/event.c

index a2d23b4fbc649b2e988181e5d4b6a1449beddf6a..cbcda4362dcbe266988f0d7c6de3a26130d795b9 100644 (file)
@@ -118,13 +118,13 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int d
 }
 
 /*
- * Get time from form
- * get the time back from the user and convert it into internal structs.
+ * Get date/time from a web form and convert it into an icaltimetype struct.
  */
 void icaltime_from_webform(struct icaltimetype *t, char *prefix) {
        char datebuf[32];
        char vname[32];
        struct tm tm;
+
        /* Stuff tm with some zero values */
        tm.tm_year = 0;
        tm.tm_sec = 0;
@@ -134,23 +134,33 @@ void icaltime_from_webform(struct icaltimetype *t, char *prefix) {
        tm.tm_mon = 0;
        int hour = 0;
        int minute = 0;
+
        struct icaltimetype t2;
        
-       
        strptime((char*)BSTR(prefix), "%Y-%m-%d", &tm);
        sprintf(vname, "%s_hour", prefix);      hour = IBSTR(vname);
        sprintf(vname, "%s_minute", prefix);    minute = IBSTR(vname);
        tm.tm_hour = hour;
        tm.tm_min = minute;
        strftime(&datebuf[0], 32, "%Y%m%dT%H%M%S", &tm);
-       t2 = icaltime_from_string(datebuf);
+
+       /* old
+        * t2 = icaltime_from_string(datebuf);
+        */
+
+       /* unavailable
+        * t2 = icaltime_from_string_with_zone(datebuf, get_default_icaltimezone() );
+        */
+
+       /* new */
+       t2 = icaltime_from_timet_with_zone(mktime(&tm), 0, get_default_icaltimezone());
+
        memcpy(t, &t2, sizeof(struct icaltimetype));
 }
 
 
 /*
- * Get time from form
- * get the time back from the user and convert it into internal structs.
+ * Get date (no time) from a web form and convert it into an icaltimetype struct.
  */
 void icaltime_from_webform_dateonly(struct icaltimetype *t, char *prefix) {
        struct tm tm;
index fb72422d0408ee9e0951a13e4051285d7c6833fa..f1af019dbb6afff84365517749c185359720bab4 100644 (file)
@@ -582,9 +582,6 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        int rrymweek = rrmweek;
        int rrymweekday = rrmweekday;
        int rrymonth = t_start.month;
-
-       lprintf(9, "FIXME: RRYMWEEK %d, RRYMWEEKDAY %d, RRYMONTH %d\n", rrymweek, rrymweekday, rrymonth);
-
        int which_rryeartype_is_preselected = 0;
 
        if ( (recur.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX)