}
wprintf("</SELECT>\n");
+ wprintf("<INPUT TYPE=\"checkbox\" NAME=\"%s_alldayevent\" "
+ "VALUE=\"yes\" %s> All day event",
+ prefix,
+ ((t->is_date) ? "CHECKED" : ""));
}
sprintf(vname, "%s_hour", prefix); t.hour = atoi(bstr(vname));
sprintf(vname, "%s_minute", prefix); t.minute = atoi(bstr(vname));
+ sprintf(vname, "%s_alldayevent", prefix);
+ if (!strcasecmp(bstr(vname), "yes")) {
+ t.hour = 0;
+ t.minute = 0;
+ t.is_date = 1;
+ }
+
t = icaltime_normalize(t);
return(t);
}
}
-void calendar_day_view(int year, int month, int day) {
- struct tm starting_tm;
- time_t thetime;
+/*
+ * Display events for a particular hour of a particular day.
+ * (Specify hour < 0 to show "all day" events)
+ */
+void calendar_day_view_display_events(int year, int month,
+ int day, int hour) {
int i;
+ icalproperty *p;
+ struct icaltimetype t;
- /* Determine what day we're viewing.
- */
- memset(&starting_tm, 0, sizeof(struct tm));
- starting_tm.tm_year = year - 1900;
- starting_tm.tm_mon = month - 1;
- starting_tm.tm_mday = day;
- thetime = mktime(&starting_tm);
+ if (WC->num_cal == 0) {
+ wprintf("<BR><BR><BR>\n");
+ return;
+ }
+
+ for (i=0; i<(WC->num_cal); ++i) {
+ p = icalcomponent_get_first_property(WC->disp_cal[i],
+ ICAL_DTSTART_PROPERTY);
+ if (p != NULL) {
+ t = icalproperty_get_dtstart(p);
+ if ((t.year == year)
+ && (t.month == month)
+ && (t.day == day)
+ && ( (t.hour == hour) || ((hour<0)&&(t.is_date)) )
+ ) {
+
+ p = icalcomponent_get_first_property(
+ WC->disp_cal[i],
+ ICAL_SUMMARY_PROPERTY);
+ if (p != NULL) {
+ wprintf("<FONT SIZE=-1>"
+ "<A HREF=\"/display_edit_event?msgnum=%ld&calview=day&year=%d&month=%d&day=%d\">",
+ WC->cal_msgnum[i],
+ year, month, day
+ );
+ escputs((char *)
+ icalproperty_get_comment(p));
+ wprintf("</A></FONT>\n");
+ }
+
+ }
+
+
+ }
+ }
+}
-/**********************************************************************/
+
+void calendar_day_view(int year, int month, int day) {
+ int hour;
/* Outer table (to get the background color) */
wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
"<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
"bgcolor=#4444FF>\n");
- /* Now do 7 hours */
- for (i = 0; i < 7; ++i) {
- wprintf("<TR><TD BGCOLOR=FFFFFF HEIGHT=60 VALIGN=TOP>");
+ /* Display events before 8:00 (hour=-1 is all-day events) */
+ wprintf("<TR><TD BGCOLOR=FFFFFF VALIGN=TOP>");
+ for (hour = (-1); hour <= 7; ++hour) {
+ calendar_day_view_display_events(year, month, day, hour);
+ }
+ wprintf("</TD></TR>\n");
- /* put the data here, stupid ... FIXME add hour */
- calendar_month_view_display_events(thetime);
+ /* Now the middle of the day... */
+ for (hour = 8; hour <= 17; ++hour) { /* could do HEIGHT=xx */
+ wprintf("<TR><TD BGCOLOR=FFFFFF VALIGN=TOP>");
+ wprintf("%d:00 ", hour);
+
+ /* put the data here, stupid */
+ calendar_day_view_display_events(year, month, day, hour);
wprintf("</TD></TR>\n");
}
+ /* Display events after 5:00... */
+ wprintf("<TR><TD BGCOLOR=FFFFFF VALIGN=TOP>");
+ for (hour = 18; hour <= 23; ++hour) {
+ calendar_day_view_display_events(year, month, day, hour);
+ }
+ wprintf("</TD></TR>\n");
+
+
wprintf("</TABLE>" /* end of innermost table */
"</TD></TR></TABLE>" /* end of inner table */
"</TD></TR></TABLE>" /* end of outer table */
wprintf("<INPUT TYPE=\"hidden\" NAME=\"day\" VALUE=\"%s\">\n",
bstr("day"));
- wprintf("Summary: "
+
+ /* Put it in a borderless table so it lines up nicely */
+ wprintf("<TABLE border=0 width=100%%>\n");
+
+ wprintf("<TR><TD><B>Summary</B></TD><TD>\n"
"<INPUT TYPE=\"text\" NAME=\"summary\" "
"MAXLENGTH=\"64\" SIZE=\"64\" VALUE=\"");
p = icalcomponent_get_first_property(vevent, ICAL_SUMMARY_PROPERTY);
if (p != NULL) {
escputs((char *)icalproperty_get_comment(p));
}
- wprintf("\"><BR>\n");
+ wprintf("\"></TD></TR>\n");
- wprintf("Start date/time: ");
+ wprintf("<TR><TD><B>Start</B></TD><TD>\n");
p = icalcomponent_get_first_property(vevent, ICAL_DTSTART_PROPERTY);
if (p != NULL) {
t = icalproperty_get_dtstart(p);
t = icaltime_from_timet(now, 0);
}
display_icaltimetype_as_webform(&t, "dtstart");
- wprintf("<BR>\n");
+ wprintf("</TD></TR>\n");
- wprintf("End date/time: ");
+ wprintf("<TR><TD><B>End</B></TD><TD>\n");
p = icalcomponent_get_first_property(vevent, ICAL_DTEND_PROPERTY);
if (p != NULL) {
t = icalproperty_get_dtend(p);
t = icaltime_from_timet(now, 0);
}
display_icaltimetype_as_webform(&t, "dtend");
- wprintf("<BR>\n");
+ wprintf("</TD></TR>\n");
- wprintf("<CENTER><TEXTAREA NAME=\"description\" wrap=soft "
+ wprintf("<TR><TD><B>Notes</B></TD><TD>\n"
+ "<TEXTAREA NAME=\"description\" wrap=soft "
"ROWS=10 COLS=80 WIDTH=80>\n"
);
p = icalcomponent_get_first_property(vevent, ICAL_DESCRIPTION_PROPERTY);
if (p != NULL) {
escputs((char *)icalproperty_get_comment(p));
}
- wprintf("</TEXTAREA><BR>\n");
+ wprintf("</TEXTAREA></TD></TR></TABLE>\n");
- wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save\">"
+ wprintf("<CENTER>"
+ "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save\">"
" "
"<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Delete\">\n"
" "