X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fevent.c;h=d786998ab8ef818c0d5bebf7e15b291c1b04b7e1;hb=HEAD;hp=bb10286534fd4225a4747d6205cfa222b99108ba;hpb=0b2acc9837583fdd53f13e0f31bd61b9effafb5a;p=citadel.git diff --git a/webcit/event.c b/webcit/event.c index bb1028653..ffe0688ab 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -1,11 +1,20 @@ /* - * $Id$ - * * Editing calendar events. + * + * Copyright (c) 2002-2012 by the citadel.org team + * + * This program is open source software. You can redistribute it and/or + * modify it under the terms of the GNU General Public License, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. */ #include "webcit.h" -#include "webserver.h" + +#include "calendar.h" /* * Display an event by itself (for editing) @@ -13,8 +22,9 @@ * msgnum reference on the citserver */ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, - int unread, struct calview *calv) + int unread, calview *calv) { + wcsession *WCC = WC; icalcomponent *vevent; icalproperty *p; icalvalue *v; @@ -29,14 +39,61 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char buf[SIZ]; int organizer_is_me = 0; int i, j = 0; + /************************************************************ + * Uncomment this to see the UID in calendar events for debugging int sequence = 0; + */ char weekday_labels[7][32]; + char month_labels[12][32]; long weekstart = 0; + icalproperty *rrule = NULL; + struct icalrecurrencetype recur; + char weekday_is_selected[7]; + int which_rrmonthtype_is_preselected = 0; + + int rrmday; + int rrmweekday; + + icaltimetype day1; + int weekbase; + int rrmweek; + int rrymweek; + int rrymweekday; + int rrymonth; + int which_rrend_is_preselected; + int which_rryeartype_is_preselected; + + const char *ch; + const char *tabnames[3]; + const char *frequency_units[8]; + const char *ordinals[6]; + + frequency_units[0] = _("seconds"); + frequency_units[1] = _("minutes"); + frequency_units[2] = _("hours"); + frequency_units[3] = _("days"); + frequency_units[4] = _("weeks"); + frequency_units[5] = _("months"); + frequency_units[6] = _("years"); + frequency_units[7] = _("never"); + + + ordinals[0] = "0"; + ordinals[1] = _("first"); + ordinals[2] = _("second"); + ordinals[3] = _("third"); + ordinals[4] = _("fourth"); + ordinals[5] = _("fifth"); + + + tabnames[0] = _("Event"); + tabnames[1] = _("Attendees"); + tabnames[2] = _("Recurrence"); get_pref_long("weekstart", &weekstart, 17); if (weekstart > 6) weekstart = 0; - lprintf(9, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n", + syslog(LOG_DEBUG, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n", msgnum, bstr("calview"), bstr("year"), bstr("month"), bstr("day") ); @@ -54,12 +111,26 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, } /* populate the weekday names - end */ + /* populate the month names - begin */ + now = 259200L; /* 1970-jan-04 is the first Sunday ever */ + localtime_r(&now, &tm_now); + for (i=0; i<12; ++i) { + localtime_r(&now, &tm_now); + wc_strftime(month_labels[i], 32, "%B", &tm_now); + now += 2678400L; + } + /* populate the month names - end */ + now = time(NULL); strcpy(organizer_string, ""); strcpy(attendee_string, ""); if (supplied_vevent != NULL) { vevent = supplied_vevent; + + /* Convert all timestamps to UTC to make them easier to process. */ + ical_dezonify(vevent); + /* * If we're looking at a fully encapsulated VCALENDAR * rather than a VEVENT component, attempt to use the first @@ -84,84 +155,83 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, /* Learn the sequence */ p = icalcomponent_get_first_property(vevent, ICAL_SEQUENCE_PROPERTY); + /************************************************************ + * Uncomment this to see the UID in calendar events for debugging if (p != NULL) { sequence = icalproperty_get_sequence(p); } - + */ /* Begin output */ - output_headers(1, 1, 2, 0, 0, 0); - wprintf("
\n"); + output_headers(1, 1, 1, 0, 0, 0); + wc_printf(" \n"); - wprintf("