From 356b567abadc95d4b5bc2277de827a77378b2e06 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 25 Oct 2005 03:18:43 +0000 Subject: [PATCH] commit --- webcit/calendar_view.c | 14 +++++++-- webcit/preferences.c | 70 +++++++++++++++++++++++++++++++++++++++--- webcit/webcit.h | 1 + 3 files changed, 78 insertions(+), 7 deletions(-) diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index cd898dbae..64283d351 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -306,8 +306,16 @@ void calendar_day_view(int year, int month, int day) { int hour; struct icaltimetype today, yesterday, tomorrow; char calhourformat[16]; + int daystart = 8; + int dayend = 17; + char daystart_str[16], dayend_str[16]; get_preference("calhourformat", calhourformat, sizeof calhourformat); + get_preference("daystart", daystart_str, sizeof daystart_str); + if (strlen(daystart_str) > 0) daystart = atoi(daystart_str); + get_preference("dayend", dayend_str, sizeof dayend_str); + if (strlen(dayend_str) > 0) dayend = atoi(dayend_str); + /* Figure out the dates for "yesterday" and "tomorrow" links */ @@ -344,13 +352,13 @@ void calendar_day_view(int year, int month, int day) { wprintf("" "" ""); - for (hour = (-1); hour <= 7; ++hour) { + for (hour = (-1); hour <= (daystart-1); ++hour) { calendar_day_view_display_events(year, month, day, hour); } wprintf("\n"); /* Now the middle of the day... */ - for (hour = 8; hour <= 17; ++hour) { /* could do HEIGHT=xx */ + for (hour = daystart; hour <= dayend; ++hour) { /* could do HEIGHT=xx */ wprintf(""); wprintf("" "" ""); - for (hour = 18; hour <= 23; ++hour) { + for (hour = (dayend+1); hour <= 23; ++hour) { calendar_day_view_display_events(year, month, day, hour); } wprintf("\n"); diff --git a/webcit/preferences.c b/webcit/preferences.c index e832a772c..42eb04f96 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -176,6 +176,8 @@ void display_preferences(void) output_headers(1, 1, 2, 0, 0, 0); char ebuf[300]; char buf[256]; + char calhourformat[16]; + int i; wprintf("
\n"); wprintf("\n"); + /* + * Calendar day view -- day start time + */ + get_preference("daystart", buf, sizeof buf); + if (buf[0] == 0) strcpy(buf, "8"); + wprintf("\n"); + + /* + * Calendar day view -- day end time + */ + get_preference("dayend", buf, sizeof buf); + if (buf[0] == 0) strcpy(buf, "17"); + wprintf("\n"); + /* * Signature */ @@ -331,6 +391,8 @@ void set_preferences(void) set_preference("roomlistview", bstr("roomlistview"), 0); set_preference("calhourformat", bstr("calhourformat"), 0); set_preference("use_sig", bstr("use_sig"), 0); + set_preference("daystart", bstr("daystart"), 0); + set_preference("dayend", bstr("dayend"), 0); euid_escapize(ebuf, bstr("signature")); set_preference("signature", ebuf, 1); diff --git a/webcit/webcit.h b/webcit/webcit.h index 6d34fd968..5e4732b99 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -594,6 +594,7 @@ void begin_burst(void); void end_burst(void); extern char *ascmonths[]; +extern char *hourname[]; void http_datestring(char *buf, size_t n, time_t xtime); /* Views (from citadel.h) */ -- 2.39.2
"); @@ -222,26 +224,84 @@ void display_preferences(void) /* * Calendar hour format */ - get_preference("calhourformat", buf, sizeof buf); - if (buf[0] == 0) strcpy(buf, "12"); + get_preference("calhourformat", calhourformat, sizeof calhourformat); + if (calhourformat[0] == 0) strcpy(calhourformat, "12"); wprintf("
"); wprintf(_("Calendar hour format")); wprintf(""); wprintf(""); wprintf(_("12 hour (am/pm)")); wprintf("
\n"); wprintf(""); wprintf(_("24 hour")); wprintf("
\n"); wprintf("
"); + wprintf(_("Calendar day view begins at:")); + wprintf(""); + + wprintf("\n"); + wprintf("
"); + wprintf(_("Calendar day view ends at:")); + wprintf(""); + + wprintf("\n"); + wprintf("