From a57e3a30d46f55e142ca2c2c157f2d7acb7a8e94 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 16 Nov 2002 05:40:54 +0000 Subject: [PATCH] * When adding new events to the calendar, default to the month [and day] currently being viewed. * Hotlink each hour of the day view to an add-new-event for that day/hour. --- webcit/ChangeLog | 6 +++++- webcit/calendar_view.c | 23 +++++++++++++++++------ webcit/event.c | 23 +++++++++++++++++++++-- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 53c8a7533..74ccdba12 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,9 @@ $Log$ +Revision 400.52 2002/11/16 05:40:54 ajc +* When adding new events to the calendar, default to the month [and day] + currently being viewed. +* Hotlink each hour of the day view to an add-new-event for that day/hour. + Revision 400.51 2002/11/15 05:05:47 ajc * Put in back/forward (yesterday/tomorrow) links in calendar day view @@ -1121,4 +1126,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index ee3d5301b..56005f92c 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -145,9 +145,12 @@ void calendar_month_view(int year, int month, int day) { wprintf("" "\n"); + "\n", + year, month, day + ); wprintf("
" - " " + " " "Add new calendar event" - "

"); @@ -330,13 +333,17 @@ void calendar_day_view(int year, int month, int day) { wprintf("", tomorrow.year, tomorrow.month, tomorrow.day ); - wprintf("\n"); + wprintf("\n"); wprintf("

\n"); wprintf("
" - " " + " " "Add new calendar event" - "

\n"); + "

\n", + year, month, day + ); wprintf("" "Back to month view\n", year, month); @@ -360,7 +367,11 @@ void calendar_day_view(int year, int month, int day) { /* Now the middle of the day... */ for (hour = 8; hour <= 17; ++hour) { /* could do HEIGHT=xx */ wprintf("
"); - wprintf("%d:00%s ", + wprintf("", + year, month, day, hour + ); + wprintf("%d:00%s ", (hour <= 12 ? hour : hour-12), (hour < 12 ? "am" : "pm") ); diff --git a/webcit/event.c b/webcit/event.c index 7daf5ea34..50a6ed655 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -113,7 +113,19 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) } } else { - t_start = icaltime_from_timet(now, 0); + 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")); + if (strlen(bstr("hour")) > 0) { + t_start.hour = atoi(bstr("hour")); + t_start.minute = atoi(bstr("minute")); + } + else { + t_start.hour = 9; + t_start.minute = 0; + } + /* t_start = icaltime_from_timet(now, 0); */ } display_icaltimetype_as_webform(&t_start, "dtstart"); @@ -165,7 +177,14 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum) t_end = icalproperty_get_dtend(p); } else { - t_end = icaltime_from_timet(now, 0); + /* If this is not an all-day event and there is no + * end time specified, make the default one hour + * from the start time. + */ + t_end = t_start; + t_end.hour += 1; + t_end = icaltime_normalize(t_end); + /* t_end = icaltime_from_timet(now, 0); */ } } display_icaltimetype_as_webform(&t_end, "dtend"); -- 2.39.2