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) {
41 icalproperty *p = NULL;
42 icalproperty *q = NULL;
43 struct icaltimetype t;
45 int all_day_event = 0;
47 if (WC->num_cal == 0) {
48 wprintf("<br /><br /><br />\n");
52 localtime_r(&thetime, &today_tm);
53 month = today_tm.tm_mon + 1;
54 day = today_tm.tm_mday;
55 year = today_tm.tm_year + 1900;
57 for (i=0; i<(WC->num_cal); ++i) {
58 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
59 ICAL_DTSTART_PROPERTY);
61 t = icalproperty_get_dtstart(p);
62 event_tt = icaltime_as_timet(t);
64 if (t.is_date) all_day_event = 1;
65 else all_day_event = 0;
68 gmtime_r(&event_tt, &event_tm);
71 localtime_r(&event_tt, &event_tm);
74 if ((event_tm.tm_year == today_tm.tm_year)
75 && (event_tm.tm_mon == today_tm.tm_mon)
76 && (event_tm.tm_mday == today_tm.tm_mday)) {
78 p = icalcomponent_get_first_property(
80 ICAL_SUMMARY_PROPERTY);
84 wprintf("<table border=0 cellpadding=2><TR>"
85 "<td bgcolor=\"#CCCCDD\">"
89 wprintf("<font size=-1>"
90 "<a href=\"display_edit_event?"
91 "msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\""
93 WC->disp_cal[i].cal_msgnum,
100 wprintf("<b>%s</b> ", _("Summary:"));
101 escputs((char *)icalproperty_get_comment(p));
104 q = icalcomponent_get_first_property(
106 ICAL_LOCATION_PROPERTY);
108 wprintf("<b>%s</b> ", _("Location:"));
109 escputs((char *)icalproperty_get_comment(q));
113 q = icalcomponent_get_first_property(
115 ICAL_DESCRIPTION_PROPERTY);
117 wprintf("<b>%s</b> ", _("Notes:"));
118 escputs((char *)icalproperty_get_comment(q));
124 icalproperty_get_comment(p));
125 wprintf("</a></font><br />\n");
128 wprintf("</td></tr></table>");
142 * \brief Display one day of a whole month view of a calendar
143 * \param thetime the month we want to see
145 void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
155 struct icaltimetype t;
156 int month, day, year;
157 int all_day_event = 0;
158 char calhourformat[16];
161 get_preference("calhourformat", calhourformat, sizeof calhourformat);
162 if (!strcasecmp(calhourformat, "24")) timeformat="%k:%M";
163 else timeformat="%I:%M %p";
165 localtime_r(&thetime, &today_tm);
166 month = today_tm.tm_mon + 1;
167 day = today_tm.tm_mday;
168 year = today_tm.tm_year + 1900;
170 for (i=0; i<(WC->num_cal); ++i) {
171 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
172 ICAL_DTSTART_PROPERTY);
174 t = icalproperty_get_dtstart(p);
175 event_tt = icaltime_as_timet(t);
177 if (t.is_date) all_day_event = 1;
178 else all_day_event = 0;
181 gmtime_r(&event_tts, &event_tms);
184 localtime_r(&event_tts, &event_tms);
186 /** \todo epoch &! daymask */
187 if ((event_tms.tm_year == today_tm.tm_year)
188 && (event_tms.tm_mon == today_tm.tm_mon)
189 && (event_tms.tm_mday == today_tm.tm_mday)) {
195 p = icalcomponent_get_first_property(
197 ICAL_SUMMARY_PROPERTY);
198 e = icalcomponent_get_first_property(
200 ICAL_DTEND_PROPERTY);
201 if ((p != NULL) && (e != NULL)) {
204 t = icalproperty_get_dtend(e);
205 event_tte = icaltime_as_timet(t);
206 localtime_r(&event_tte, &event_tme);
207 difftime=(event_tte-event_tts)/60;
208 hours=(int)(difftime / 60);
209 minutes=difftime % 60;
210 wprintf("<tr><td bgcolor='%s'>%i:%2i</td><td bgcolor='%s'>"
212 "<a href=\"display_edit_event?msgnum=%ld&calview=%s&year=%s&month=%s&day=%s\">",
216 WC->disp_cal[i].cal_msgnum,
224 icalproperty_get_comment(p));
225 /** \todo: allso ammitime format */
226 wc_strftime(&sbuf[0], sizeof(sbuf), timeformat, &event_tms);
227 wc_strftime(&ebuf[0], sizeof(sbuf), timeformat, &event_tme);
229 wprintf("</a></font></td>"
230 "<td bgcolor='%s'>%s</td><td bgcolor='%s'>%s</td></tr>",
247 * \brief view one month. pretty view
248 * \param year the year
249 * \param month the month
250 * \param day the actual day we want to see
252 void calendar_month_view(int year, int month, int day) {
253 struct tm starting_tm;
257 time_t previous_month;
259 time_t colheader_time;
260 struct tm colheader_tm;
261 char colheader_label[32];
263 /** Determine what day to start.
264 * First, back up to the 1st of the month...
266 memset(&starting_tm, 0, sizeof(struct tm));
267 starting_tm.tm_year = year - 1900;
268 starting_tm.tm_mon = month - 1;
269 starting_tm.tm_mday = day;
270 thetime = mktime(&starting_tm);
272 memcpy(&tm, &starting_tm, sizeof(struct tm));
273 while (tm.tm_mday != 1) {
274 thetime = thetime - (time_t)86400; /* go back 24 hours */
275 localtime_r(&thetime, &tm);
278 /** Determine previous and next months ... for links */
279 previous_month = thetime - (time_t)864000L; /* back 10 days */
280 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
282 /** Now back up until we're on a Sunday */
283 localtime_r(&thetime, &tm);
284 while (tm.tm_wday != 0) {
285 thetime = thetime - (time_t)86400; /* go back 24 hours */
286 localtime_r(&thetime, &tm);
289 /** Outer table (to get the background color) */
290 wprintf("<div class=\"fix_scrollbar_bug\">"
291 "<table width=100%% border=0 cellpadding=0 cellspacing=0 "
292 "bgcolor=#204B78><TR><TD>\n");
294 wprintf("<table width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
296 wprintf("<td align=center>");
298 localtime_r(&previous_month, &tm);
299 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
300 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
301 wprintf("<img align=middle src=\"static/prevdate_32x.gif\" border=0></A>\n");
303 wc_strftime(colheader_label, sizeof colheader_label, "%B", &starting_tm);
304 wprintf(" "
305 "<font size=+1 color=\"#FFFFFF\">"
308 " ", colheader_label, year);
310 localtime_r(&next_month, &tm);
311 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
312 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
313 wprintf("<img align=middle src=\"static/nextdate_32x.gif\" border=0></A>\n");
315 wprintf("</td></tr></table>\n");
317 /** Inner table (the real one) */
318 wprintf("<table width=100%% border=0 cellpadding=1 cellspacing=1 "
319 "bgcolor=#204B78 id=\"inner_month\"><tr>");
320 colheader_time = thetime;
321 for (i=0; i<7; ++i) {
322 colheader_time = thetime + (i * 86400) ;
323 localtime_r(&colheader_time, &colheader_tm);
324 wc_strftime(colheader_label, sizeof colheader_label, "%A", &colheader_tm);
325 wprintf("<td align=center width=14%%>"
326 "<font color=\"#FFFFFF\">%s</font></th>", colheader_label);
331 /** Now do 35 days */
332 for (i = 0; i < 35; ++i) {
333 localtime_r(&thetime, &tm);
335 /** Before displaying Sunday, start a new row */
340 wprintf("<td bgcolor=\"#%s\" width=14%% height=60 align=left valign=top><b>",
341 ((tm.tm_mon != month-1) ? "DDDDDD" :
342 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
345 if ((i==0) || (tm.tm_mday == 1)) {
346 wc_strftime(colheader_label, sizeof colheader_label, "%B", &tm);
347 wprintf("%s ", colheader_label);
349 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">"
356 /** put the data here, stupid */
357 calendar_month_view_display_events(thetime);
361 /** After displaying Saturday, end the row */
366 thetime += (time_t)86400; /** ahead 24 hours */
369 wprintf("</table>" /** end of inner table */
370 "</td></tr></table>" /** end of outer table */
373 /* Initialize the bubble tooltips */
374 wprintf("<script type=\"text/javascript\" src=\"static/BubbleTooltips.js\"></script>\n"
375 "<script type=\"text/javascript\">btt_enableTooltips('inner_month');</script>\n"
380 * \brief view one month. brief view
381 * \param year the year
382 * \param month the month
383 * \param day the actual day we want to see
385 void calendar_brief_month_view(int year, int month, int day) {
386 struct tm starting_tm;
390 time_t previous_month;
392 char month_label[32];
394 /** Determine what day to start.
395 * First, back up to the 1st of the month...
397 memset(&starting_tm, 0, sizeof(struct tm));
398 starting_tm.tm_year = year - 1900;
399 starting_tm.tm_mon = month - 1;
400 starting_tm.tm_mday = day;
401 thetime = mktime(&starting_tm);
403 memcpy(&tm, &starting_tm, sizeof(struct tm));
404 while (tm.tm_mday != 1) {
405 thetime = thetime - (time_t)86400; /* go back 24 hours */
406 localtime_r(&thetime, &tm);
409 /** Determine previous and next months ... for links */
410 previous_month = thetime - (time_t)864000L; /* back 10 days */
411 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
413 /** Now back up until we're on a Sunday */
414 localtime_r(&thetime, &tm);
415 while (tm.tm_wday != 0) {
416 thetime = thetime - (time_t)86400; /* go back 24 hours */
417 localtime_r(&thetime, &tm);
420 /** Outer table (to get the background color) */
421 wprintf("<div class=\"fix_scrollbar_bug\">"
422 "<table width=100%% border=0 cellpadding=0 cellspacing=0 "
423 "bgcolor=#204B78><TR><TD>\n");
425 wprintf("<table width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
427 wprintf("<td align=center>");
429 localtime_r(&previous_month, &tm);
430 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
431 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
432 wprintf("<img align=middle src=\"static/prevdate_32x.gif\" border=0></A>\n");
434 wc_strftime(month_label, sizeof month_label, "%B", &tm);
435 wprintf(" "
436 "<font size=+1 color=\"#FFFFFF\">"
439 " ", month_label, year);
441 localtime_r(&next_month, &tm);
442 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
443 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
444 wprintf("<img align=middle src=\"static/nextdate_32x.gif\" border=0></A>\n");
446 wprintf("</td></tr></table>\n");
448 /** Inner table (the real one) */
449 wprintf("<table width=100%% border=0 cellpadding=1 cellspacing=1 "
450 "bgcolor=#EEEECC><TR>");
452 wprintf("<tr><td colspan=\"100%\">\n");
454 /** Now do 35 days */
455 for (i = 0; i < 35; ++i) {
456 char weeknumber[255];
457 char weekday_name[32];
459 localtime_r(&thetime, &tm);
462 /** Before displaying Sunday, start a new CELL */
464 wc_strftime(&weeknumber[0], sizeof(weeknumber), "%U", &tm);
465 wprintf("<table border='0' bgcolor=\"#EEEECC\" width='100%'> <tr><th colspan='4'>%s %s</th></tr>"
466 " <tr><td>%s</td><td width='70%'>%s</td><td>%s</td><td>%s</td></tr>\n",
476 daycolor=((tm.tm_mon != month-1) ? "DDDDDD" :
477 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
481 wc_strftime(weekday_name, sizeof weekday_name, "%A", &tm);
482 wprintf("<tr><td bgcolor='%s' colspan='1' align='left'> %s,%i."
483 "</td><td bgcolor='%s' colspan='3'><hr></td></tr>\n",
485 weekday_name,tm.tm_mday,
488 /** put the data of one day here, stupid */
489 calendar_month_view_brief_events(thetime, daycolor);
492 /** After displaying Saturday, end the row */
494 wprintf("</td></tr></table>\n");
497 thetime += (time_t)86400; /** ahead 24 hours */
500 wprintf("</table>" /** end of inner table */
501 "</td></tr></table>" /** end of outer table */
506 * \brief view one week
507 * this should view just one week, but it's not here yet.
508 * \todo ny implemented
509 * \param year the year
510 * \param month the month
511 * \param day the day which we want to see the week around
513 void calendar_week_view(int year, int month, int day) {
514 wprintf("<center><i>week view FIXME</i></center><br />\n");
519 * \brief display one day
520 * Display events for a particular hour of a particular day.
521 * (Specify hour < 0 to show "all day" events)
522 * \param year the year
523 * \param month the month
525 * \param hour the hour we want to start displaying?????
527 void calendar_day_view_display_events(int year, int month,
531 struct icaltimetype t;
534 int all_day_event = 0;
536 if (WC->num_cal == 0) {
537 // \todo FIXME wprintf("<br /><br /><br />\n");
541 for (i=0; i<(WC->num_cal); ++i) {
542 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
543 ICAL_DTSTART_PROPERTY);
545 t = icalproperty_get_dtstart(p);
546 event_tt = icaltime_as_timet(t);
555 event_tm = gmtime(&event_tt);
558 event_tm = localtime(&event_tt);
561 if ((event_tm->tm_year == (year-1900))
562 && (event_tm->tm_mon == (month-1))
563 && (event_tm->tm_mday == day)
564 && ( ((event_tm->tm_hour == hour)&&(!t.is_date)) || ((hour<0)&&(t.is_date)) )
568 p = icalcomponent_get_first_property(
570 ICAL_SUMMARY_PROPERTY);
574 wprintf("<table border=1 cellpadding=2><TR>"
575 "<td bgcolor=\"#CCCCCC\">"
579 wprintf("<font size=-1>"
580 "<a href=\"display_edit_event?msgnum=%ld&calview=day&year=%d&month=%d&day=%d\">",
581 WC->disp_cal[i].cal_msgnum,
585 icalproperty_get_comment(p));
586 wprintf("</a></font><br />\n");
589 wprintf("</td></tr></table>");
602 * \brief view one day
603 * \param year the year
604 * \param month the month
605 * \param day the day we want to display
607 void calendar_day_view(int year, int month, int day) {
609 struct icaltimetype today, yesterday, tomorrow;
610 char calhourformat[16];
613 char daystart_str[16], dayend_str[16];
617 get_preference("calhourformat", calhourformat, sizeof calhourformat);
618 get_preference("daystart", daystart_str, sizeof daystart_str);
619 if (strlen(daystart_str) > 0) daystart = atoi(daystart_str);
620 get_preference("dayend", dayend_str, sizeof dayend_str);
621 if (strlen(dayend_str) > 0) dayend = atoi(dayend_str);
624 /** Figure out the dates for "yesterday" and "tomorrow" links */
626 memset(&today, 0, sizeof(struct icaltimetype));
632 memcpy(&yesterday, &today, sizeof(struct icaltimetype));
634 yesterday = icaltime_normalize(yesterday);
636 memcpy(&tomorrow, &today, sizeof(struct icaltimetype));
638 tomorrow = icaltime_normalize(tomorrow);
641 /** Outer table (to get the background color) */
642 wprintf("<div class=\"fix_scrollbar_bug\">"
643 "<table width=100%% border=0 cellpadding=0 cellspacing=0 "
644 "bgcolor=#204B78><tr><td>\n");
646 /** Inner table (the real one) */
647 wprintf("<table width=100%% border=0 cellpadding=1 cellspacing=1 "
648 "bgcolor=#204B78><tr>\n");
650 /** Innermost table (contains hours etc.) */
651 wprintf("<td width=80%%>"
652 "<table width=100%% border=0 cellpadding=1 cellspacing=1 "
653 "bgcolor=#204B78>\n");
655 /** Display events before 8:00 (hour=-1 is all-day events) */
657 "<td bgcolor=\"#CCCCDD\" valign=middle width=10%%></td>"
658 "<td bgcolor=\"#FFFFFF\" valign=top>");
659 for (hour = (-1); hour <= (daystart-1); ++hour) {
660 calendar_day_view_display_events(year, month, day, hour);
662 wprintf("</td></tr>\n");
664 /** Now the middle of the day... */
665 for (hour = daystart; hour <= dayend; ++hour) { /* could do HEIGHT=xx */
666 wprintf("<tr height=30><td bgcolor=\"#CCCCDD\" align=middle "
667 "valign=middle width=10%%>");
668 wprintf("<a href=\"display_edit_event?msgnum=0"
669 "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
670 year, month, day, hour
673 if (!strcasecmp(calhourformat, "24")) {
674 wprintf("%2d:00</a> ", hour);
677 wprintf("%d:00%s</a> ",
678 (hour <= 12 ? hour : hour-12),
679 (hour < 12 ? "am" : "pm")
683 wprintf("</td><td bgcolor=\"#FFFFFF\" valign=top>");
685 /* put the data here, stupid */
686 calendar_day_view_display_events(year, month, day, hour);
688 wprintf("</td></tr>\n");
691 /** Display events after 5:00... */
693 "<td bgcolor=\"#CCCCDD\" valign=middle width=10%%></td>"
694 "<td bgcolor=\"#FFFFFF\" valign=top>");
695 for (hour = (dayend+1); hour <= 23; ++hour) {
696 calendar_day_view_display_events(year, month, day, hour);
698 wprintf("</td></tr>\n");
701 wprintf("</table>" /* end of innermost table */
705 wprintf("<td width=20%% valign=top>"); /* begin stuff-on-the-right */
708 /** Begin todays-date-with-left-and-right-arrows */
709 wprintf("<table border=0 width=100%% "
710 "cellspacing=0 cellpadding=0 bgcolor=\"#FFFFFF\">\n");
714 wprintf("<td align=center>");
715 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
716 yesterday.year, yesterday.month, yesterday.day);
717 wprintf("<img align=middle src=\"static/prevdate_32x.gif\" border=0></A>");
721 memset(&d_tm, 0, sizeof d_tm);
722 d_tm.tm_year = year - 1900;
723 d_tm.tm_mon = month - 1;
725 wc_strftime(d_str, sizeof d_str,
727 "<font size=+2>%B</font><br />"
728 "<font size=+3>%d</font><br />"
729 "<font size=+2>%Y</font><br />"
733 wprintf("%s", d_str);
736 wprintf("<td align=center>");
737 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
738 tomorrow.year, tomorrow.month, tomorrow.day);
739 wprintf("<img align=middle src=\"static/nextdate_32x.gif\""
743 wprintf("</tr></table>\n");
744 /** End todays-date-with-left-and-right-arrows */
746 /** \todo In the future we might want to put a month-o-matic here */
748 wprintf("</font></center>\n");
750 wprintf("</td>"); /** end stuff-on-the-right */
754 wprintf("</tr></table>" /** end of inner table */
755 "</td></tr></table></div>" /** end of outer table */
763 * \brief Display today's events.
765 void calendar_summary_view(void) {
768 struct icaltimetype t;
773 int all_day_event = 0;
774 char timestring[SIZ];
776 if (WC->num_cal == 0) {
781 localtime_r(&now, &today_tm);
783 for (i=0; i<(WC->num_cal); ++i) {
784 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
785 ICAL_DTSTART_PROPERTY);
787 t = icalproperty_get_dtstart(p);
788 event_tt = icaltime_as_timet(t);
795 fmt_time(timestring, event_tt);
798 gmtime_r(&event_tt, &event_tm);
801 localtime_r(&event_tt, &event_tm);
804 if ( (event_tm.tm_year == today_tm.tm_year)
805 && (event_tm.tm_mon == today_tm.tm_mon)
806 && (event_tm.tm_mday == today_tm.tm_mday)
810 p = icalcomponent_get_first_property(
812 ICAL_SUMMARY_PROPERTY);
815 icalproperty_get_comment(p));
816 wprintf(" (%s)<br />\n", timestring);
821 free_calendar_buffer();
826 * \brief clean up ical memory
827 * \todo this could get troubel with future ical versions
829 void free_calendar_buffer(void) {
831 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
832 icalcomponent_free(WC->disp_cal[i].cal);
842 * \brief do the whole calendar page
843 * view any part of the calender. decide which way, etc.
845 void do_calendar_view(void) {
848 int year, month, day;
851 /** In case no date was specified, go with today */
853 localtime_r(&now, &tm);
854 year = tm.tm_year + 1900;
855 month = tm.tm_mon + 1;
858 /** Now see if a date was specified */
859 if (strlen(bstr("year")) > 0) year = atoi(bstr("year"));
860 if (strlen(bstr("month")) > 0) month = atoi(bstr("month"));
861 if (strlen(bstr("day")) > 0) day = atoi(bstr("day"));
863 /** How would you like that cooked? */
864 if (strlen(bstr("calview")) > 0) {
865 strcpy(calview, bstr("calview"));
868 strcpy(calview, "month");
871 /** Display the selected view */
872 if (!strcasecmp(calview, "day")) {
873 calendar_day_view(year, month, day);
875 else if (!strcasecmp(calview, "week")) {
876 calendar_week_view(year, month, day);
879 if (WC->wc_view == VIEW_CALBRIEF) {
880 calendar_brief_month_view(year, month, day);
883 calendar_month_view(year, month, day);
887 /** Free the calendar stuff */
888 free_calendar_buffer();
894 * \brief get task due date
895 * Helper function for do_tasks_view().
896 * \param vtodo a task to get the due date
897 * \return the date/time due.
899 time_t get_task_due_date(icalcomponent *vtodo) {
907 * If we're looking at a fully encapsulated VCALENDAR
908 * rather than a VTODO component, recurse into the data
909 * structure until we get a VTODO.
911 if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) {
912 return get_task_due_date(
913 icalcomponent_get_first_component(
914 vtodo, ICAL_VTODO_COMPONENT
919 p = icalcomponent_get_first_property(vtodo, ICAL_DUE_PROPERTY);
921 return(icaltime_as_timet(icalproperty_get_due(p)));
930 * \brief Compare the due dates of two tasks (this is for sorting)
931 * \param task1 first task to compare
932 * \param task2 second task to compare
934 int task_due_cmp(const void *task1, const void *task2) {
938 t1 = get_task_due_date(((struct disp_cal *)task1)->cal);
939 t2 = get_task_due_date(((struct disp_cal *)task2)->cal);
941 if (t1 < t2) return(-1);
942 if (t1 > t2) return(1);
950 * \brief do the whole task view stuff
952 void do_tasks_view(void) {
959 wprintf("<div class=\"fix_scrollbar_bug\">"
960 "<table border=0 cellspacing=0 width=100%% bgcolor=\"#FFFFFF\">\n<tr>\n"
962 wprintf(_("Name of task"));
963 wprintf("</th><th>");
964 wprintf(_("Date due"));
965 wprintf("</th></tr>\n"
968 /** Sort them if necessary */
969 if (WC->num_cal > 1) {
972 sizeof(struct disp_cal),
977 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
980 wprintf("<tr bgcolor=\"#%s\"><td>",
981 (bg ? "DDDDDD" : "FFFFFF")
984 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
985 ICAL_SUMMARY_PROPERTY);
986 wprintf("<a href=\"display_edit_task?msgnum=%ld&taskrm=",
987 WC->disp_cal[i].cal_msgnum );
988 urlescputs(WC->wc_roomname);
990 wprintf("<img align=middle "
991 "src=\"static/taskmanag_16x.gif\" border=0> ");
993 escputs((char *)icalproperty_get_comment(p));
998 due = get_task_due_date(WC->disp_cal[i].cal);
999 fmt_date(buf, due, 0);
1000 wprintf("<td><font");
1001 if (due < time(NULL)) {
1002 wprintf(" color=\"#FF0000\"");
1004 wprintf(">%s</font></td></tr>\n", buf);
1007 wprintf("</table></div>\n");
1009 /** Free the list */
1010 free_calendar_buffer();
1014 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */