4 * Displays the "Summary Page"
10 * Display today's date in a friendly format
12 void output_date(void) {
18 localtime_r(&now, &tm);
20 wc_strftime(buf, 32, "%A, %x", &tm);
30 void dummy_section(void) {
31 svput("BOXTITLE", WCS_STRING, "(dummy section)");
32 do_template("beginboxx", NULL);
33 wprintf(_("(nothing)"));
34 do_template("endbox", NULL);
39 * New messages section
41 void new_messages_section(void) {
45 int number_of_rooms_to_check;
46 char *rooms_to_check = "Mail|Lobby";
49 number_of_rooms_to_check = num_tokens(rooms_to_check, '|');
50 if (number_of_rooms_to_check == 0) return;
52 wprintf("<table border=0 width=100%%>\n");
53 for (i=0; i<number_of_rooms_to_check; ++i) {
54 extract_token(room, rooms_to_check, i, '|', sizeof room);
56 serv_printf("GOTO %s", room);
57 serv_getln(buf, sizeof buf);
59 extract_token(room, &buf[4], 0, '|', sizeof room);
60 wprintf("<tr><td><a href=\"dotgoto?room=");
64 wprintf("</a></td><td>%d/%d</td></tr>\n",
65 extract_int(&buf[4], 1),
66 extract_int(&buf[4], 2)
70 wprintf("</table>\n");
78 void tasks_section(void) {
88 Buf = NewStrBufPlain(HKEY("_TASKS_"));
91 if (WCC->wc_view != VIEW_TASKS) {
95 num_msgs = load_msg_ptrs("MSGS ALL", 0);
100 wprintf(_("(None)"));
101 wprintf("</i><br />\n");
104 at = GetNewHashPos(WCC->summ, 0);
105 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
106 Msg = (message_summary*) vMsg;
107 display_task(Msg, 0);
111 calendar_summary_view();
118 void calendar_section(void) {
124 message_summary *Msg;
129 Buf = NewStrBufPlain(HKEY("_CALENDAR_"));
132 if ( (WC->wc_view != VIEW_CALENDAR) && (WC->wc_view != VIEW_CALBRIEF) ) {
136 num_msgs = load_msg_ptrs("MSGS ALL", 0);
139 parse_calendar_view_request(&c);
143 wprintf(_("(Nothing)"));
144 wprintf("</i><br />\n");
147 at = GetNewHashPos(WCC->summ, 0);
148 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
149 Msg = (message_summary*) vMsg;
150 load_calendar_item(Msg, 0, &c);
152 calendar_summary_view();
157 * Server info section (fluff, really)
159 void server_info_section(void) {
162 snprintf(message, sizeof message,
163 _("You are connected to %s, running %s with %s, server build %s and located in %s. Your system administrator is %s."),
164 ChrPtr(serv_info.serv_humannode),
165 ChrPtr(serv_info.serv_software),
167 ChrPtr(serv_info.serv_svn_revision),
168 ChrPtr(serv_info.serv_bbs_city),
169 ChrPtr(serv_info.serv_sysadm));
174 * Now let's do three columns of crap. All portals and all groupware
175 * clients seem to want to do three columns, so we'll do three
176 * columns too. Conformity is not inherently a virtue, but there are
177 * a lot of really shallow people out there, and even though they're
178 * not people I consider worthwhile, I still want them to use WebCit.
180 void summary_inner_div(void) {
181 wprintf("<div class=\"fix_scrollbar_bug\">"
182 "<table width=\"100%%\" cellspacing=\"10\" cellpadding=\"0\">"
188 wprintf("<td width=33%%>");
189 wprintf("<div class=\"box\">");
190 wprintf("<div class=\"boxlabel\">");
191 wprintf(_("Messages"));
192 wprintf("</div><div class=\"boxcontent\">");
193 wprintf("<div id=\"msg_inner\">");
194 new_messages_section();
195 wprintf("</div></div></div>");
201 wprintf("<td width=33%%>");
202 wprintf("<div class=\"box\">");
203 wprintf("<div class=\"boxlabel\">");
205 wprintf("</div><div class=\"boxcontent\">");
206 wprintf("<div id=\"tasks_inner\">");
208 wprintf("</div></div></div>");
214 wprintf("<td width=33%%>");
215 wprintf("<div class=\"box\">");
216 wprintf("<div class=\"boxlabel\">");
217 wprintf(_("Today on your calendar"));
218 wprintf("</div><div class=\"boxcontent\">");
219 wprintf("<div id=\"calendar_inner\">");
221 wprintf("</div></div></div>");
224 wprintf("</tr><tr valign=top>");
227 * Row Two - Column One
229 wprintf("<td colspan=2>");
230 wprintf("<div class=\"box\">");
231 wprintf("<div class=\"boxlabel\">");
232 wprintf(_("Who's online now"));
233 wprintf("</div><div class=\"boxcontent\">");
234 wprintf("<div id=\"who_inner\">");
235 do_template("wholistsummarysection", NULL);
236 wprintf("</div></div></div>");
240 * Row Two - Column Two
242 wprintf("<td width=33%%>");
243 wprintf("<div class=\"box\">");
244 wprintf("<div class=\"boxlabel\">");
245 wprintf(_("About this server"));
246 wprintf("</div><div class=\"boxcontent\">");
247 wprintf("<div id=\"info_inner\">");
248 server_info_section();
249 wprintf("</div></div></div>");
256 wprintf("</tr></table>");
261 * Display this user's summary page
266 output_headers(1, 1, 2, 0, 0, 0);
267 wprintf("<div id=\"banner\">\n");
268 wprintf("<div class=\"room_banner\">");
269 wprintf("<img src=\"static/summscreen_48x.gif\">");
271 snprintf(title, sizeof title, _("Summary page for %s"), ChrPtr(WC->wc_fullname));
273 wprintf("</h1><h2>");
275 wprintf("</h2></div>");
276 wprintf("<ul class=\"room_actions\">\n");
277 wprintf("<li class=\"start_page\">");
278 offer_start_page(NULL, &NoCtx);
279 wprintf("</li></ul>");
283 * You guessed it ... we're going to refresh using ajax.
284 * In the future we might consider updating individual sections of the summary
285 * instead of the whole thing.
287 wprintf("<div id=\"content\" class=\"service\">\n");
292 "<script type=\"text/javascript\"> "
293 " new Ajax.PeriodicalUpdater('msg_inner', 'new_messages_html', "
294 " { method: 'get', frequency: 60 } ); "
295 " new Ajax.PeriodicalUpdater('tasks_inner', 'tasks_inner_html', "
296 " { method: 'get', frequency: 120 } ); "
297 " new Ajax.PeriodicalUpdater('calendar_inner', 'calendar_inner_html', "
298 " { method: 'get', frequency: 90 } ); "
299 " new Ajax.PeriodicalUpdater('do_template', 'template=wholistsummarysection', "
300 " { method: 'get', frequency: 30 } ); "
311 WebcitAddUrlHandler(HKEY("new_messages_html"), new_messages_section, AJAX);
312 WebcitAddUrlHandler(HKEY("tasks_inner_html"), tasks_section, AJAX);
313 WebcitAddUrlHandler(HKEY("calendar_inner_html"), calendar_section, AJAX);
314 WebcitAddUrlHandler(HKEY("mini_calendar"), ajax_mini_calendar, AJAX);
315 WebcitAddUrlHandler(HKEY("summary"), summary, 0);
316 WebcitAddUrlHandler(HKEY("summary_inner_div"), summary_inner_div, AJAX);