X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fevent.c;h=d786998ab8ef818c0d5bebf7e15b291c1b04b7e1;hb=HEAD;hp=c505b10bc7b3ff1b99d1cf3209f6be36a15fce5f;hpb=c6aec42f213ec284e34648f3d69bcf927dccddb1;p=citadel.git diff --git a/webcit/event.c b/webcit/event.c index c505b10bc..ffe0688ab 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -1,8 +1,7 @@ - /* * Editing calendar events. * - * Copyright (c) 1996-2012 by the citadel.org team + * 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. @@ -14,7 +13,7 @@ */ #include "webcit.h" -#include "webserver.h" + #include "calendar.h" /* @@ -22,7 +21,9 @@ * 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, calview * calv) { +void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, + int unread, calview *calv) +{ wcsession *WCC = WC; icalcomponent *vevent; icalproperty *p; @@ -38,7 +39,6 @@ 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; @@ -91,12 +91,11 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, tabnames[2] = _("Recurrence"); get_pref_long("weekstart", &weekstart, 17); - if (weekstart > 6) - weekstart = 0; + if (weekstart > 6) weekstart = 0; 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") - ); + msgnum, bstr("calview"), bstr("year"), bstr("month"), bstr("day") + ); /* populate the weekday names - begin */ now = time(NULL); @@ -105,7 +104,7 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, now -= 86400L; localtime_r(&now, &tm_now); } - for (i = 0; i < 7; ++i) { + for (i=0; i<7; ++i) { localtime_r(&now, &tm_now); wc_strftime(weekday_labels[i], 32, "%A", &tm_now); now += 86400L; @@ -113,9 +112,9 @@ 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 */ + now = 259200L; /* 1970-jan-04 is the first Sunday ever */ localtime_r(&now, &tm_now); - for (i = 0; i < 12; ++i) { + for (i=0; i<12; ++i) { localtime_r(&now, &tm_now); wc_strftime(month_labels[i], 32, "%B", &tm_now); now += 2678400L; @@ -141,8 +140,11 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, * new one. */ if (icalcomponent_isa(vevent) == ICAL_VCALENDAR_COMPONENT) { - display_edit_individual_event(icalcomponent_get_first_component(vevent, ICAL_VEVENT_COMPONENT), - msgnum, from, unread, NULL); + display_edit_individual_event( + icalcomponent_get_first_component( + vevent, ICAL_VEVENT_COMPONENT), + msgnum, from, unread, NULL + ); return; } } @@ -153,7 +155,6 @@ 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) { @@ -188,11 +189,16 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, StrEscAppend(WCC->WBuf, WCC->CurRoom.name, NULL, 0, 0); wc_printf("\">\n"); - wc_printf("\n", msgnum); - wc_printf("\n", bstr("calview")); - wc_printf("\n", bstr("year")); - wc_printf("\n", bstr("month")); - wc_printf("\n", bstr("day")); + wc_printf("\n", + msgnum); + wc_printf("\n", + bstr("calview")); + wc_printf("\n", + bstr("year")); + wc_printf("\n", + bstr("month")); + wc_printf("\n", + bstr("day")); tabbed_dialog(3, tabnames); @@ -203,19 +209,23 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, wc_printf(""); wc_printf(_("Summary")); - wc_printf("\n" "\n" + "\n"); wc_printf(""); wc_printf(_("Location")); - wc_printf("\n" "\n" + "\n"); @@ -249,23 +259,28 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, tm_now.tm_sec = 0; } - t_start = icaltime_from_timet_with_zone(mktime(&tm_now), - ((yesbstr("alldayevent")) ? 1 : 0), icaltimezone_get_utc_timezone() - ); + t_start = icaltime_from_timet_with_zone( + mktime(&tm_now), + ((yesbstr("alldayevent")) ? 1 : 0), + icaltimezone_get_utc_timezone() + ); } display_icaltimetype_as_webform(&t_start, "dtstart", 0); wc_printf("%s", (t_start.is_date ? "checked=\"checked\"" : ""), _("All day event") - ); + "value=\"yes\" onclick=\"eventEditAllDay();\"" + " %s >%s", + (t_start.is_date ? "checked=\"checked\"" : "" ), + _("All day event") + ); wc_printf("\n"); wc_printf(""); wc_printf(_("End")); wc_printf("\n"); - p = icalcomponent_get_first_property(vevent, ICAL_DTEND_PROPERTY); + p = icalcomponent_get_first_property(vevent, + ICAL_DTEND_PROPERTY); if (p != NULL) { t_end = icalproperty_get_dtend(p); @@ -313,10 +328,13 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, wc_printf(""); wc_printf(_("Notes")); - wc_printf("\n" ""); @@ -325,10 +343,11 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, * organizer. Set this field accordingly. */ if (icalcomponent_get_first_property(vevent, ICAL_ORGANIZER_PROPERTY) - == NULL) { + == NULL) { sprintf(organizer_string, "mailto:%s", ChrPtr(WC->cs_inet_email)); - icalcomponent_add_property(vevent, icalproperty_new_organizer(organizer_string) - ); + icalcomponent_add_property(vevent, + icalproperty_new_organizer(organizer_string) + ); } /* @@ -340,7 +359,7 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, strcpy(organizer_string, icalproperty_get_organizer(organizer)); if (!strncasecmp(organizer_string, "mailto:", 7)) { strcpy(organizer_string, &organizer_string[7]); - striplt(organizer_string); + string_trim(organizer_string); serv_printf("ISME %s", organizer_string); serv_getln(buf, sizeof buf); if (buf[0] == '2') { @@ -419,35 +438,40 @@ void display_edit_individual_event(icalcomponent * supplied_vevent, long msgnum, wc_printf("\n"); /* same table style as the event tab */ wc_printf("
"); wc_printf(_("Attendees")); - wc_printf("
" ""); + wc_printf("
" + ""); wc_printf(_("(One per line)")); wc_printf("\n"); /* Pop open an address book -- begin */ - wc_printf(" " - "" - "", _("Attendees"), _("Contacts") - ); + wc_printf( + " " + "" + "", + _("Attendees"), + _("Contacts") + ); /* Pop open an address book -- end */ wc_printf("
" - "