From 7ca836c2017c56ca8dfc19707ff9780485c557a6 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 7 Jan 2009 17:58:34 +0000 Subject: [PATCH] * Calendar events in the summary view are now clickable. --- webcit/calendar_view.c | 37 ++++++++++++++++++++++++------------- webcit/event.c | 9 +++++++-- webcit/webcit.c | 2 +- webcit/webcit.h | 4 +++- webcit/webserver.c | 3 ++- 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index 7b6518aec..7d13d99e8 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -1269,8 +1269,7 @@ void calendar_summary_view(void) { Pos = GetNewHashPos(WCC->disp_cal_items, 0); while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) { Cal = (disp_cal*)vCal; - p = icalcomponent_get_first_property(Cal->cal, - ICAL_DTSTART_PROPERTY); + p = icalcomponent_get_first_property(Cal->cal, ICAL_DTSTART_PROPERTY); if (p != NULL) { t = icalproperty_get_dtstart(p); event_tt = icaltime_as_timet(t); @@ -1291,18 +1290,27 @@ void calendar_summary_view(void) { if ( (event_tm.tm_year == today_tm.tm_year) && (event_tm.tm_mon == today_tm.tm_mon) - && (event_tm.tm_mday == today_tm.tm_mday) + && (event_tm.tm_mday == today_tm.tm_mday) ) { - - p = icalcomponent_get_first_property( - Cal->cal, - ICAL_SUMMARY_PROPERTY); - if (p != NULL) { - escputs((char *) - icalproperty_get_comment(p)); - wprintf(" (%s)
\n", timestring); - } + p = icalcomponent_get_first_property(Cal->cal, ICAL_SUMMARY_PROPERTY); + if (p != NULL) { + wprintf("", + Cal->cal_msgnum, + today_tm.tm_year + 1900, + today_tm.tm_mon + 1, + today_tm.tm_mday + ); + escputs((char *) icalproperty_get_comment(p)); + wprintf(" (%s)
\n", timestring); + } } } } @@ -1310,7 +1318,6 @@ void calendar_summary_view(void) { DeleteHash(&WC->disp_cal_items); } - /* * Parse the URL variables in order to determine the scope and display of a calendar view */ @@ -1347,6 +1354,9 @@ void parse_calendar_view_request(struct calview *c) { else if (!strcasecmp(calview, "week")) { c->view = calview_week; } + else if (!strcasecmp(calview, "summary")) { /* shouldn't ever happen, but just in case */ + c->view = calview_day; + } else { if (WC->wc_view == VIEW_CALBRIEF) { c->view = calview_brief; @@ -1369,6 +1379,7 @@ void parse_calendar_view_request(struct calview *c) { if (c->view == calview_brief) span = 3888000; if (c->view == calview_week) span = 604800; if (c->view == calview_day) span = 86400; + if (c->view == calview_summary) span = 86400; c->lower_bound = now - span; c->upper_bound = now + span; diff --git a/webcit/event.c b/webcit/event.c index 9b05425bb..fbc2614a3 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -1145,8 +1145,13 @@ STARTOVER: for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDE icalcomponent_free(vevent); } - /* If this was a save or delete, go back to the calendar view. */ + /* If this was a save or delete, go back to the calendar or summary view. */ if (!havebstr("check_button")) { - readloop(readfwd); + if (!strcasecmp(bstr("calview"), "summary")) { + summary(); + } + else { + readloop(readfwd); + } } } diff --git a/webcit/webcit.c b/webcit/webcit.c index 7b53d08ac..a7069f14d 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -930,7 +930,7 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method * prior to doing anything else. */ if (havebstr("gotofirst")) { - smart_goto(bstr("gotofirst")); + gotoroom(bstr("gotofirst")); /* do this quietly to avoid session output! */ } /* diff --git a/webcit/webcit.h b/webcit/webcit.h index c1a589dd1..1464bf583 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -424,7 +424,8 @@ enum { calview_month, calview_day, calview_week, - calview_brief + calview_brief, + calview_summary }; struct calview { @@ -684,6 +685,7 @@ const char *get_selected_language(void); void webcit_fmt_date(char *buf, time_t thetime, int brief); int fetch_http(char *url, char *target_buf, int maxbytes); void free_attachments(wcsession *sess); +void summary(void); int is_mobile_ua(char *user_agent); diff --git a/webcit/webserver.c b/webcit/webserver.c index 50754dff4..4a32ae20a 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -253,8 +253,9 @@ int client_read_to(int *sock, StrBuf *Target, StrBuf *Buf, int bytes, int timeou */ void begin_burst(void) { - if (WC->WBuf == NULL) + if (WC->WBuf == NULL) { WC->WBuf = NewStrBufPlain(NULL, 32768); + } } -- 2.30.2