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",
58 void dummy_section(void) {
59 svprintf("BOXTITLE", WCS_STRING, "(dummy section)");
60 do_template("beginbox");
62 do_template("endbox");
67 * New messages section
69 void new_messages_section(void) {
73 int number_of_rooms_to_check;
74 char *rooms_to_check = "Mail|Lobby";
76 svprintf("BOXTITLE", WCS_STRING, "Messages");
77 do_template("beginbox");
79 number_of_rooms_to_check = num_tokens(rooms_to_check, '|');
80 if (number_of_rooms_to_check == 0) return;
82 wprintf("<TABLE BORDER=0 WIDTH=100%%>\n");
83 for (i=0; i<number_of_rooms_to_check; ++i) {
84 extract(room, rooms_to_check, i);
86 serv_printf("GOTO %s", room);
89 extract(room, &buf[4], 0);
90 wprintf("<TR><TD><A HREF=\"/dotgoto?room=");
94 wprintf("</A></TD><TD>%d/%d</TD></TR>\n",
95 extract_int(&buf[4], 1),
96 extract_int(&buf[4], 2)
100 wprintf("</TABLE>\n");
101 do_template("endbox");
109 void wholist_section(void) {
113 svprintf("BOXTITLE", WCS_STRING, "Who's online now");
114 do_template("beginbox");
117 if (buf[0] == '1') while(serv_gets(buf), strcmp(buf, "000")) {
118 extract(user, buf, 1);
122 do_template("endbox");
129 void tasks_section(void) {
130 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
135 svprintf("BOXTITLE", WCS_STRING, "Tasks");
136 do_template("beginbox");
137 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
139 if (strcasecmp(WC->wc_roomname, "Tasks")) {
143 num_msgs = load_msg_ptrs("MSGS ALL");
147 wprintf("<i>(None)</i><br />\n");
150 for (i=0; i<num_msgs; ++i) {
151 display_task(WC->msgarr[i]);
155 calendar_summary_view();
157 #else /* WEBCIT_WITH_CALENDAR_SERVICE */
158 wprintf("<I>(This server does not support task lists)</I>\n");
159 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
160 do_template("endbox");
167 void calendar_section(void) {
168 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
173 svprintf("BOXTITLE", WCS_STRING, "Today on your calendar");
174 do_template("beginbox");
175 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
176 gotoroom("Calendar");
177 if (strcasecmp(WC->wc_roomname, "Calendar")) {
181 num_msgs = load_msg_ptrs("MSGS ALL");
185 wprintf("<i>(Nothing)</i><br />\n");
188 for (i=0; i<num_msgs; ++i) {
189 display_calendar(WC->msgarr[i]);
191 calendar_summary_view();
194 #else /* WEBCIT_WITH_CALENDAR_SERVICE */
195 wprintf("<I>(This server does not support calendars)</I>\n");
196 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
197 do_template("endbox");
202 * Server info section (fluff, really)
204 void server_info_section(void) {
205 svprintf("BOXTITLE", WCS_STRING, "About this server");
206 do_template("beginbox");
207 wprintf("You are connected to ");
208 escputs(serv_info.serv_humannode);
209 wprintf(", running ");
210 escputs(serv_info.serv_software);
211 wprintf(", and located in ");
212 escputs(serv_info.serv_bbs_city);
213 wprintf(".<br />\nYour system administrator is ");
214 escputs(serv_info.serv_sysadm);
216 do_template("endbox");
221 * Display this user's summary page
225 output_headers(1, 1, 2, 0, 1, 0, 0);
226 wprintf("<div id=\"banner\">\n");
227 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=#444455><TR>"
228 "<TD><IMG SRC=\"/static/summary.gif\"></TD><TD>"
229 "<SPAN CLASS=\"titlebar\">"
230 "Summary page for ");
231 escputs(WC->wc_username);
232 wprintf("</SPAN></TD><TD>\n");
233 wprintf("</TD><TD ALIGN=RIGHT><SPAN CLASS=\"titlebar\">");
235 wprintf("</SPAN><br />");
237 wprintf("</TD></TR></TABLE>\n");
238 wprintf("</div>\n<div id=\"content\">\n");
241 * Now let's do three columns of crap. All portals and all groupware
242 * clients seem to want to do three columns, so we'll do three
243 * columns too. Conformity is not inherently a virtue, but there are
244 * a lot of really shallow people out there, and even though they're
245 * not people I consider worthwhile, I still want them to use WebCit.
248 wprintf("<table border=0><tr valign=top>");
253 wprintf("<td width=33%%>");
259 wprintf("</td><td width=33%%>");
260 server_info_section();
267 wprintf("</td><td width=33%%>");
268 new_messages_section();
275 wprintf("</td></tr></table>\n");