X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fcalendar_view.c;h=4796713174648eb902be7ac40616ca46f5a92efb;hb=2362c3d4de86f20822ab81015222a196137fd20e;hp=ea2a3a995f18c78fd548c82c3da923ffc0762577;hpb=79446540dc9252f6bac460e9f20664377964549b;p=citadel.git diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index ea2a3a995..479671317 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -1,130 +1,646 @@ /* * $Id$ + * + * Handles the HTML display of calendar items. */ -/** - * \defgroup CalHtmlHandles Handles the HTML display of calendar items. - */ -/*@{*/ + #include "webcit.h" #include "webserver.h" -#ifndef WEBCIT_WITH_CALENDAR_SERVICE -/**\brief stub for non-libical builds */ -void do_calendar_view(void) { - wprintf("
%c | ", colheader_label[0]); + + } + wprintf("|
---|---|
%d | ", url, tm.tm_mday); + } + else { + wprintf(""); + } + + /** After displaying one week, end the row */ + if ((i % 7) == 6) { + wprintf(" |
"
- );
- }
+ /*
+ * Now back up to the 1st of the month...
+ */
+ memset(&starting_tm, 0, sizeof(struct tm));
- wprintf(""
- "",
- WC->disp_cal[i].cal_msgnum,
- bstr("calview"),
- bstr("year"),
- bstr("month"),
- bstr("day")
- );
- escputs((char *)
- icalproperty_get_comment(p));
- wprintf(" \n"); + starting_tm.tm_year = year - 1900; + starting_tm.tm_mon = month - 1; + starting_tm.tm_mday = day; + thetime = mktime(&starting_tm); - if (all_day_event) { - wprintf(" |
"
- );
- }
+ if (event_te.tm_mday != day) event_te.tm_hour = 0;
+ if (event_tm.tm_mday != day) event_tm.tm_hour = 24;
- wprintf(""
- "",
- WC->disp_cal[i].cal_msgnum,
- year, month, day
- );
- escputs((char *)
- icalproperty_get_comment(p));
- wprintf(" \n"); + /* Calculate the location of the top of the box */ + if (event_te.tm_hour < dstart) { + startmin = diffmin = event_te.tm_min / 6; + top = (event_te.tm_hour * 10) + startmin; + } + else if ((event_te.tm_hour >= dstart) && (event_te.tm_hour <= dend)) { + startmin = diffmin = (event_te.tm_min / 2); + top = (dstart * 10) + ((event_te.tm_hour - dstart) * 30) + startmin; + } + else if (event_te.tm_hour >dend) { + startmin = diffmin = event_te.tm_min / 6; + top = (dstart * 10) + ((dend - dstart - 1) * 30) + ((event_tm.tm_hour - dend + 1) * 10) + startmin ; + } + else { + /* should never get here */ + } - if (all_day_event) { - wprintf(" |