4 * Displays the "Summary Page"
13 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <netinet/in.h>
30 * Display today's date in a friendly format
32 void output_date(void) {
36 static char *wdays[] = {
37 "Sunday", "Monday", "Tuesday", "Wednesday",
38 "Thursday", "Friday", "Saturday"
40 static char *months[] = {
41 "January", "February", "March", "April", "May", "June", "July",
42 "August", "September", "October", "November", "December"
46 localtime_r(&now, &tm);
48 wprintf("%s, %s %d, %d",
62 void dummy_section(void) {
63 svprintf("BOXTITLE", WCS_STRING, "(dummy section)");
64 do_template("beginbox");
66 do_template("endbox");
71 * New messages section
73 void new_messages_section(void) {
77 int number_of_rooms_to_check;
78 char *rooms_to_check = "Mail|Lobby";
80 svprintf("BOXTITLE", WCS_STRING, "Messages");
81 do_template("beginbox");
83 number_of_rooms_to_check = num_tokens(rooms_to_check, '|');
84 if (number_of_rooms_to_check == 0) return;
86 wprintf("<TABLE BORDER=0 WIDTH=100%%>\n");
87 for (i=0; i<number_of_rooms_to_check; ++i) {
88 extract_token(room, rooms_to_check, i, '|', sizeof room);
90 serv_printf("GOTO %s", room);
91 serv_getln(buf, sizeof buf);
93 extract_token(room, &buf[4], 0, '|', sizeof room);
94 wprintf("<TR><TD><A HREF=\"/dotgoto?room=");
98 wprintf("</A></TD><TD>%d/%d</TD></TR>\n",
99 extract_int(&buf[4], 1),
100 extract_int(&buf[4], 2)
104 wprintf("</TABLE>\n");
105 do_template("endbox");
113 void wholist_section(void) {
117 svprintf("BOXTITLE", WCS_STRING, "Who's online now");
118 do_template("beginbox");
120 serv_getln(buf, sizeof buf);
121 if (buf[0] == '1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
122 extract_token(user, buf, 1, '|', sizeof user);
126 do_template("endbox");
133 void tasks_section(void) {
134 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
139 svprintf("BOXTITLE", WCS_STRING, "Tasks");
140 do_template("beginbox");
141 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
143 if (WC->wc_view != VIEW_TASKS) {
147 num_msgs = load_msg_ptrs("MSGS ALL", 0);
151 wprintf("<i>(None)</i><br />\n");
154 for (i=0; i<num_msgs; ++i) {
155 display_task(WC->msgarr[i]);
159 calendar_summary_view();
161 #else /* WEBCIT_WITH_CALENDAR_SERVICE */
162 wprintf("<I>(This server does not support task lists)</I>\n");
163 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
164 do_template("endbox");
171 void calendar_section(void) {
172 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
177 svprintf("BOXTITLE", WCS_STRING, "Today on your calendar");
178 do_template("beginbox");
179 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
180 gotoroom("_CALENDAR_");
181 if (WC->wc_view != VIEW_CALENDAR) {
185 num_msgs = load_msg_ptrs("MSGS ALL", 0);
189 wprintf("<i>(Nothing)</i><br />\n");
192 for (i=0; i<num_msgs; ++i) {
193 display_calendar(WC->msgarr[i]);
195 calendar_summary_view();
198 #else /* WEBCIT_WITH_CALENDAR_SERVICE */
199 wprintf("<I>(This server does not support calendars)</I>\n");
200 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
201 do_template("endbox");
206 * Server info section (fluff, really)
208 void server_info_section(void) {
209 svprintf("BOXTITLE", WCS_STRING, "About this server");
210 do_template("beginbox");
211 wprintf("You are connected to ");
212 escputs(serv_info.serv_humannode);
213 wprintf(", running ");
214 escputs(serv_info.serv_software);
217 wprintf(", and located in ");
218 escputs(serv_info.serv_bbs_city);
219 wprintf(".<br />\nYour system administrator is ");
220 escputs(serv_info.serv_sysadm);
222 do_template("endbox");
227 * Display this user's summary page
231 output_headers(1, 1, 2, 0, 1, 0, 0);
232 wprintf("<div id=\"banner\">\n");
233 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=#444455><TR>"
234 "<TD><IMG SRC=\"/static/summscreen_48x.gif\"></TD><TD>"
235 "<SPAN CLASS=\"titlebar\">"
236 "Summary page for ");
237 escputs(WC->wc_username);
238 wprintf("</SPAN></TD><TD>\n");
239 wprintf("</TD><TD ALIGN=RIGHT><SPAN CLASS=\"titlebar\">");
241 wprintf("</SPAN><br />");
243 wprintf("</TD></TR></TABLE>\n");
244 wprintf("</div>\n<div id=\"content\">\n");
247 * Now let's do three columns of crap. All portals and all groupware
248 * clients seem to want to do three columns, so we'll do three
249 * columns too. Conformity is not inherently a virtue, but there are
250 * a lot of really shallow people out there, and even though they're
251 * not people I consider worthwhile, I still want them to use WebCit.
254 wprintf("<div id=\"fix_scrollbar_bug\">"
255 "<table border=0 width=100%%><tr valign=top>");
260 wprintf("<td width=33%%>");
266 wprintf("</td><td width=33%%>");
267 server_info_section();
274 wprintf("</td><td width=33%%>");
275 new_messages_section();
282 wprintf("</td></tr></table></div>\n");