11 #include <sys/socket.h>
14 #include <netinet/in.h>
26 * Display today's date in a friendly format
28 void output_date(void) {
32 static char *wdays[] = {
33 "Sunday", "Monday", "Tuesday", "Wednesday",
34 "Thursday", "Friday", "Saturday"
36 static char *months[] = {
37 "January", "February", "March", "April", "May", "June", "July",
38 "August", "September", "October", "November", "December"
42 localtime_r(&now, &tm);
44 wprintf("%s, %s %d, %d",
55 * Display the title bar for a section
57 void section_title(char *title) {
59 wprintf("<TABLE width=100%% border=0 cellpadding=5 cellspacing=0>"
60 "<TR><TD BGCOLOR=444455>"
61 "<FONT COLOR=FFFFEE>");
63 wprintf("</FONT></TD></TR></TABLE>\n");
70 void dummy_section(void) {
76 * New messages section
78 void new_messages_section(void) {
82 int number_of_rooms_to_check;
83 char *rooms_to_check = "Mail|Lobby";
85 section_title("Messages");
87 number_of_rooms_to_check = num_tokens(rooms_to_check, '|');
88 if (number_of_rooms_to_check == 0) return;
90 wprintf("<TABLE BORDER=0 WIDTH=100%%>\n");
91 for (i=0; i<number_of_rooms_to_check; ++i) {
92 extract(room, rooms_to_check, i);
94 serv_printf("GOTO %s", room);
97 extract(room, &buf[4], 0);
98 wprintf("<TR><TD><A HREF=\"/dotgoto?room=");
102 wprintf("</A></TD><TD>%d/%d</TD></TR>\n",
103 extract_int(&buf[4], 1),
104 extract_int(&buf[4], 2)
108 wprintf("</TABLE>\n");
116 void wholist_section(void) {
120 section_title("Who's online now");
123 if (buf[0] == '1') while(serv_gets(buf), strcmp(buf, "000")) {
124 extract(user, buf, 1);
134 void tasks_section(void) {
138 section_title("Tasks");
139 gotoroom("Tasks", 0);
140 if (strcasecmp(WC->wc_roomname, "Tasks")) {
141 wprintf("<i>(You do not have a task list)</i><BR>\n");
145 num_msgs = load_msg_ptrs("MSGS ALL");
147 wprintf("<i>(None)</i><BR>\n");
152 for (i=0; i<num_msgs; ++i) {
153 display_task(WC->msgarr[i]);
162 void calendar_section(void) {
166 section_title("Today on your calendar");
167 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
168 gotoroom("Calendar", 0);
169 if (strcasecmp(WC->wc_roomname, "Calendar")) {
170 wprintf("<i>(You do not have a calendar)</i><BR>\n");
174 num_msgs = load_msg_ptrs("MSGS ALL");
176 wprintf("<i>(Nothing)</i><BR>\n");
180 for (i=0; i<num_msgs; ++i) {
181 display_calendar(WC->msgarr[i]);
184 calendar_summary_view();
185 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
190 * Server info section (fluff, really)
192 void server_info_section(void) {
196 section_title("About this server");
199 if (buf[0] == '1') while(serv_gets(buf), strcmp(buf, "000")) {
202 wprintf("You are connected to ");
206 case 4: wprintf("running ");
210 case 6: wprintf("and located in ");
214 case 7: wprintf("Your system administrator is ");
227 * Display this user's summary page
232 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>"
233 "<FONT SIZE=+1 COLOR=\"FFFFFF\">"
234 "<B>Summary page for ");
235 escputs(WC->wc_username);
236 wprintf("</B><FONT></TD><TD>\n");
238 wprintf("</TD><TD ALIGN=RIGHT><FONT COLOR=\"FFFFFF\">");
240 wprintf("</FONT></TD></TR></TABLE>\n");
243 * Now let's do three columns of crap. All portals and all groupware
244 * clients seem to want to do three columns, so we'll do three
245 * columns too. Conformity is not inherently a virtue, but there are
246 * a lot of really shallow people out there, and even though they're
247 * not people I consider worthwhile, I still want them to use WebCit.
250 wprintf("<TABLE WIDTH=100%% BORDER=0 CELLPADDING=10><TR VALIGN=TOP>");
255 wprintf("<TD WIDTH=33%%>");
261 wprintf("</TD><TD WIDTH=33%%>");
262 server_info_section();
269 wprintf("</TD><TD WIDTH=33%%>");
270 new_messages_section();
277 wprintf("</TD></TR></TABLE>\n");