5 * \defgroup CalHtmlHandles Handles the HTML display of calendar items.
10 #include "webserver.h"
12 #ifndef WEBCIT_WITH_CALENDAR_SERVICE
14 /**\brief stub for non-libical builds */
15 void do_calendar_view(void) {
16 wprintf("<CENTER><I>");
17 wprintf(_("The calendar view is not available."));
18 wprintf("</I></CENTER><br />\n");
21 /**\brief stub for non-libical builds */
22 void do_tasks_view(void) {
23 wprintf("<CENTER><I>");
24 wprintf(_("The tasks view is not available."));
25 wprintf("</I></CENTER><br />\n");
28 #else /* WEBCIT_WITH_CALENDAR_SERVICE */
30 /****************************************************************************/
33 * \brief Display one day of a whole month view of a calendar
34 * \param thetime the month we want to see
36 void calendar_month_view_display_events(time_t thetime) {
42 struct icaltimetype t;
44 int all_day_event = 0;
46 if (WC->num_cal == 0) {
47 wprintf("<br /><br /><br />\n");
51 localtime_r(&thetime, &today_tm);
52 month = today_tm.tm_mon + 1;
53 day = today_tm.tm_mday;
54 year = today_tm.tm_year + 1900;
56 for (i=0; i<(WC->num_cal); ++i) {
57 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
58 ICAL_DTSTART_PROPERTY);
60 t = icalproperty_get_dtstart(p);
61 event_tt = icaltime_as_timet(t);
63 if (t.is_date) all_day_event = 1;
64 else all_day_event = 0;
67 gmtime_r(&event_tt, &event_tm);
70 localtime_r(&event_tt, &event_tm);
73 if ((event_tm.tm_year == today_tm.tm_year)
74 && (event_tm.tm_mon == today_tm.tm_mon)
75 && (event_tm.tm_mday == today_tm.tm_mday)) {
77 p = icalcomponent_get_first_property(
79 ICAL_SUMMARY_PROPERTY);
83 wprintf("<TABLE border=0 cellpadding=2><TR>"
84 "<TD BGCOLOR=\"#CCCCDD\">"
88 wprintf("<FONT SIZE=-1>"
89 "<a href=\"display_edit_event?msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\">",
90 WC->disp_cal[i].cal_msgnum,
97 icalproperty_get_comment(p));
98 wprintf("</A></FONT><br />\n");
101 wprintf("</TD></TR></TABLE>");
115 * \brief Display one day of a whole month view of a calendar
116 * \param thetime the month we want to see
118 void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
128 struct icaltimetype t;
129 int month, day, year;
130 int all_day_event = 0;
131 char calhourformat[16];
134 get_preference("calhourformat", calhourformat, sizeof calhourformat);
135 if (!strcasecmp(calhourformat, "24")) timeformat="%k:%M";
136 else timeformat="%I:%M %p";
138 localtime_r(&thetime, &today_tm);
139 month = today_tm.tm_mon + 1;
140 day = today_tm.tm_mday;
141 year = today_tm.tm_year + 1900;
143 for (i=0; i<(WC->num_cal); ++i) {
144 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
145 ICAL_DTSTART_PROPERTY);
147 t = icalproperty_get_dtstart(p);
148 event_tt = icaltime_as_timet(t);
150 if (t.is_date) all_day_event = 1;
151 else all_day_event = 0;
154 gmtime_r(&event_tts, &event_tms);
157 localtime_r(&event_tts, &event_tms);
159 /** \todo epoch &! daymask */
160 if ((event_tms.tm_year == today_tm.tm_year)
161 && (event_tms.tm_mon == today_tm.tm_mon)
162 && (event_tms.tm_mday == today_tm.tm_mday)) {
168 p = icalcomponent_get_first_property(
170 ICAL_SUMMARY_PROPERTY);
171 e = icalcomponent_get_first_property(
173 ICAL_DTEND_PROPERTY);
174 if ((p != NULL) && (e != NULL)) {
177 t = icalproperty_get_dtend(e);
178 event_tte = icaltime_as_timet(t);
179 localtime_r(&event_tte, &event_tme);
180 difftime=(event_tte-event_tts)/60;
181 hours=(int)(difftime / 60);
182 minutes=difftime % 60;
183 wprintf("<tr><td bgcolor='%s'>%i:%2i</td><td bgcolor='%s'>"
185 "<a href=\"display_edit_event?msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\">",
189 WC->disp_cal[i].cal_msgnum,
197 icalproperty_get_comment(p));
198 /** \todo: allso ammitime format */
199 strftime_l(&sbuf[0], sizeof(sbuf), timeformat, &event_tms,
200 wc_locales[WC->selected_language]);
201 strftime_l(&ebuf[0], sizeof(sbuf), timeformat, &event_tme,
202 wc_locales[WC->selected_language]);
204 wprintf("</a></font></td>"
205 "<td bgcolor='%s'>%s</td><td bgcolor='%s'>%s</td></tr>",
222 * \brief view one month. pretty view
223 * \param year the year
224 * \param month the month
225 * \param day the actual day we want to see
227 void calendar_month_view(int year, int month, int day) {
228 struct tm starting_tm;
232 time_t previous_month;
235 /** Determine what day to start.
236 * First, back up to the 1st of the month...
238 memset(&starting_tm, 0, sizeof(struct tm));
239 starting_tm.tm_year = year - 1900;
240 starting_tm.tm_mon = month - 1;
241 starting_tm.tm_mday = day;
242 thetime = mktime(&starting_tm);
244 memcpy(&tm, &starting_tm, sizeof(struct tm));
245 while (tm.tm_mday != 1) {
246 thetime = thetime - (time_t)86400; /* go back 24 hours */
247 localtime_r(&thetime, &tm);
250 /** Determine previous and next months ... for links */
251 previous_month = thetime - (time_t)864000L; /* back 10 days */
252 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
254 /** Now back up until we're on a Sunday */
255 localtime_r(&thetime, &tm);
256 while (tm.tm_wday != 0) {
257 thetime = thetime - (time_t)86400; /* go back 24 hours */
258 localtime_r(&thetime, &tm);
261 /** Outer table (to get the background color) */
262 wprintf("<div class=\"fix_scrollbar_bug\">"
263 "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
264 "bgcolor=#204B78><TR><TD>\n");
266 wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
268 wprintf("<TD ALIGN=CENTER>");
270 localtime_r(&previous_month, &tm);
271 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
272 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
273 wprintf("<IMG ALIGN=MIDDLE src=\"static/prevdate_32x.gif\" BORDER=0></A>\n");
275 wprintf(" "
276 "<FONT SIZE=+1 COLOR=\"#FFFFFF\">"
279 " ", months[month-1], year);
281 localtime_r(&next_month, &tm);
282 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
283 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
284 wprintf("<IMG ALIGN=MIDDLE src=\"static/nextdate_32x.gif\" BORDER=0></A>\n");
286 wprintf("</TD></TR></TABLE>\n");
288 /** Inner table (the real one) */
289 wprintf("<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
290 "bgcolor=#204B78><TR>");
291 for (i=0; i<7; ++i) {
292 wprintf("<TD ALIGN=CENTER WIDTH=14%%>"
293 "<FONT COLOR=\"#FFFFFF\">%s</FONT></TH>", wdays[i]);
297 /** Now do 35 days */
298 for (i = 0; i < 35; ++i) {
299 localtime_r(&thetime, &tm);
301 /** Before displaying Sunday, start a new row */
306 wprintf("<TD BGCOLOR=\"#%s\" WIDTH=14%% HEIGHT=60 align=left VALIGN=TOP><B>",
307 ((tm.tm_mon != month-1) ? "DDDDDD" :
308 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
311 if ((i==0) || (tm.tm_mday == 1)) {
312 wprintf("%s ", months[tm.tm_mon]);
314 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">"
321 /** put the data here, stupid */
322 calendar_month_view_display_events(thetime);
326 /** After displaying Saturday, end the row */
331 thetime += (time_t)86400; /** ahead 24 hours */
334 wprintf("</TABLE>" /** end of inner table */
335 "</TD></TR></TABLE>" /** end of outer table */
340 * \brief view one month. brief view
341 * \param year the year
342 * \param month the month
343 * \param day the actual day we want to see
345 void calendar_brief_month_view(int year, int month, int day) {
346 struct tm starting_tm;
350 time_t previous_month;
353 /** Determine what day to start.
354 * First, back up to the 1st of the month...
356 memset(&starting_tm, 0, sizeof(struct tm));
357 starting_tm.tm_year = year - 1900;
358 starting_tm.tm_mon = month - 1;
359 starting_tm.tm_mday = day;
360 thetime = mktime(&starting_tm);
362 memcpy(&tm, &starting_tm, sizeof(struct tm));
363 while (tm.tm_mday != 1) {
364 thetime = thetime - (time_t)86400; /* go back 24 hours */
365 localtime_r(&thetime, &tm);
368 /** Determine previous and next months ... for links */
369 previous_month = thetime - (time_t)864000L; /* back 10 days */
370 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
372 /** Now back up until we're on a Sunday */
373 localtime_r(&thetime, &tm);
374 while (tm.tm_wday != 0) {
375 thetime = thetime - (time_t)86400; /* go back 24 hours */
376 localtime_r(&thetime, &tm);
379 /** Outer table (to get the background color) */
380 wprintf("<div class=\"fix_scrollbar_bug\">"
381 "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
382 "bgcolor=#204B78><TR><TD>\n");
384 wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
386 wprintf("<TD ALIGN=CENTER>");
388 localtime_r(&previous_month, &tm);
389 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
390 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
391 wprintf("<IMG ALIGN=MIDDLE src=\"static/prevdate_32x.gif\" BORDER=0></A>\n");
393 wprintf(" "
394 "<FONT SIZE=+1 COLOR=\"#FFFFFF\">"
397 " ", months[month-1], year);
399 localtime_r(&next_month, &tm);
400 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
401 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
402 wprintf("<IMG ALIGN=MIDDLE src=\"static/nextdate_32x.gif\" BORDER=0></A>\n");
404 wprintf("</TD></TR></TABLE>\n");
406 /** Inner table (the real one) */
407 wprintf("<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
408 "bgcolor=#EEEECC><TR>");
410 wprintf("<TR><TD COLSPAN=\"100%\">\n");
412 /** Now do 35 days */
413 for (i = 0; i < 35; ++i) {
414 char weeknumber[255];
416 localtime_r(&thetime, &tm);
419 /** Before displaying Sunday, start a new CELL */
421 strftime_l(&weeknumber[0], sizeof(weeknumber), "%U", &tm, wc_locales[WC->selected_language]);
422 wprintf("<TABLE border='0' BGCOLOR=\"#EEEECC\" width='100%'> <tr><th colspan='4'>%s %s</th></tr>"
423 " <tr><td>%s</td><td width='70%'>%s</td><td>%s</td><td>%s</td></tr>\n",
433 daycolor=((tm.tm_mon != month-1) ? "DDDDDD" :
434 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
438 wprintf("<tr><td BGCOLOR='%s' colspan='1' align='left'> %s</td><td BGCOLOR='%s' colspan='3'><hr></td></tr>\n",
443 /** put the data of one day here, stupid */
444 calendar_month_view_brief_events(thetime, daycolor);
447 /** After displaying Saturday, end the row */
449 wprintf("</td></tr></table>\n");
452 thetime += (time_t)86400; /** ahead 24 hours */
455 wprintf("</TABLE>" /** end of inner table */
456 "</TD></TR></TABLE>" /** end of outer table */
461 * \brief view one week
462 * this should view just one week, but it's not here yet.
463 * \todo ny implemented
464 * \param year the year
465 * \param month the month
466 * \param day the day which we want to see the week around
468 void calendar_week_view(int year, int month, int day) {
469 wprintf("<CENTER><I>week view FIXME</I></CENTER><br />\n");
474 * \brief display one day
475 * Display events for a particular hour of a particular day.
476 * (Specify hour < 0 to show "all day" events)
477 * \param year the year
478 * \param month the month
480 * \param hour the hour we want to start displaying?????
482 void calendar_day_view_display_events(int year, int month,
486 struct icaltimetype t;
489 int all_day_event = 0;
491 if (WC->num_cal == 0) {
492 // \todo FIXME wprintf("<br /><br /><br />\n");
496 for (i=0; i<(WC->num_cal); ++i) {
497 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
498 ICAL_DTSTART_PROPERTY);
500 t = icalproperty_get_dtstart(p);
501 event_tt = icaltime_as_timet(t);
510 event_tm = gmtime(&event_tt);
513 event_tm = localtime(&event_tt);
516 if ((event_tm->tm_year == (year-1900))
517 && (event_tm->tm_mon == (month-1))
518 && (event_tm->tm_mday == day)
519 && ( ((event_tm->tm_hour == hour)&&(!t.is_date)) || ((hour<0)&&(t.is_date)) )
523 p = icalcomponent_get_first_property(
525 ICAL_SUMMARY_PROPERTY);
529 wprintf("<TABLE border=1 cellpadding=2><TR>"
530 "<TD BGCOLOR=\"#CCCCCC\">"
534 wprintf("<FONT SIZE=-1>"
535 "<a href=\"display_edit_event?msgnum=%ld&calview=day&year=%d&month=%d&day=%d\">",
536 WC->disp_cal[i].cal_msgnum,
540 icalproperty_get_comment(p));
541 wprintf("</A></FONT><br />\n");
544 wprintf("</TD></TR></TABLE>");
557 * \brief view one day
558 * \param year the year
559 * \param month the month
560 * \param day the day we want to display
562 void calendar_day_view(int year, int month, int day) {
564 struct icaltimetype today, yesterday, tomorrow;
565 char calhourformat[16];
568 char daystart_str[16], dayend_str[16];
570 get_preference("calhourformat", calhourformat, sizeof calhourformat);
571 get_preference("daystart", daystart_str, sizeof daystart_str);
572 if (strlen(daystart_str) > 0) daystart = atoi(daystart_str);
573 get_preference("dayend", dayend_str, sizeof dayend_str);
574 if (strlen(dayend_str) > 0) dayend = atoi(dayend_str);
577 /** Figure out the dates for "yesterday" and "tomorrow" links */
579 memset(&today, 0, sizeof(struct icaltimetype));
585 memcpy(&yesterday, &today, sizeof(struct icaltimetype));
587 yesterday = icaltime_normalize(yesterday);
589 memcpy(&tomorrow, &today, sizeof(struct icaltimetype));
591 tomorrow = icaltime_normalize(tomorrow);
594 /** Outer table (to get the background color) */
595 wprintf("<div class=\"fix_scrollbar_bug\">"
596 "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
597 "bgcolor=#204B78><TR><TD>\n");
599 /** Inner table (the real one) */
600 wprintf("<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
601 "bgcolor=#204B78><TR>\n");
603 /** Innermost table (contains hours etc.) */
604 wprintf("<TD WIDTH=80%%>"
605 "<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
606 "bgcolor=#204B78>\n");
608 /** Display events before 8:00 (hour=-1 is all-day events) */
610 "<TD BGCOLOR=\"#CCCCDD\" VALIGN=MIDDLE WIDTH=10%%></TD>"
611 "<TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
612 for (hour = (-1); hour <= (daystart-1); ++hour) {
613 calendar_day_view_display_events(year, month, day, hour);
615 wprintf("</TD></TR>\n");
617 /** Now the middle of the day... */
618 for (hour = daystart; hour <= dayend; ++hour) { /* could do HEIGHT=xx */
619 wprintf("<TR HEIGHT=30><TD BGCOLOR=\"#CCCCDD\" ALIGN=MIDDLE "
620 "VALIGN=MIDDLE WIDTH=10%%>");
621 wprintf("<a href=\"display_edit_event?msgnum=0"
622 "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
623 year, month, day, hour
626 if (!strcasecmp(calhourformat, "24")) {
627 wprintf("%2d:00</A> ", hour);
630 wprintf("%d:00%s</A> ",
631 (hour <= 12 ? hour : hour-12),
632 (hour < 12 ? "am" : "pm")
636 wprintf("</TD><TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
638 /* put the data here, stupid */
639 calendar_day_view_display_events(year, month, day, hour);
641 wprintf("</TD></TR>\n");
644 /** Display events after 5:00... */
646 "<TD BGCOLOR=\"#CCCCDD\" VALIGN=MIDDLE WIDTH=10%%></TD>"
647 "<TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
648 for (hour = (dayend+1); hour <= 23; ++hour) {
649 calendar_day_view_display_events(year, month, day, hour);
651 wprintf("</TD></TR>\n");
654 wprintf("</TABLE>" /* end of innermost table */
658 wprintf("<TD WIDTH=20%% VALIGN=top>"); /* begin stuff-on-the-right */
661 /** Begin todays-date-with-left-and-right-arrows */
662 wprintf("<TABLE BORDER=0 WIDTH=100%% "
663 "CELLSPACING=0 CELLPADDING=0 BGCOLOR=\"#FFFFFF\">\n");
667 wprintf("<TD ALIGN=CENTER>");
668 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
669 yesterday.year, yesterday.month, yesterday.day);
670 wprintf("<IMG ALIGN=MIDDLE src=\"static/prevdate_32x.gif\" BORDER=0></A>");
674 wprintf("<TD ALIGN=CENTER>");
675 wprintf("<FONT SIZE=+2>%s</FONT><br />"
676 "<FONT SIZE=+3>%d</FONT><br />"
677 "<FONT SIZE=+2>%d</FONT><br />",
678 months[month-1], day, year);
682 wprintf("<TD ALIGN=CENTER>");
683 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
684 tomorrow.year, tomorrow.month, tomorrow.day);
685 wprintf("<IMG ALIGN=MIDDLE src=\"static/nextdate_32x.gif\""
689 wprintf("</TR></TABLE>\n");
690 /** End todays-date-with-left-and-right-arrows */
692 /** \todo In the future we might want to put a month-o-matic here */
694 wprintf("</FONT></CENTER>\n");
696 wprintf("</TD>"); /** end stuff-on-the-right */
700 wprintf("</TR></TABLE>" /** end of inner table */
701 "</TD></TR></TABLE></div>" /** end of outer table */
709 * \brief Display today's events.
711 void calendar_summary_view(void) {
714 struct icaltimetype t;
719 int all_day_event = 0;
720 char timestring[SIZ];
722 if (WC->num_cal == 0) {
727 localtime_r(&now, &today_tm);
729 for (i=0; i<(WC->num_cal); ++i) {
730 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
731 ICAL_DTSTART_PROPERTY);
733 t = icalproperty_get_dtstart(p);
734 event_tt = icaltime_as_timet(t);
741 fmt_time(timestring, event_tt);
744 gmtime_r(&event_tt, &event_tm);
747 localtime_r(&event_tt, &event_tm);
750 if ( (event_tm.tm_year == today_tm.tm_year)
751 && (event_tm.tm_mon == today_tm.tm_mon)
752 && (event_tm.tm_mday == today_tm.tm_mday)
756 p = icalcomponent_get_first_property(
758 ICAL_SUMMARY_PROPERTY);
761 icalproperty_get_comment(p));
762 wprintf(" (%s)<br />\n", timestring);
767 free_calendar_buffer();
772 * \brief clean up ical memory
773 * \todo this could get troubel with future ical versions
775 void free_calendar_buffer(void) {
777 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
778 icalcomponent_free(WC->disp_cal[i].cal);
788 * \brief do the whole calendar page
789 * view any part of the calender. decide which way, etc.
791 void do_calendar_view(void) {
794 int year, month, day;
797 /** In case no date was specified, go with today */
799 localtime_r(&now, &tm);
800 year = tm.tm_year + 1900;
801 month = tm.tm_mon + 1;
804 /** Now see if a date was specified */
805 if (strlen(bstr("year")) > 0) year = atoi(bstr("year"));
806 if (strlen(bstr("month")) > 0) month = atoi(bstr("month"));
807 if (strlen(bstr("day")) > 0) day = atoi(bstr("day"));
809 /** How would you like that cooked? */
810 if (strlen(bstr("calview")) > 0) {
811 strcpy(calview, bstr("calview"));
814 strcpy(calview, "month");
817 /** Display the selected view */
818 if (!strcasecmp(calview, "day")) {
819 calendar_day_view(year, month, day);
821 else if (!strcasecmp(calview, "week")) {
822 calendar_week_view(year, month, day);
825 if (WC->wc_view == VIEW_CALBRIEF) {
826 calendar_brief_month_view(year, month, day);
829 calendar_month_view(year, month, day);
833 /** Free the calendar stuff */
834 free_calendar_buffer();
840 * \brief get task due date
841 * Helper function for do_tasks_view().
842 * \param vtodo a task to get the due date
843 * \return the date/time due.
845 time_t get_task_due_date(icalcomponent *vtodo) {
853 * If we're looking at a fully encapsulated VCALENDAR
854 * rather than a VTODO component, recurse into the data
855 * structure until we get a VTODO.
857 if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) {
858 return get_task_due_date(
859 icalcomponent_get_first_component(
860 vtodo, ICAL_VTODO_COMPONENT
865 p = icalcomponent_get_first_property(vtodo, ICAL_DUE_PROPERTY);
867 return(icaltime_as_timet(icalproperty_get_due(p)));
876 * \brief Compare the due dates of two tasks (this is for sorting)
877 * \param task1 first task to compare
878 * \param task2 second task to compare
880 int task_due_cmp(const void *task1, const void *task2) {
884 t1 = get_task_due_date(((struct disp_cal *)task1)->cal);
885 t2 = get_task_due_date(((struct disp_cal *)task2)->cal);
887 if (t1 < t2) return(-1);
888 if (t1 > t2) return(1);
896 * \brief do the whole task view stuff
898 void do_tasks_view(void) {
905 wprintf("<div class=\"fix_scrollbar_bug\">"
906 "<table border=0 cellspacing=0 width=100%% bgcolor=\"#FFFFFF\">\n<tr>\n"
908 wprintf(_("Name of task"));
909 wprintf("</TH><TH>");
910 wprintf(_("Date due"));
911 wprintf("</TH></TR>\n"
914 /** Sort them if necessary */
915 if (WC->num_cal > 1) {
918 sizeof(struct disp_cal),
923 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
926 wprintf("<TR BGCOLOR=\"#%s\"><TD>",
927 (bg ? "DDDDDD" : "FFFFFF")
930 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
931 ICAL_SUMMARY_PROPERTY);
932 wprintf("<a href=\"display_edit_task?msgnum=%ld&taskrm=",
933 WC->disp_cal[i].cal_msgnum );
934 urlescputs(WC->wc_roomname);
936 wprintf("<IMG ALIGN=MIDDLE "
937 "src=\"static/taskmanag_16x.gif\" BORDER=0> ");
939 escputs((char *)icalproperty_get_comment(p));
944 due = get_task_due_date(WC->disp_cal[i].cal);
945 fmt_date(buf, due, 0);
946 wprintf("<TD><FONT");
947 if (due < time(NULL)) {
948 wprintf(" COLOR=\"#FF0000\"");
950 wprintf(">%s</FONT></TD></TR>\n", buf);
953 wprintf("</table></div>\n");
956 free_calendar_buffer();
960 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */