]> code.citadel.org Git - citadel.git/blobdiff - webcit/calendar_view.c
* collect sender / read / unread information for calendar items
[citadel.git] / webcit / calendar_view.c
index dc21950582269ddb3ba55ee9bd355bc0f57cc17c..699d83e73835d5099a9fc7c88aec0924af37f9fc 100644 (file)
@@ -259,17 +259,16 @@ void calendar_month_view_display_events(int year, int month, int day)
                                }
 
                                wprintf("<font size=-1>"
-                                       "<a href=\"display_edit_event?"
-                                       "msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\""
+                                       "<a class=\"event%s\" href=\"display_edit_event?"
+                                       "msgnum=%ld&calview=month&year=%d&month=%d&day=%d\""
                                        " btt_tooltext=\"",
+                                       (Cal->unread)?"_unread":"_read",
                                        WC->disp_cal[i].cal_msgnum,
-                                       bstr("calview"),
-                                       bstr("year"),
-                                       bstr("month"),
-                                       bstr("day")
-                                       );
+                                       year, month, day
+                               );
 
-                               wprintf("<i>%s</i> ", _("Summary:"));
+                               wprintf("<i>%s: %s</i><br />", _("From"), Cal->from);
+                               wprintf("<i>%s</i> ",          _("Summary:"));
                                escputs((char *)icalproperty_get_comment(p));
                                wprintf("<br />");
                                
@@ -305,7 +304,7 @@ void calendar_month_view_display_events(int year, int month, int day)
                                                }
                                                else {
                                                        tt = icaltime_as_timet(t);
-                                                       fmt_date(buf, tt, 1);
+                                                       webcit_fmt_date(buf, tt, 1);
                                                        wprintf("<i>%s</i> %s<br>",
                                                                _("Starting date/time:"), buf);
                                                        
@@ -316,7 +315,7 @@ void calendar_month_view_display_events(int year, int month, int day)
                                                        if (q != NULL) {
                                                                t = icalproperty_get_dtend(q);
                                                                tt = icaltime_as_timet(t);
-                                                               fmt_date(buf, tt, 1);
+                                                               webcit_fmt_date(buf, tt, 1);
                                                                wprintf("<i>%s</i> %s<br>", _("Ending date/time:"), buf);
                                                        }
                                                        
@@ -359,12 +358,14 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
        time_t event_tt;
        time_t event_tts;
        time_t event_tte;
+       struct wcsession *WCC = WC;     /* This is done to make it run faster; WC is a function */
        struct tm event_tms;
        struct tm event_tme;
        struct tm today_tm;
        icalproperty *p;
        icalproperty *e;
        struct icaltimetype t;
+       struct disp_cal *Cal;
        int month, day, year;
        int all_day_event = 0;
        char *timeformat;
@@ -381,7 +382,8 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
        year = today_tm.tm_year + 1900;
 
        for (i=0; i<(WC->num_cal); ++i) {
-               p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
+               Cal = &WCC->disp_cal[i];
+               p = icalcomponent_get_first_property(Cal->cal,
                                                ICAL_DTSTART_PROPERTY);
                if (p != NULL) {
                        t = icalproperty_get_dtstart(p);
@@ -421,17 +423,17 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
                                        hours=(int)(difftime / 60);
                                        minutes=difftime % 60;
                                        wprintf("<tr><td bgcolor='%s'>%i:%2i</td><td bgcolor='%s'>"
-                                                       "<font size=-1>"
-                                                       "<a href=\"display_edit_event?msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\">",
-                                                       daycolor,
-                                                       hours, minutes,
-                                                       daycolor,
-                                                       WC->disp_cal[i].cal_msgnum,
-                                                       bstr("calview"),
-                                                       bstr("year"),
-                                                       bstr("month"),
-                                                       bstr("day")
-                                                       );
+                                               "<font size=-1>"
+                                               "<a class=\"event%s\" href=\"display_edit_event?msgnum=%ld&calview=calbrief&year=%s&month=%s&day=%s\">",
+                                               daycolor,
+                                               hours, minutes,
+                                               (Cal->unread)?"_unread":"_read",                                                
+                                               daycolor,
+                                               WC->disp_cal[i].cal_msgnum,
+                                               bstr("year"),
+                                               bstr("month"),
+                                               bstr("day")
+                                               );
 
                                        escputs((char *)
                                                        icalproperty_get_comment(p));
@@ -543,7 +545,7 @@ void calendar_month_view(int year, int month, int day) {
                colheader_time = thetime + (i * 86400) ;
                localtime_r(&colheader_time, &colheader_tm);
                wc_strftime(colheader_label, sizeof colheader_label, "%A", &colheader_tm);
-               wprintf("<td align=center width=14%%>"
+               wprintf("<th align=center width=14%%>"
                        "<font color=\"#FFFFFF\">%s</font></th>", colheader_label);
 
        }
@@ -884,14 +886,16 @@ void calendar_day_view_display_events(time_t thetime,
 
                        if (all_day_event && notime_events)
                        {
-                              wprintf("<li class=\"event\"> "
+                              wprintf("<li class=\"event_framed%s\"> "
                                 "<a href=\"display_edit_event?"
                                 "msgnum=%ld&calview=day&year=%d&month=%d&day=%d\" "
                                 " class=\"event_title\" "
                                 " btt_tooltext=\"",
+                                     (Cal->unread)?"_unread":"_read",
                                         Cal->cal_msgnum, year, month, day);
-                                wprintf("<i>%s</i><br />", _("All day event"));
-                                wprintf("<i>%s</i> ",    _("Summary:"));
+                                wprintf("<i>%s</i><br />",      _("All day event"));
+                               wprintf("<i>%s: %s</i><br />",  _("From"), Cal->from);
+                                wprintf("<i>%s</i> ",           _("Summary:"));
                                 escputs((char *) icalproperty_get_comment(p));
                                 wprintf("<br />");
                                q = icalcomponent_get_first_property(Cal->cal,ICAL_LOCATION_PROPERTY);
@@ -920,14 +924,16 @@ void calendar_day_view_display_events(time_t thetime,
                        }
                        else if (ongoing_event && notime_events) 
                        {
-                               wprintf("<li class=\"event\"> "
+                               wprintf("<li class=\"event_framed%s\"> "
                                "<a href=\"display_edit_event?"
                                "msgnum=%ld&calview=day&year=%d&month=%d&day=%d\" "
                                " class=\"event_title\" " 
                                 "btt_tooltext=\"",
+                                       (Cal->unread)?"_unread":"_read",
                                Cal->cal_msgnum, year, month, day);
-                                wprintf("<i>%s</i><br />", _("Ongoing event"));
-                                wprintf("<i>%s</i> ",    _("Summary:"));
+                                wprintf("<i>%s</i><br />",     _("Ongoing event"));
+                               wprintf("<i>%s: %s</i><br />", _("From"), Cal->from);
+                                wprintf("<i>%s</i> ",          _("Summary:"));
                                 escputs((char *) icalproperty_get_comment(p));
                                 wprintf("<br />");
                                 q = icalcomponent_get_first_property(Cal->cal,ICAL_LOCATION_PROPERTY);
@@ -936,9 +942,9 @@ void calendar_day_view_display_events(time_t thetime,
                                         escputs((char *)icalproperty_get_comment(q));
                                         wprintf("<br />");
                                         }
-                                fmt_date(buf, event_tt, 1);
+                                webcit_fmt_date(buf, event_tt, 1);
                                 wprintf("<i>%s</i> %s<br>", _("Starting date/time:"), buf);
-                                fmt_date(buf, event_tte, 1);
+                                webcit_fmt_date(buf, event_tte, 1);
                                 wprintf("<i>%s</i> %s<br>", _("Ending date/time:"), buf);
                                 q = icalcomponent_get_first_property(Cal->cal,ICAL_DESCRIPTION_PROPERTY);
                                 if (q) {
@@ -952,7 +958,7 @@ void calendar_day_view_display_events(time_t thetime,
                                wprintf(_("Ongoing event"));
                                wprintf(")</span></li>\n");
                        }
-                       else if (!all_day_event && !ongoing_event && !notime_events)
+                       else if (!all_day_event && !notime_events)
                        {
                                gap++;
 
@@ -993,10 +999,11 @@ void calendar_day_view_display_events(time_t thetime,
                                        /* should never get here */
                                }
 
-                               wprintf("<dd  class=\"event\" "
+                               wprintf("<dd  class=\"event_framed%s\" "
                                        "style=\"position: absolute; "
                                        "top:%dpx; left:%dpx; "
                                        "height:%dpx; \" >",
+                                       (Cal->unread)?"_unread":"_read",
                                        top, (gap * 40), (bottom-top)
                                        );
                                wprintf("<a href=\"display_edit_event?"
@@ -1004,7 +1011,8 @@ void calendar_day_view_display_events(time_t thetime,
                                        "class=\"event_title\" "
                                                "btt_tooltext=\"",
                                        Cal->cal_msgnum, year, month, day, t.hour);
-                                wprintf("<i>%s</i> ",    _("Summary:"));
+                               wprintf("<i>%s: %s</i><br />", _("From"), Cal->from);
+                                wprintf("<i>%s</i> ",          _("Summary:"));
                                 escputs((char *) icalproperty_get_comment(p));
                                 wprintf("<br />");
                                 q = icalcomponent_get_first_property(Cal->cal,ICAL_LOCATION_PROPERTY);
@@ -1013,9 +1021,9 @@ void calendar_day_view_display_events(time_t thetime,
                                         escputs((char *)icalproperty_get_comment(q));
                                         wprintf("<br />");
                                         }
-                                fmt_date(buf, event_tt, 1);
+                                webcit_fmt_date(buf, event_tt, 1);
                                 wprintf("<i>%s</i> %s<br>", _("Starting date/time:"), buf);
-                                fmt_date(buf, event_tte, 1);
+                                webcit_fmt_date(buf, event_tte, 1);
                                 wprintf("<i>%s</i> %s<br>", _("Ending date/time:"), buf);
                                q = icalcomponent_get_first_property(Cal->cal,ICAL_DESCRIPTION_PROPERTY);
                                 if (q) {
@@ -1102,7 +1110,7 @@ void calendar_day_view(int year, int month, int day) {
                        "height: %dpx;          "       
                        "\" >                   "
                        "<a href=\"display_edit_event?msgnum=0"
-                       "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
+                       "&calview=day&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
                        (hour * extratimeline ), extratimeline, 
                        year, month, day, hour
                );
@@ -1129,7 +1137,7 @@ void calendar_day_view(int year, int month, int day) {
                         "top: %dpx; left: 0px;  "
                         "height: %dpx;          "
                         "\" >                   "
-                        "<a href=\"display_edit_event?msgnum=0"
+                        "<a href=\"display_edit_event?msgnum=0&calview=day"
                         "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
                         gap + ((hour - daystart) * timeline ), timeline,
                         year, month, day, hour
@@ -1157,7 +1165,7 @@ void calendar_day_view(int year, int month, int day) {
                         "top: %dpx; left: 0px;  "
                         "height: %dpx;          "
                         "\" >                   "
-                        "<a href=\"display_edit_event?msgnum=0"
+                        "<a href=\"display_edit_event?msgnum=0&calview=day"
                         "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
                         gap + ((hour - dayend - 1) * extratimeline ), extratimeline,
                         year, month, day, hour
@@ -1484,7 +1492,7 @@ void do_tasks_view(void) {
                wprintf("</td>\n");
 
                due = get_task_due_date(WC->disp_cal[i].cal);
-               fmt_date(buf, due, 0);
+               webcit_fmt_date(buf, due, 0);
                wprintf("<td><font");
                if (due < time(NULL)) {
                        wprintf(" color=\"#FF0000\"");