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?"
90 "msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\""
92 WC->disp_cal[i].cal_msgnum,
99 wprintf("<b>Summary:</b> ");
100 escputs("lorem ipsum dolor sit amet");
103 wprintf("<b>Location:</b> ");
104 escputs("lorem ipsum dolor sit amet");
107 wprintf("<b>Notes:</b> ");
108 escputs("lorem ipsum dolor sit amet");
113 icalproperty_get_comment(p));
114 wprintf("</a></font><br />\n");
117 wprintf("</td></tr></table>");
131 * \brief Display one day of a whole month view of a calendar
132 * \param thetime the month we want to see
134 void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
144 struct icaltimetype t;
145 int month, day, year;
146 int all_day_event = 0;
147 char calhourformat[16];
150 get_preference("calhourformat", calhourformat, sizeof calhourformat);
151 if (!strcasecmp(calhourformat, "24")) timeformat="%k:%M";
152 else timeformat="%I:%M %p";
154 localtime_r(&thetime, &today_tm);
155 month = today_tm.tm_mon + 1;
156 day = today_tm.tm_mday;
157 year = today_tm.tm_year + 1900;
159 for (i=0; i<(WC->num_cal); ++i) {
160 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
161 ICAL_DTSTART_PROPERTY);
163 t = icalproperty_get_dtstart(p);
164 event_tt = icaltime_as_timet(t);
166 if (t.is_date) all_day_event = 1;
167 else all_day_event = 0;
170 gmtime_r(&event_tts, &event_tms);
173 localtime_r(&event_tts, &event_tms);
175 /** \todo epoch &! daymask */
176 if ((event_tms.tm_year == today_tm.tm_year)
177 && (event_tms.tm_mon == today_tm.tm_mon)
178 && (event_tms.tm_mday == today_tm.tm_mday)) {
184 p = icalcomponent_get_first_property(
186 ICAL_SUMMARY_PROPERTY);
187 e = icalcomponent_get_first_property(
189 ICAL_DTEND_PROPERTY);
190 if ((p != NULL) && (e != NULL)) {
193 t = icalproperty_get_dtend(e);
194 event_tte = icaltime_as_timet(t);
195 localtime_r(&event_tte, &event_tme);
196 difftime=(event_tte-event_tts)/60;
197 hours=(int)(difftime / 60);
198 minutes=difftime % 60;
199 wprintf("<tr><td bgcolor='%s'>%i:%2i</td><td bgcolor='%s'>"
201 "<a href=\"display_edit_event?msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\">",
205 WC->disp_cal[i].cal_msgnum,
213 icalproperty_get_comment(p));
214 /** \todo: allso ammitime format */
215 wc_strftime(&sbuf[0], sizeof(sbuf), timeformat, &event_tms);
216 wc_strftime(&ebuf[0], sizeof(sbuf), timeformat, &event_tme);
218 wprintf("</a></font></td>"
219 "<td bgcolor='%s'>%s</td><td bgcolor='%s'>%s</td></tr>",
236 * \brief view one month. pretty view
237 * \param year the year
238 * \param month the month
239 * \param day the actual day we want to see
241 void calendar_month_view(int year, int month, int day) {
242 struct tm starting_tm;
246 time_t previous_month;
248 time_t colheader_time;
249 struct tm colheader_tm;
250 char colheader_label[32];
252 /** Determine what day to start.
253 * First, back up to the 1st of the month...
255 memset(&starting_tm, 0, sizeof(struct tm));
256 starting_tm.tm_year = year - 1900;
257 starting_tm.tm_mon = month - 1;
258 starting_tm.tm_mday = day;
259 thetime = mktime(&starting_tm);
261 memcpy(&tm, &starting_tm, sizeof(struct tm));
262 while (tm.tm_mday != 1) {
263 thetime = thetime - (time_t)86400; /* go back 24 hours */
264 localtime_r(&thetime, &tm);
267 /** Determine previous and next months ... for links */
268 previous_month = thetime - (time_t)864000L; /* back 10 days */
269 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
271 /** Now back up until we're on a Sunday */
272 localtime_r(&thetime, &tm);
273 while (tm.tm_wday != 0) {
274 thetime = thetime - (time_t)86400; /* go back 24 hours */
275 localtime_r(&thetime, &tm);
278 /** Outer table (to get the background color) */
279 wprintf("<div class=\"fix_scrollbar_bug\">"
280 "<table width=100%% border=0 cellpadding=0 cellspacing=0 "
281 "bgcolor=#204B78><TR><TD>\n");
283 wprintf("<table width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
285 wprintf("<td align=center>");
287 localtime_r(&previous_month, &tm);
288 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
289 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
290 wprintf("<img align=middle src=\"static/prevdate_32x.gif\" border=0></A>\n");
292 wc_strftime(colheader_label, sizeof colheader_label, "%B", &starting_tm);
293 wprintf(" "
294 "<font size=+1 color=\"#FFFFFF\">"
297 " ", colheader_label, year);
299 localtime_r(&next_month, &tm);
300 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
301 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
302 wprintf("<img align=middle src=\"static/nextdate_32x.gif\" border=0></A>\n");
304 wprintf("</td></tr></table>\n");
306 /** Inner table (the real one) */
307 wprintf("<table width=100%% border=0 cellpadding=1 cellspacing=1 "
308 "bgcolor=#204B78 id=\"inner_month\"><tr>");
309 colheader_time = thetime;
310 for (i=0; i<7; ++i) {
311 colheader_time = thetime + (i * 86400) ;
312 localtime_r(&colheader_time, &colheader_tm);
313 wc_strftime(colheader_label, sizeof colheader_label, "%A", &colheader_tm);
314 wprintf("<td align=center width=14%%>"
315 "<font color=\"#FFFFFF\">%s</font></th>", colheader_label);
320 /** Now do 35 days */
321 for (i = 0; i < 35; ++i) {
322 localtime_r(&thetime, &tm);
324 /** Before displaying Sunday, start a new row */
329 wprintf("<td bgcolor=\"#%s\" width=14%% height=60 align=left valign=top><b>",
330 ((tm.tm_mon != month-1) ? "DDDDDD" :
331 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
334 if ((i==0) || (tm.tm_mday == 1)) {
335 wc_strftime(colheader_label, sizeof colheader_label, "%B", &tm);
336 wprintf("%s ", colheader_label);
338 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">"
345 /** put the data here, stupid */
346 calendar_month_view_display_events(thetime);
350 /** After displaying Saturday, end the row */
355 thetime += (time_t)86400; /** ahead 24 hours */
358 wprintf("</table>" /** end of inner table */
359 "</td></tr></table>" /** end of outer table */
362 /* Initialize the bubble tooltips */
363 wprintf("<script type=\"text/javascript\" src=\"static/BubbleTooltips.js\"></script>\n"
364 "<script type=\"text/javascript\">btt_enableTooltips('inner_month');</script>\n"
369 * \brief view one month. brief view
370 * \param year the year
371 * \param month the month
372 * \param day the actual day we want to see
374 void calendar_brief_month_view(int year, int month, int day) {
375 struct tm starting_tm;
379 time_t previous_month;
381 char month_label[32];
383 /** Determine what day to start.
384 * First, back up to the 1st of the month...
386 memset(&starting_tm, 0, sizeof(struct tm));
387 starting_tm.tm_year = year - 1900;
388 starting_tm.tm_mon = month - 1;
389 starting_tm.tm_mday = day;
390 thetime = mktime(&starting_tm);
392 memcpy(&tm, &starting_tm, sizeof(struct tm));
393 while (tm.tm_mday != 1) {
394 thetime = thetime - (time_t)86400; /* go back 24 hours */
395 localtime_r(&thetime, &tm);
398 /** Determine previous and next months ... for links */
399 previous_month = thetime - (time_t)864000L; /* back 10 days */
400 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
402 /** Now back up until we're on a Sunday */
403 localtime_r(&thetime, &tm);
404 while (tm.tm_wday != 0) {
405 thetime = thetime - (time_t)86400; /* go back 24 hours */
406 localtime_r(&thetime, &tm);
409 /** Outer table (to get the background color) */
410 wprintf("<div class=\"fix_scrollbar_bug\">"
411 "<table width=100%% border=0 cellpadding=0 cellspacing=0 "
412 "bgcolor=#204B78><TR><TD>\n");
414 wprintf("<table width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
416 wprintf("<td align=center>");
418 localtime_r(&previous_month, &tm);
419 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
420 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
421 wprintf("<img align=middle src=\"static/prevdate_32x.gif\" border=0></A>\n");
423 wc_strftime(month_label, sizeof month_label, "%B", &tm);
424 wprintf(" "
425 "<font size=+1 color=\"#FFFFFF\">"
428 " ", month_label, year);
430 localtime_r(&next_month, &tm);
431 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
432 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
433 wprintf("<img align=middle src=\"static/nextdate_32x.gif\" border=0></A>\n");
435 wprintf("</td></tr></table>\n");
437 /** Inner table (the real one) */
438 wprintf("<table width=100%% border=0 cellpadding=1 cellspacing=1 "
439 "bgcolor=#EEEECC><TR>");
441 wprintf("<tr><td colspan=\"100%\">\n");
443 /** Now do 35 days */
444 for (i = 0; i < 35; ++i) {
445 char weeknumber[255];
446 char weekday_name[32];
448 localtime_r(&thetime, &tm);
451 /** Before displaying Sunday, start a new CELL */
453 wc_strftime(&weeknumber[0], sizeof(weeknumber), "%U", &tm);
454 wprintf("<table border='0' bgcolor=\"#EEEECC\" width='100%'> <tr><th colspan='4'>%s %s</th></tr>"
455 " <tr><td>%s</td><td width='70%'>%s</td><td>%s</td><td>%s</td></tr>\n",
465 daycolor=((tm.tm_mon != month-1) ? "DDDDDD" :
466 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
470 wc_strftime(weekday_name, sizeof weekday_name, "%A", &tm);
471 wprintf("<tr><td bgcolor='%s' colspan='1' align='left'> %s,%i."
472 "</td><td bgcolor='%s' colspan='3'><hr></td></tr>\n",
474 weekday_name,tm.tm_mday,
477 /** put the data of one day here, stupid */
478 calendar_month_view_brief_events(thetime, daycolor);
481 /** After displaying Saturday, end the row */
483 wprintf("</td></tr></table>\n");
486 thetime += (time_t)86400; /** ahead 24 hours */
489 wprintf("</table>" /** end of inner table */
490 "</td></tr></table>" /** end of outer table */
495 * \brief view one week
496 * this should view just one week, but it's not here yet.
497 * \todo ny implemented
498 * \param year the year
499 * \param month the month
500 * \param day the day which we want to see the week around
502 void calendar_week_view(int year, int month, int day) {
503 wprintf("<center><i>week view FIXME</i></center><br />\n");
508 * \brief display one day
509 * Display events for a particular hour of a particular day.
510 * (Specify hour < 0 to show "all day" events)
511 * \param year the year
512 * \param month the month
514 * \param hour the hour we want to start displaying?????
516 void calendar_day_view_display_events(int year, int month,
520 struct icaltimetype t;
523 int all_day_event = 0;
525 if (WC->num_cal == 0) {
526 // \todo FIXME wprintf("<br /><br /><br />\n");
530 for (i=0; i<(WC->num_cal); ++i) {
531 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
532 ICAL_DTSTART_PROPERTY);
534 t = icalproperty_get_dtstart(p);
535 event_tt = icaltime_as_timet(t);
544 event_tm = gmtime(&event_tt);
547 event_tm = localtime(&event_tt);
550 if ((event_tm->tm_year == (year-1900))
551 && (event_tm->tm_mon == (month-1))
552 && (event_tm->tm_mday == day)
553 && ( ((event_tm->tm_hour == hour)&&(!t.is_date)) || ((hour<0)&&(t.is_date)) )
557 p = icalcomponent_get_first_property(
559 ICAL_SUMMARY_PROPERTY);
563 wprintf("<table border=1 cellpadding=2><TR>"
564 "<td bgcolor=\"#CCCCCC\">"
568 wprintf("<font size=-1>"
569 "<a href=\"display_edit_event?msgnum=%ld&calview=day&year=%d&month=%d&day=%d\">",
570 WC->disp_cal[i].cal_msgnum,
574 icalproperty_get_comment(p));
575 wprintf("</a></font><br />\n");
578 wprintf("</td></tr></table>");
591 * \brief view one day
592 * \param year the year
593 * \param month the month
594 * \param day the day we want to display
596 void calendar_day_view(int year, int month, int day) {
598 struct icaltimetype today, yesterday, tomorrow;
599 char calhourformat[16];
602 char daystart_str[16], dayend_str[16];
606 get_preference("calhourformat", calhourformat, sizeof calhourformat);
607 get_preference("daystart", daystart_str, sizeof daystart_str);
608 if (strlen(daystart_str) > 0) daystart = atoi(daystart_str);
609 get_preference("dayend", dayend_str, sizeof dayend_str);
610 if (strlen(dayend_str) > 0) dayend = atoi(dayend_str);
613 /** Figure out the dates for "yesterday" and "tomorrow" links */
615 memset(&today, 0, sizeof(struct icaltimetype));
621 memcpy(&yesterday, &today, sizeof(struct icaltimetype));
623 yesterday = icaltime_normalize(yesterday);
625 memcpy(&tomorrow, &today, sizeof(struct icaltimetype));
627 tomorrow = icaltime_normalize(tomorrow);
630 /** Outer table (to get the background color) */
631 wprintf("<div class=\"fix_scrollbar_bug\">"
632 "<table width=100%% border=0 cellpadding=0 cellspacing=0 "
633 "bgcolor=#204B78><tr><td>\n");
635 /** Inner table (the real one) */
636 wprintf("<table width=100%% border=0 cellpadding=1 cellspacing=1 "
637 "bgcolor=#204B78><tr>\n");
639 /** Innermost table (contains hours etc.) */
640 wprintf("<td width=80%%>"
641 "<table width=100%% border=0 cellpadding=1 cellspacing=1 "
642 "bgcolor=#204B78>\n");
644 /** Display events before 8:00 (hour=-1 is all-day events) */
646 "<td bgcolor=\"#CCCCDD\" valign=middle width=10%%></td>"
647 "<td bgcolor=\"#FFFFFF\" valign=top>");
648 for (hour = (-1); hour <= (daystart-1); ++hour) {
649 calendar_day_view_display_events(year, month, day, hour);
651 wprintf("</td></tr>\n");
653 /** Now the middle of the day... */
654 for (hour = daystart; hour <= dayend; ++hour) { /* could do HEIGHT=xx */
655 wprintf("<tr height=30><td bgcolor=\"#CCCCDD\" align=middle "
656 "valign=middle width=10%%>");
657 wprintf("<a href=\"display_edit_event?msgnum=0"
658 "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
659 year, month, day, hour
662 if (!strcasecmp(calhourformat, "24")) {
663 wprintf("%2d:00</a> ", hour);
666 wprintf("%d:00%s</a> ",
667 (hour <= 12 ? hour : hour-12),
668 (hour < 12 ? "am" : "pm")
672 wprintf("</td><td bgcolor=\"#FFFFFF\" valign=top>");
674 /* put the data here, stupid */
675 calendar_day_view_display_events(year, month, day, hour);
677 wprintf("</td></tr>\n");
680 /** Display events after 5:00... */
682 "<td bgcolor=\"#CCCCDD\" valign=middle width=10%%></td>"
683 "<td bgcolor=\"#FFFFFF\" valign=top>");
684 for (hour = (dayend+1); hour <= 23; ++hour) {
685 calendar_day_view_display_events(year, month, day, hour);
687 wprintf("</td></tr>\n");
690 wprintf("</table>" /* end of innermost table */
694 wprintf("<td width=20%% valign=top>"); /* begin stuff-on-the-right */
697 /** Begin todays-date-with-left-and-right-arrows */
698 wprintf("<table border=0 width=100%% "
699 "cellspacing=0 cellpadding=0 bgcolor=\"#FFFFFF\">\n");
703 wprintf("<td align=center>");
704 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
705 yesterday.year, yesterday.month, yesterday.day);
706 wprintf("<img align=middle src=\"static/prevdate_32x.gif\" border=0></A>");
710 memset(&d_tm, 0, sizeof d_tm);
711 d_tm.tm_year = year - 1900;
712 d_tm.tm_mon = month - 1;
714 wc_strftime(d_str, sizeof d_str,
716 "<font size=+2>%B</font><br />"
717 "<font size=+3>%d</font><br />"
718 "<font size=+2>%Y</font><br />"
722 wprintf("%s", d_str);
725 wprintf("<td align=center>");
726 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
727 tomorrow.year, tomorrow.month, tomorrow.day);
728 wprintf("<img align=middle src=\"static/nextdate_32x.gif\""
732 wprintf("</tr></table>\n");
733 /** End todays-date-with-left-and-right-arrows */
735 /** \todo In the future we might want to put a month-o-matic here */
737 wprintf("</font></center>\n");
739 wprintf("</td>"); /** end stuff-on-the-right */
743 wprintf("</tr></table>" /** end of inner table */
744 "</td></tr></table></div>" /** end of outer table */
752 * \brief Display today's events.
754 void calendar_summary_view(void) {
757 struct icaltimetype t;
762 int all_day_event = 0;
763 char timestring[SIZ];
765 if (WC->num_cal == 0) {
770 localtime_r(&now, &today_tm);
772 for (i=0; i<(WC->num_cal); ++i) {
773 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
774 ICAL_DTSTART_PROPERTY);
776 t = icalproperty_get_dtstart(p);
777 event_tt = icaltime_as_timet(t);
784 fmt_time(timestring, event_tt);
787 gmtime_r(&event_tt, &event_tm);
790 localtime_r(&event_tt, &event_tm);
793 if ( (event_tm.tm_year == today_tm.tm_year)
794 && (event_tm.tm_mon == today_tm.tm_mon)
795 && (event_tm.tm_mday == today_tm.tm_mday)
799 p = icalcomponent_get_first_property(
801 ICAL_SUMMARY_PROPERTY);
804 icalproperty_get_comment(p));
805 wprintf(" (%s)<br />\n", timestring);
810 free_calendar_buffer();
815 * \brief clean up ical memory
816 * \todo this could get troubel with future ical versions
818 void free_calendar_buffer(void) {
820 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
821 icalcomponent_free(WC->disp_cal[i].cal);
831 * \brief do the whole calendar page
832 * view any part of the calender. decide which way, etc.
834 void do_calendar_view(void) {
837 int year, month, day;
840 /** In case no date was specified, go with today */
842 localtime_r(&now, &tm);
843 year = tm.tm_year + 1900;
844 month = tm.tm_mon + 1;
847 /** Now see if a date was specified */
848 if (strlen(bstr("year")) > 0) year = atoi(bstr("year"));
849 if (strlen(bstr("month")) > 0) month = atoi(bstr("month"));
850 if (strlen(bstr("day")) > 0) day = atoi(bstr("day"));
852 /** How would you like that cooked? */
853 if (strlen(bstr("calview")) > 0) {
854 strcpy(calview, bstr("calview"));
857 strcpy(calview, "month");
860 /** Display the selected view */
861 if (!strcasecmp(calview, "day")) {
862 calendar_day_view(year, month, day);
864 else if (!strcasecmp(calview, "week")) {
865 calendar_week_view(year, month, day);
868 if (WC->wc_view == VIEW_CALBRIEF) {
869 calendar_brief_month_view(year, month, day);
872 calendar_month_view(year, month, day);
876 /** Free the calendar stuff */
877 free_calendar_buffer();
883 * \brief get task due date
884 * Helper function for do_tasks_view().
885 * \param vtodo a task to get the due date
886 * \return the date/time due.
888 time_t get_task_due_date(icalcomponent *vtodo) {
896 * If we're looking at a fully encapsulated VCALENDAR
897 * rather than a VTODO component, recurse into the data
898 * structure until we get a VTODO.
900 if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) {
901 return get_task_due_date(
902 icalcomponent_get_first_component(
903 vtodo, ICAL_VTODO_COMPONENT
908 p = icalcomponent_get_first_property(vtodo, ICAL_DUE_PROPERTY);
910 return(icaltime_as_timet(icalproperty_get_due(p)));
919 * \brief Compare the due dates of two tasks (this is for sorting)
920 * \param task1 first task to compare
921 * \param task2 second task to compare
923 int task_due_cmp(const void *task1, const void *task2) {
927 t1 = get_task_due_date(((struct disp_cal *)task1)->cal);
928 t2 = get_task_due_date(((struct disp_cal *)task2)->cal);
930 if (t1 < t2) return(-1);
931 if (t1 > t2) return(1);
939 * \brief do the whole task view stuff
941 void do_tasks_view(void) {
948 wprintf("<div class=\"fix_scrollbar_bug\">"
949 "<table border=0 cellspacing=0 width=100%% bgcolor=\"#FFFFFF\">\n<tr>\n"
951 wprintf(_("Name of task"));
952 wprintf("</th><th>");
953 wprintf(_("Date due"));
954 wprintf("</th></tr>\n"
957 /** Sort them if necessary */
958 if (WC->num_cal > 1) {
961 sizeof(struct disp_cal),
966 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
969 wprintf("<tr bgcolor=\"#%s\"><td>",
970 (bg ? "DDDDDD" : "FFFFFF")
973 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
974 ICAL_SUMMARY_PROPERTY);
975 wprintf("<a href=\"display_edit_task?msgnum=%ld&taskrm=",
976 WC->disp_cal[i].cal_msgnum );
977 urlescputs(WC->wc_roomname);
979 wprintf("<img align=middle "
980 "src=\"static/taskmanag_16x.gif\" border=0> ");
982 escputs((char *)icalproperty_get_comment(p));
987 due = get_task_due_date(WC->disp_cal[i].cal);
988 fmt_date(buf, due, 0);
989 wprintf("<td><font");
990 if (due < time(NULL)) {
991 wprintf(" color=\"#FF0000\"");
993 wprintf(">%s</font></td></tr>\n", buf);
996 wprintf("</table></div>\n");
999 free_calendar_buffer();
1003 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */