* Calendar events in the summary view are now clickable.
authorArt Cancro <ajc@citadel.org>
Wed, 7 Jan 2009 17:58:34 +0000 (17:58 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 7 Jan 2009 17:58:34 +0000 (17:58 +0000)
webcit/calendar_view.c
webcit/event.c
webcit/webcit.c
webcit/webcit.h
webcit/webserver.c

index 7b6518aec5c53014ff72f142ed824e3e7ed06513..7d13d99e8311f51c49f79e225a19fc0aeee6b51e 100644 (file)
@@ -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)<br />\n", timestring);
-                       }
+                               p = icalcomponent_get_first_property(Cal->cal, ICAL_SUMMARY_PROPERTY);
+                               if (p != NULL) {
+                                       wprintf("<a href=\"display_edit_event"
+                                               "?msgnum=%ld"
+                                               "?calview=summary"
+                                               "?year=%d"
+                                               "?month=%d"
+                                               "?day=%d"
+                                               "?gotofirst=_CALENDAR_"
+                                               "\">",
+                                               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)</a><br />\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;
index 9b05425bb8c4452e23e60128582b52206c85af70..fbc2614a39d745e17ad831146d5a3a97e2059393 100644 (file)
@@ -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);
+               }
        }
 }
index 7b53d08acdba01fad08cb16507906ebe69b2a147..a7069f14d5a8b30cf55d1abdfc218f1125fe84ab 100644 (file)
@@ -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! */
        }
 
        /*
index c1a589dd123ecb2ff9b114bda040085d562e7c06..1464bf583f5f8735811fa37c959b7a639a854569 100644 (file)
@@ -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);
 
index 50754dff40d86851eb17479d577f0de69bd03a11..4a32ae20a40e69661b57962e52b1210a88e89ad0 100644 (file)
@@ -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);
+       }
 }