From 2826cbf89304c5ea95df4fb565cc559a4db65e85 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 7 Jan 2003 04:56:17 +0000 Subject: [PATCH] * Complete the free/busy transparency handling in the form * Default times for new events are now in the correct timezone --- webcit/ChangeLog | 5 +++- webcit/event.c | 68 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index ded8bde69..f082fac44 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,8 @@ $Log$ +Revision 400.80 2003/01/07 04:56:17 ajc +* Complete the free/busy transparency handling in the form +* Default times for new events are now in the correct timezone + Revision 400.79 2003/01/06 18:01:35 ajc * Begin handling of TRANSP property to show event times as free or busy (not finished). @@ -1227,4 +1231,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/event.c b/webcit/event.c index 7c1b38431..52aa8a12f 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -36,8 +36,10 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) { icalcomponent *vevent; icalproperty *p; + icalvalue *v; struct icaltimetype t_start, t_end; time_t now; + struct tm tm_now; int created_new_vevent = 0; icalproperty *organizer = NULL; char organizer_string[SIZ]; @@ -131,20 +133,28 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) } } else { - memset(&t_start, 0, sizeof t_start); - t_start.year = atoi(bstr("year")); - t_start.month = atoi(bstr("month")); - t_start.day = atoi(bstr("day")); + memcpy(&tm_now, localtime(&now), sizeof(struct tm)); + tm_now.tm_year = atoi(bstr("year")) - 1900; + tm_now.tm_mon = atoi(bstr("month")) - 1; + tm_now.tm_mday = atoi(bstr("day")); if (strlen(bstr("hour")) > 0) { - t_start.hour = atoi(bstr("hour")); - t_start.minute = atoi(bstr("minute")); - t_start.second = 0; + tm_now.tm_hour = atoi(bstr("hour")); + tm_now.tm_min = atoi(bstr("minute")); + tm_now.tm_sec = 0; } else { - t_start.hour = 9; - t_start.minute = 0; - t_start.second = 0; + tm_now.tm_hour = 9; + tm_now.tm_min = 0; + tm_now.tm_sec = 0; } + + t_start = icaltime_from_timet_with_zone( + mktime(&tm_now), + ((!strcasecmp(bstr("alldayevent"), "yes")) ? 1 : 0), + icaltimezone_get_utc_timezone + ); + t_start.is_utc = 1; + } display_icaltimetype_as_webform(&t_start, "dtstart"); @@ -281,13 +291,21 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) icalcomponent_add_property(vevent, p); } } + if (p != NULL) { + v = icalproperty_get_value(p); + } + else { + v = NULL; + } wprintf("Free  "); wprintf("Busy"); wprintf("\n"); @@ -384,6 +402,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { char form_attendees[SIZ]; char organizer_string[SIZ]; int sequence = 0; + enum icalproperty_transp formtransp = ICAL_TRANSP_NONE; if (supplied_vevent != NULL) { vevent = supplied_vevent; @@ -460,8 +479,6 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { if (prop) icalcomponent_add_property(vevent, prop); else icalproperty_free(prop); - - while (prop = icalcomponent_get_first_property(vevent, ICAL_DTEND_PROPERTY), prop != NULL) { icalcomponent_remove_property(vevent, prop); @@ -481,6 +498,29 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { ); } + /* See if transparency is indicated */ + if (strlen(bstr("transp")) > 0) { + lprintf(9, "FORM VALUE: <%s>\n", bstr("transp")); + if (!strcasecmp(bstr("transp"), "opaque")) { + formtransp = ICAL_TRANSP_OPAQUE; + lprintf(9, "setting to opaque\n"); + } + else if (!strcasecmp(bstr("transp"), "transparent")) { + formtransp = ICAL_TRANSP_TRANSPARENT; + lprintf(9, "setting to transparent\n"); + } + + while (prop = icalcomponent_get_first_property(vevent, ICAL_TRANSP_PROPERTY), + (prop != NULL)) { + lprintf(9, "removing existing property\n"); + icalcomponent_remove_property(vevent, prop); + icalproperty_free(prop); + } + + lprintf(9, "adding new property\n"); + icalcomponent_add_property(vevent, icalproperty_new_transp(formtransp)); + } + /* Give this event a UID if it doesn't have one. */ if (icalcomponent_get_first_property(vevent, ICAL_UID_PROPERTY) == NULL) { -- 2.39.2