X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fevent.c;h=61f664da9ca6699899f5be96de5c7e8437c2a761;hb=a756685375373a04dcfa4b6be45a0acd7f4be23b;hp=2ac6982591258ab1e317d4a913d6c467c505e501;hpb=344d7a7ba9543b03b975fc822bf98aed1d2e8a63;p=citadel.git diff --git a/webcit/event.c b/webcit/event.c index 2ac698259..61f664da9 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -2,17 +2,36 @@ * $Id$ * * Editing calendar events. + * + * Copyright (c) 1996-2010 by the citadel.org team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "webcit.h" #include "webserver.h" +#include "calendar.h" /* * Display an event by itself (for editing) * supplied_vevent the event to edit * msgnum reference on the citserver */ -void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, int unread) { +void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, + int unread, calview *calv) +{ icalcomponent *vevent; icalproperty *p; icalvalue *v; @@ -29,6 +48,54 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, int i, j = 0; 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; + + + 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", msgnum, bstr("calview"), bstr("year"), bstr("month"), bstr("day") @@ -48,12 +115,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 @@ -66,7 +147,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, display_edit_individual_event( icalcomponent_get_first_component( vevent, ICAL_VEVENT_COMPONENT), - msgnum, from, unread + msgnum, from, unread, NULL ); return; } @@ -84,78 +165,73 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, /* Begin output */ output_headers(1, 1, 2, 0, 0, 0); - wprintf("
\n"); + wc_printf(" \n"); - wprintf("