/*
* $Id$
*
- *
+ * Handles the HTML display of calendar items.
*/
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <limits.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <pthread.h>
-#include <signal.h>
-#include <time.h>
#include "webcit.h"
#include "webserver.h"
#ifndef WEBCIT_WITH_CALENDAR_SERVICE
void do_calendar_view(void) { /* stub for non-libical builds */
- wprintf("<CENTER><I>Calendar view not available</I></CENTER><br />\n");
+ wprintf("<CENTER><I>");
+ wprintf(_("The calendar view is not available."));
+ wprintf("</I></CENTER><br />\n");
}
void do_tasks_view(void) { /* stub for non-libical builds */
- wprintf("<CENTER><I>Tasks view not available</I></CENTER><br />\n");
+ wprintf("<CENTER><I>");
+ wprintf(_("The tasks view is not available."));
+ wprintf("</I></CENTER><br />\n");
}
#else /* WEBCIT_WITH_CALENDAR_SERVICE */
localtime_r(&event_tt, &event_tm);
}
-lprintf(9, "Event: %04d-%s-%02d, Now: %04d-%s-%02d\n",
- event_tm.tm_year + 1900,
- ascmonths[event_tm.tm_mon],
- event_tm.tm_mday,
- today_tm.tm_year + 1900,
- ascmonths[today_tm.tm_mon],
- today_tm.tm_mday);
-
if ((event_tm.tm_year == today_tm.tm_year)
&& (event_tm.tm_mon == today_tm.tm_mon)
&& (event_tm.tm_mday == today_tm.tm_mday)) {
}
/* Outer table (to get the background color) */
- wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
+ wprintf("<div id=\"fix_scrollbar_bug\">"
+ "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
"bgcolor=#204B78><TR><TD>\n");
wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0><tr>\n");
- wprintf("<TD align=left><font color=#FFFFFF size=-2>"
- "Click on any date for day view "
- "</FONT></TD>\n");
wprintf("<TD ALIGN=CENTER>");
localtime_r(&previous_month, &tm);
wprintf("<A HREF=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
(int)(tm.tm_year)+1900, tm.tm_mon + 1);
- wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/back.gif\" BORDER=0></A>\n");
+ wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/prevdate_32x.gif\" BORDER=0></A>\n");
wprintf(" "
"<FONT SIZE=+1 COLOR=\"#FFFFFF\">"
localtime_r(&next_month, &tm);
wprintf("<A HREF=\"readfwd?calview=month&year=%d&month=%d&day=1\">",
(int)(tm.tm_year)+1900, tm.tm_mon + 1);
- wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/forward.gif\" BORDER=0></A>\n");
+ wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/nextdate_32x.gif\" BORDER=0></A>\n");
- wprintf("</TD><TD align=right><font color=#FFFFFF size=-2>"
- "Click on any date for day view "
- "</FONT></TD></TR></TABLE>\n");
+ wprintf("</TD></TR></TABLE>\n");
/* Inner table (the real one) */
wprintf("<TABLE width=100%% border=0 cellpadding=1 cellspacing=1 "
wprintf("<TR>");
}
- wprintf("<TD BGCOLOR=\"#%s\" WIDTH=14%% HEIGHT=60 VALIGN=TOP><B>",
+ wprintf("<TD BGCOLOR=\"#%s\" WIDTH=14%% HEIGHT=60 align=left VALIGN=TOP><B>",
((tm.tm_mon != month-1) ? "DDDDDD" :
((tm.tm_wday==0 || tm.tm_wday==6) ? "EEEECC" :
"FFFFFF"))
wprintf("</TABLE>" /* end of inner table */
"</TD></TR></TABLE>" /* end of outer table */
- "</CENTER>\n");
+ "</div>\n");
}
int all_day_event = 0;
if (WC->num_cal == 0) {
- wprintf("<br /><br /><br />\n");
+ // FIXME wprintf("<br /><br /><br />\n");
return;
}
void calendar_day_view(int year, int month, int day) {
int hour;
struct icaltimetype today, yesterday, tomorrow;
+ char calhourformat[16];
+ get_preference("calhourformat", calhourformat, sizeof calhourformat);
/* Figure out the dates for "yesterday" and "tomorrow" links */
/* Outer table (to get the background color) */
- wprintf("<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
+ wprintf("<div id=\"fix_scrollbar_bug\">"
+ "<TABLE width=100%% border=0 cellpadding=0 cellspacing=0 "
"bgcolor=#204B78><TR><TD>\n");
/* Inner table (the real one) */
"&year=%d&month=%d&day=%d&hour=%d&minute=0\">",
year, month, day, hour
);
- wprintf("%d:00%s</A> ",
- (hour <= 12 ? hour : hour-12),
- (hour < 12 ? "am" : "pm")
- );
+
+ if (!strcasecmp(calhourformat, "24")) {
+ wprintf("%2d:00</A> ", hour);
+ }
+ else {
+ wprintf("%d:00%s</A> ",
+ (hour <= 12 ? hour : hour-12),
+ (hour < 12 ? "am" : "pm")
+ );
+ }
+
wprintf("</TD><TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
/* put the data here, stupid */
wprintf("<TD ALIGN=CENTER>");
wprintf("<A HREF=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
yesterday.year, yesterday.month, yesterday.day);
- wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/back.gif\" BORDER=0></A>");
+ wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/prevdate_32x.gif\" BORDER=0></A>");
wprintf("</TD>");
/* Today's date */
wprintf("<TD ALIGN=CENTER>");
wprintf("<A HREF=\"readfwd?calview=day&year=%d&month=%d&day=%d\">",
tomorrow.year, tomorrow.month, tomorrow.day);
- wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/forward.gif\""
+ wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/nextdate_32x.gif\""
" BORDER=0></A>\n");
wprintf("</TD>");
wprintf("</TR></TABLE>\n");
/* End todays-date-with-left-and-right-arrows */
- wprintf("<br /><br /><CENTER><font color=#FFFFFF>"
- " <A HREF=\"/display_edit_event?msgnum=0"
- "&year=%d&month=%d&day=%d\">"
- "Add new calendar event</A>"
- "<br /><br />\n",
- year, month, day
- );
-
- wprintf("<A HREF=\"readfwd?calview=month&year=%d&month=%d&day=1\">"
- "Back to month view</A>\n", year, month);
+ /* In the future we might want to put a month-o-matic here */
wprintf("</FONT></CENTER>\n");
wprintf("</TR></TABLE>" /* end of inner table */
- "</TD></TR></TABLE>" /* end of outer table */
+ "</TD></TR></TABLE></div>" /* end of outer table */
);
char buf[SIZ];
icalproperty *p;
- do_template("beginbox_nt");
-
- wprintf("<TABLE BORDER=0 CELLSPACING=0 WIDTH=100%%>\n<TR>\n"
- "<TH>Name of task</TH>\n"
- "<TH>Date due</TH></TR>\n"
+ wprintf("<div id=\"fix_scrollbar_bug\">"
+ "<table border=0 cellspacing=0 width=100%% bgcolor=\"#FFFFFF\">\n<tr>\n"
+ "<TH>");
+ wprintf(_("Name of task"));
+ wprintf("</TH><TH>");
+ wprintf(_("Date due"));
+ wprintf("</TH></TR>\n"
);
/* Sort them if necessary */
WC->disp_cal[i].cal_msgnum );
urlescputs(WC->wc_roomname);
wprintf("\">");
+ wprintf("<IMG ALIGN=MIDDLE "
+ "SRC=\"/static/taskmanag_16x.gif\" BORDER=0> ");
if (p != NULL) {
escputs((char *)icalproperty_get_comment(p));
}
wprintf("</TD>\n");
due = get_task_due_date(WC->disp_cal[i].cal);
- fmt_date(buf, due);
+ fmt_date(buf, due, 0);
wprintf("<TD><FONT");
if (due < time(NULL)) {
wprintf(" COLOR=\"#FF0000\"");
wprintf(">%s</FONT></TD></TR>\n", buf);
}
- wprintf("</TABLE>\n");
-
- wprintf("<hr /><A HREF=\"/display_edit_task?msgnum=0\">"
- "Add new task</A>\n"
- );
-
- do_template("endbox");
-
+ wprintf("</table></div>\n");
/* Free the list */
free_calendar_buffer();