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 wc_strftime(&sbuf[0], sizeof(sbuf), timeformat, &event_tms);
200 wc_strftime(&ebuf[0], sizeof(sbuf), timeformat, &event_tme);
202 wprintf("</a></font></td>"
203 "<td bgcolor='%s'>%s</td><td bgcolor='%s'>%s</td></tr>",
220 * \brief view one month. pretty view
221 * \param year the year
222 * \param month the month
223 * \param day the actual day we want to see
225 void calendar_month_view(int year, int month, int day) {
226 struct tm starting_tm;
230 time_t previous_month;
232 time_t colheader_time;
233 struct tm colheader_tm;
234 char colheader_label[32];
236 /** Determine what day to start.
237 * First, back up to the 1st of the month...
239 memset(&starting_tm, 0, sizeof(struct tm));
240 starting_tm.tm_year = year - 1900;
241 starting_tm.tm_mon = month - 1;
242 starting_tm.tm_mday = day;
243 thetime = mktime(&starting_tm);
245 memcpy(&tm, &starting_tm, sizeof(struct tm));
246 while (tm.tm_mday != 1) {
247 thetime = thetime - (time_t)86400; /* go back 24 hours */
248 localtime_r(&thetime, &tm);
251 /** Determine previous and next months ... for links */
252 previous_month = thetime - (time_t)864000L; /* back 10 days */
253 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
255 /** Now back up until we're on a Sunday */
256 localtime_r(&thetime, &tm);
257 while (tm.tm_wday != 0) {
258 thetime = thetime - (time_t)86400; /* go back 24 hours */
259 localtime_r(&thetime, &tm);
262 /** Outer table (to get the background color) */
263 wprintf("<div class=\"fix_scrollbar_bug\">"
264 "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
265 "bgcolor=#204B78><TR><TD>\n");
267 wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
269 wprintf("<TD ALIGN=CENTER>");
271 localtime_r(&previous_month, &tm);
272 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
273 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
274 wprintf("<IMG ALIGN=MIDDLE src=\"static/prevdate_32x.gif\" BORDER=0></A>\n");
276 wc_strftime(colheader_label, sizeof colheader_label, "%B", &starting_tm);
277 wprintf(" "
278 "<FONT SIZE=+1 COLOR=\"#FFFFFF\">"
281 " ", colheader_label, year);
283 localtime_r(&next_month, &tm);
284 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
285 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
286 wprintf("<IMG ALIGN=MIDDLE src=\"static/nextdate_32x.gif\" BORDER=0></A>\n");
288 wprintf("</TD></TR></TABLE>\n");
290 /** Inner table (the real one) */
291 wprintf("<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
292 "bgcolor=#204B78><TR>");
293 colheader_time = thetime;
294 for (i=0; i<7; ++i) {
295 colheader_time = thetime + (i * 86400) ;
296 localtime_r(&colheader_time, &colheader_tm);
297 wc_strftime(colheader_label, sizeof colheader_label, "%A", &colheader_tm);
298 wprintf("<TD ALIGN=CENTER WIDTH=14%%>"
299 "<FONT COLOR=\"#FFFFFF\">%s</FONT></TH>", colheader_label);
303 /** Now do 35 days */
304 for (i = 0; i < 35; ++i) {
305 localtime_r(&thetime, &tm);
307 /** Before displaying Sunday, start a new row */
312 wprintf("<TD BGCOLOR=\"#%s\" WIDTH=14%% HEIGHT=60 align=left VALIGN=TOP><B>",
313 ((tm.tm_mon != month-1) ? "DDDDDD" :
314 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
317 if ((i==0) || (tm.tm_mday == 1)) {
318 wc_strftime(colheader_label, sizeof colheader_label, "%B", &tm);
319 wprintf("%s ", colheader_label);
321 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">"
328 /** put the data here, stupid */
329 calendar_month_view_display_events(thetime);
333 /** After displaying Saturday, end the row */
338 thetime += (time_t)86400; /** ahead 24 hours */
341 wprintf("</TABLE>" /** end of inner table */
342 "</TD></TR></TABLE>" /** end of outer table */
347 * \brief view one month. brief view
348 * \param year the year
349 * \param month the month
350 * \param day the actual day we want to see
352 void calendar_brief_month_view(int year, int month, int day) {
353 struct tm starting_tm;
357 time_t previous_month;
359 char month_label[32];
361 /** Determine what day to start.
362 * First, back up to the 1st of the month...
364 memset(&starting_tm, 0, sizeof(struct tm));
365 starting_tm.tm_year = year - 1900;
366 starting_tm.tm_mon = month - 1;
367 starting_tm.tm_mday = day;
368 thetime = mktime(&starting_tm);
370 memcpy(&tm, &starting_tm, sizeof(struct tm));
371 while (tm.tm_mday != 1) {
372 thetime = thetime - (time_t)86400; /* go back 24 hours */
373 localtime_r(&thetime, &tm);
376 /** Determine previous and next months ... for links */
377 previous_month = thetime - (time_t)864000L; /* back 10 days */
378 next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
380 /** Now back up until we're on a Sunday */
381 localtime_r(&thetime, &tm);
382 while (tm.tm_wday != 0) {
383 thetime = thetime - (time_t)86400; /* go back 24 hours */
384 localtime_r(&thetime, &tm);
387 /** Outer table (to get the background color) */
388 wprintf("<div class=\"fix_scrollbar_bug\">"
389 "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
390 "bgcolor=#204B78><TR><TD>\n");
392 wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
394 wprintf("<TD ALIGN=CENTER>");
396 localtime_r(&previous_month, &tm);
397 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
398 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
399 wprintf("<IMG ALIGN=MIDDLE src=\"static/prevdate_32x.gif\" BORDER=0></A>\n");
401 wc_strftime(month_label, sizeof month_label, "%B", &tm);
402 wprintf(" "
403 "<FONT SIZE=+1 COLOR=\"#FFFFFF\">"
406 " ", month_label, year);
408 localtime_r(&next_month, &tm);
409 wprintf("<a href=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
410 (int)(tm.tm_year)+1900, tm.tm_mon + 1);
411 wprintf("<IMG ALIGN=MIDDLE src=\"static/nextdate_32x.gif\" BORDER=0></A>\n");
413 wprintf("</TD></TR></TABLE>\n");
415 /** Inner table (the real one) */
416 wprintf("<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
417 "bgcolor=#EEEECC><TR>");
419 wprintf("<TR><TD COLSPAN=\"100%\">\n");
421 /** Now do 35 days */
422 for (i = 0; i < 35; ++i) {
423 char weeknumber[255];
424 char weekday_name[32];
426 localtime_r(&thetime, &tm);
429 /** Before displaying Sunday, start a new CELL */
431 wc_strftime(&weeknumber[0], sizeof(weeknumber), "%U", &tm);
432 wprintf("<TABLE border='0' BGCOLOR=\"#EEEECC\" width='100%'> <tr><th colspan='4'>%s %s</th></tr>"
433 " <tr><td>%s</td><td width='70%'>%s</td><td>%s</td><td>%s</td></tr>\n",
443 daycolor=((tm.tm_mon != month-1) ? "DDDDDD" :
444 ((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
448 wc_strftime(weekday_name, sizeof weekday_name, "%A", &tm);
449 wprintf("<tr><td BGCOLOR='%s' colspan='1' align='left'> %s"
450 "</td><td BGCOLOR='%s' colspan='3'><hr></td></tr>\n",
455 /** put the data of one day here, stupid */
456 calendar_month_view_brief_events(thetime, daycolor);
459 /** After displaying Saturday, end the row */
461 wprintf("</td></tr></table>\n");
464 thetime += (time_t)86400; /** ahead 24 hours */
467 wprintf("</TABLE>" /** end of inner table */
468 "</TD></TR></TABLE>" /** end of outer table */
473 * \brief view one week
474 * this should view just one week, but it's not here yet.
475 * \todo ny implemented
476 * \param year the year
477 * \param month the month
478 * \param day the day which we want to see the week around
480 void calendar_week_view(int year, int month, int day) {
481 wprintf("<CENTER><I>week view FIXME</I></CENTER><br />\n");
486 * \brief display one day
487 * Display events for a particular hour of a particular day.
488 * (Specify hour < 0 to show "all day" events)
489 * \param year the year
490 * \param month the month
492 * \param hour the hour we want to start displaying?????
494 void calendar_day_view_display_events(int year, int month,
498 struct icaltimetype t;
501 int all_day_event = 0;
503 if (WC->num_cal == 0) {
504 // \todo FIXME wprintf("<br /><br /><br />\n");
508 for (i=0; i<(WC->num_cal); ++i) {
509 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
510 ICAL_DTSTART_PROPERTY);
512 t = icalproperty_get_dtstart(p);
513 event_tt = icaltime_as_timet(t);
522 event_tm = gmtime(&event_tt);
525 event_tm = localtime(&event_tt);
528 if ((event_tm->tm_year == (year-1900))
529 && (event_tm->tm_mon == (month-1))
530 && (event_tm->tm_mday == day)
531 && ( ((event_tm->tm_hour == hour)&&(!t.is_date)) || ((hour<0)&&(t.is_date)) )
535 p = icalcomponent_get_first_property(
537 ICAL_SUMMARY_PROPERTY);
541 wprintf("<TABLE border=1 cellpadding=2><TR>"
542 "<TD BGCOLOR=\"#CCCCCC\">"
546 wprintf("<FONT SIZE=-1>"
547 "<a href=\"display_edit_event?msgnum=%ld&calview=day&year=%d&month=%d&day=%d\">",
548 WC->disp_cal[i].cal_msgnum,
552 icalproperty_get_comment(p));
553 wprintf("</A></FONT><br />\n");
556 wprintf("</TD></TR></TABLE>");
569 * \brief view one day
570 * \param year the year
571 * \param month the month
572 * \param day the day we want to display
574 void calendar_day_view(int year, int month, int day) {
576 struct icaltimetype today, yesterday, tomorrow;
577 char calhourformat[16];
580 char daystart_str[16], dayend_str[16];
582 get_preference("calhourformat", calhourformat, sizeof calhourformat);
583 get_preference("daystart", daystart_str, sizeof daystart_str);
584 if (strlen(daystart_str) > 0) daystart = atoi(daystart_str);
585 get_preference("dayend", dayend_str, sizeof dayend_str);
586 if (strlen(dayend_str) > 0) dayend = atoi(dayend_str);
589 /** Figure out the dates for "yesterday" and "tomorrow" links */
591 memset(&today, 0, sizeof(struct icaltimetype));
597 memcpy(&yesterday, &today, sizeof(struct icaltimetype));
599 yesterday = icaltime_normalize(yesterday);
601 memcpy(&tomorrow, &today, sizeof(struct icaltimetype));
603 tomorrow = icaltime_normalize(tomorrow);
606 /** Outer table (to get the background color) */
607 wprintf("<div class=\"fix_scrollbar_bug\">"
608 "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
609 "bgcolor=#204B78><TR><TD>\n");
611 /** Inner table (the real one) */
612 wprintf("<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
613 "bgcolor=#204B78><TR>\n");
615 /** Innermost table (contains hours etc.) */
616 wprintf("<TD WIDTH=80%%>"
617 "<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
618 "bgcolor=#204B78>\n");
620 /** Display events before 8:00 (hour=-1 is all-day events) */
622 "<TD BGCOLOR=\"#CCCCDD\" VALIGN=MIDDLE WIDTH=10%%></TD>"
623 "<TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
624 for (hour = (-1); hour <= (daystart-1); ++hour) {
625 calendar_day_view_display_events(year, month, day, hour);
627 wprintf("</TD></TR>\n");
629 /** Now the middle of the day... */
630 for (hour = daystart; hour <= dayend; ++hour) { /* could do HEIGHT=xx */
631 wprintf("<TR HEIGHT=30><TD BGCOLOR=\"#CCCCDD\" ALIGN=MIDDLE "
632 "VALIGN=MIDDLE WIDTH=10%%>");
633 wprintf("<a href=\"display_edit_event?msgnum=0"
634 "&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
635 year, month, day, hour
638 if (!strcasecmp(calhourformat, "24")) {
639 wprintf("%2d:00</A> ", hour);
642 wprintf("%d:00%s</A> ",
643 (hour <= 12 ? hour : hour-12),
644 (hour < 12 ? "am" : "pm")
648 wprintf("</TD><TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
650 /* put the data here, stupid */
651 calendar_day_view_display_events(year, month, day, hour);
653 wprintf("</TD></TR>\n");
656 /** Display events after 5:00... */
658 "<TD BGCOLOR=\"#CCCCDD\" VALIGN=MIDDLE WIDTH=10%%></TD>"
659 "<TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
660 for (hour = (dayend+1); hour <= 23; ++hour) {
661 calendar_day_view_display_events(year, month, day, hour);
663 wprintf("</TD></TR>\n");
666 wprintf("</TABLE>" /* end of innermost table */
670 wprintf("<TD WIDTH=20%% VALIGN=top>"); /* begin stuff-on-the-right */
673 /** Begin todays-date-with-left-and-right-arrows */
674 wprintf("<TABLE BORDER=0 WIDTH=100%% "
675 "CELLSPACING=0 CELLPADDING=0 BGCOLOR=\"#FFFFFF\">\n");
679 wprintf("<TD ALIGN=CENTER>");
680 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
681 yesterday.year, yesterday.month, yesterday.day);
682 wprintf("<IMG ALIGN=MIDDLE src=\"static/prevdate_32x.gif\" BORDER=0></A>");
686 wprintf("<TD ALIGN=CENTER>");
687 wprintf("<FONT SIZE=+2>%s</FONT><br />"
688 "<FONT SIZE=+3>%d</FONT><br />"
689 "<FONT SIZE=+2>%d</FONT><br />",
695 wprintf("<TD ALIGN=CENTER>");
696 wprintf("<a href=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
697 tomorrow.year, tomorrow.month, tomorrow.day);
698 wprintf("<IMG ALIGN=MIDDLE src=\"static/nextdate_32x.gif\""
702 wprintf("</TR></TABLE>\n");
703 /** End todays-date-with-left-and-right-arrows */
705 /** \todo In the future we might want to put a month-o-matic here */
707 wprintf("</FONT></CENTER>\n");
709 wprintf("</TD>"); /** end stuff-on-the-right */
713 wprintf("</TR></TABLE>" /** end of inner table */
714 "</TD></TR></TABLE></div>" /** end of outer table */
722 * \brief Display today's events.
724 void calendar_summary_view(void) {
727 struct icaltimetype t;
732 int all_day_event = 0;
733 char timestring[SIZ];
735 if (WC->num_cal == 0) {
740 localtime_r(&now, &today_tm);
742 for (i=0; i<(WC->num_cal); ++i) {
743 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
744 ICAL_DTSTART_PROPERTY);
746 t = icalproperty_get_dtstart(p);
747 event_tt = icaltime_as_timet(t);
754 fmt_time(timestring, event_tt);
757 gmtime_r(&event_tt, &event_tm);
760 localtime_r(&event_tt, &event_tm);
763 if ( (event_tm.tm_year == today_tm.tm_year)
764 && (event_tm.tm_mon == today_tm.tm_mon)
765 && (event_tm.tm_mday == today_tm.tm_mday)
769 p = icalcomponent_get_first_property(
771 ICAL_SUMMARY_PROPERTY);
774 icalproperty_get_comment(p));
775 wprintf(" (%s)<br />\n", timestring);
780 free_calendar_buffer();
785 * \brief clean up ical memory
786 * \todo this could get troubel with future ical versions
788 void free_calendar_buffer(void) {
790 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
791 icalcomponent_free(WC->disp_cal[i].cal);
801 * \brief do the whole calendar page
802 * view any part of the calender. decide which way, etc.
804 void do_calendar_view(void) {
807 int year, month, day;
810 /** In case no date was specified, go with today */
812 localtime_r(&now, &tm);
813 year = tm.tm_year + 1900;
814 month = tm.tm_mon + 1;
817 /** Now see if a date was specified */
818 if (strlen(bstr("year")) > 0) year = atoi(bstr("year"));
819 if (strlen(bstr("month")) > 0) month = atoi(bstr("month"));
820 if (strlen(bstr("day")) > 0) day = atoi(bstr("day"));
822 /** How would you like that cooked? */
823 if (strlen(bstr("calview")) > 0) {
824 strcpy(calview, bstr("calview"));
827 strcpy(calview, "month");
830 /** Display the selected view */
831 if (!strcasecmp(calview, "day")) {
832 calendar_day_view(year, month, day);
834 else if (!strcasecmp(calview, "week")) {
835 calendar_week_view(year, month, day);
838 if (WC->wc_view == VIEW_CALBRIEF) {
839 calendar_brief_month_view(year, month, day);
842 calendar_month_view(year, month, day);
846 /** Free the calendar stuff */
847 free_calendar_buffer();
853 * \brief get task due date
854 * Helper function for do_tasks_view().
855 * \param vtodo a task to get the due date
856 * \return the date/time due.
858 time_t get_task_due_date(icalcomponent *vtodo) {
866 * If we're looking at a fully encapsulated VCALENDAR
867 * rather than a VTODO component, recurse into the data
868 * structure until we get a VTODO.
870 if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) {
871 return get_task_due_date(
872 icalcomponent_get_first_component(
873 vtodo, ICAL_VTODO_COMPONENT
878 p = icalcomponent_get_first_property(vtodo, ICAL_DUE_PROPERTY);
880 return(icaltime_as_timet(icalproperty_get_due(p)));
889 * \brief Compare the due dates of two tasks (this is for sorting)
890 * \param task1 first task to compare
891 * \param task2 second task to compare
893 int task_due_cmp(const void *task1, const void *task2) {
897 t1 = get_task_due_date(((struct disp_cal *)task1)->cal);
898 t2 = get_task_due_date(((struct disp_cal *)task2)->cal);
900 if (t1 < t2) return(-1);
901 if (t1 > t2) return(1);
909 * \brief do the whole task view stuff
911 void do_tasks_view(void) {
918 wprintf("<div class=\"fix_scrollbar_bug\">"
919 "<table border=0 cellspacing=0 width=100%% bgcolor=\"#FFFFFF\">\n<tr>\n"
921 wprintf(_("Name of task"));
922 wprintf("</TH><TH>");
923 wprintf(_("Date due"));
924 wprintf("</TH></TR>\n"
927 /** Sort them if necessary */
928 if (WC->num_cal > 1) {
931 sizeof(struct disp_cal),
936 if (WC->num_cal) for (i=0; i<(WC->num_cal); ++i) {
939 wprintf("<TR BGCOLOR=\"#%s\"><TD>",
940 (bg ? "DDDDDD" : "FFFFFF")
943 p = icalcomponent_get_first_property(WC->disp_cal[i].cal,
944 ICAL_SUMMARY_PROPERTY);
945 wprintf("<a href=\"display_edit_task?msgnum=%ld&taskrm=",
946 WC->disp_cal[i].cal_msgnum );
947 urlescputs(WC->wc_roomname);
949 wprintf("<IMG ALIGN=MIDDLE "
950 "src=\"static/taskmanag_16x.gif\" BORDER=0> ");
952 escputs((char *)icalproperty_get_comment(p));
957 due = get_task_due_date(WC->disp_cal[i].cal);
958 fmt_date(buf, due, 0);
959 wprintf("<TD><FONT");
960 if (due < time(NULL)) {
961 wprintf(" COLOR=\"#FF0000\"");
963 wprintf(">%s</FONT></TD></TR>\n", buf);
966 wprintf("</table></div>\n");
969 free_calendar_buffer();
973 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */