4 * Displays the "Summary Page"
11 * Display today's date in a friendly format
13 void output_date(void) {
19 localtime_r(&now, &tm);
21 wc_strftime(buf, 32, "%A, %x", &tm);
31 void dummy_section(void) {
32 svput("BOXTITLE", WCS_STRING, "(dummy section)");
33 do_template("beginboxx", NULL);
34 wprintf(_("(nothing)"));
35 do_template("endbox", NULL);
40 * New messages section
42 void new_messages_section(void) {
46 int number_of_rooms_to_check;
47 char *rooms_to_check = "Mail|Lobby";
50 number_of_rooms_to_check = num_tokens(rooms_to_check, '|');
51 if (number_of_rooms_to_check == 0) return;
53 wprintf("<table border=0 width=100%%>\n");
54 for (i=0; i<number_of_rooms_to_check; ++i) {
55 extract_token(room, rooms_to_check, i, '|', sizeof room);
57 serv_printf("GOTO %s", room);
58 serv_getln(buf, sizeof buf);
60 extract_token(room, &buf[4], 0, '|', sizeof room);
61 wprintf("<tr><td><a href=\"dotgoto?room=");
65 wprintf("</a></td><td>%d/%d</td></tr>\n",
66 extract_int(&buf[4], 1),
67 extract_int(&buf[4], 2)
71 wprintf("</table>\n");
79 void tasks_section(void) {
88 SharedMessageStatus Stat;
90 memset(&Stat, 0, sizeof(SharedMessageStatus));
92 Stat.lowest_found = (-1);
93 Stat.highest_found = (-1);
95 Buf = NewStrBufPlain(HKEY("_TASKS_"));
98 if (WCC->wc_view != VIEW_TASKS) {
102 num_msgs = load_msg_ptrs("MSGS ALL", &Stat);
106 at = GetNewHashPos(WCC->summ, 0);
107 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
108 Msg = (message_summary*) vMsg;
109 tasks_LoadMsgFromServer(NULL, NULL, Msg, 0, 0);
114 if (calendar_summary_view() < 1) {
116 wprintf(_("(None)"));
117 wprintf("</i><br />\n");
125 void calendar_section(void) {
132 message_summary *Msg;
136 SharedMessageStatus Stat;
138 memset(&Stat, 0, sizeof(SharedMessageStatus));
139 Stat.maxload = 10000;
140 Stat.lowest_found = (-1);
141 Stat.highest_found = (-1);
143 Buf = NewStrBufPlain(HKEY("_CALENDAR_"));
146 if ( (WC->wc_view != VIEW_CALENDAR) && (WC->wc_view != VIEW_CALBRIEF) ) {
150 num_msgs = load_msg_ptrs("MSGS ALL", &Stat);
152 calendar_GetParamsGetServerCall(&Stat,
159 at = GetNewHashPos(WCC->summ, 0);
160 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
161 Msg = (message_summary*) vMsg;
162 calendar_LoadMsgFromServer(NULL, &v, Msg, 0, 0);
166 if (calendar_summary_view() < 1) {
168 wprintf(_("(Nothing)"));
169 wprintf("</i><br />\n");
171 __calendar_Cleanup(&v);
175 * Server info section (fluff, really)
177 void server_info_section(void) {
181 snprintf(message, sizeof message,
182 _("You are connected to %s, running %s with %s, server build %s and located in %s. Your system administrator is %s."),
183 ChrPtr(WCC->serv_info->serv_humannode),
184 ChrPtr(WCC->serv_info->serv_software),
186 ChrPtr(WCC->serv_info->serv_svn_revision),
187 ChrPtr(WCC->serv_info->serv_bbs_city),
188 ChrPtr(WCC->serv_info->serv_sysadm));
193 * Now let's do three columns of crap. All portals and all groupware
194 * clients seem to want to do three columns, so we'll do three
195 * columns too. Conformity is not inherently a virtue, but there are
196 * a lot of really shallow people out there, and even though they're
197 * not people I consider worthwhile, I still want them to use WebCit.
199 void summary_inner_div(void) {
200 wprintf("<div class=\"fix_scrollbar_bug\">"
201 "<table width=\"100%%\" cellspacing=\"10\" cellpadding=\"0\">"
207 wprintf("<td width=33%%>");
208 wprintf("<div class=\"box\">");
209 wprintf("<div class=\"boxlabel\">");
210 wprintf(_("Messages"));
211 wprintf("</div><div class=\"boxcontent\">");
212 wprintf("<div id=\"msg_inner\">");
213 new_messages_section();
214 wprintf("</div></div></div>");
220 wprintf("<td width=33%%>");
221 wprintf("<div class=\"box\">");
222 wprintf("<div class=\"boxlabel\">");
224 wprintf("</div><div class=\"boxcontent\">");
225 wprintf("<div id=\"tasks_inner\">");
227 wprintf("</div></div></div>");
233 wprintf("<td width=33%%>");
234 wprintf("<div class=\"box\">");
235 wprintf("<div class=\"boxlabel\">");
236 wprintf(_("Today on your calendar"));
237 wprintf("</div><div class=\"boxcontent\">");
238 wprintf("<div id=\"calendar_inner\">");
240 wprintf("</div></div></div>");
243 wprintf("</tr><tr valign=top>");
246 * Row Two - Column One
248 wprintf("<td colspan=2>");
249 wprintf("<div class=\"box\">");
250 wprintf("<div class=\"boxlabel\">");
251 wprintf(_("Who's online now"));
252 wprintf("</div><div class=\"boxcontent\">");
253 wprintf("<div id=\"who_inner\">");
254 do_template("wholistsummarysection", NULL);
255 wprintf("</div></div></div>");
259 * Row Two - Column Two
261 wprintf("<td width=33%%>");
262 wprintf("<div class=\"box\">");
263 wprintf("<div class=\"boxlabel\">");
264 wprintf(_("About this server"));
265 wprintf("</div><div class=\"boxcontent\">");
266 wprintf("<div id=\"info_inner\">");
267 server_info_section();
268 wprintf("</div></div></div>");
275 wprintf("</tr></table>");
280 * Display this user's summary page
285 output_headers(1, 1, 2, 0, 0, 0);
286 wprintf("<div id=\"banner\">\n");
287 wprintf("<div class=\"room_banner\">");
288 wprintf("<img src=\"static/summscreen_48x.gif\">");
290 snprintf(title, sizeof title, _("Summary page for %s"), ChrPtr(WC->wc_fullname));
292 wprintf("</h1><h2>");
294 wprintf("</h2></div>");
295 wprintf("<div id=\"actiondiv\">");
296 wprintf("<ul class=\"room_actions\">\n");
297 wprintf("<li class=\"start_page\">");
298 offer_start_page(NULL, &NoCtx);
299 wprintf("</li></ul>");
304 * You guessed it ... we're going to refresh using ajax.
305 * In the future we might consider updating individual sections of the summary
306 * instead of the whole thing.
308 wprintf("<div id=\"content\" class=\"service\">\n");
313 "<script type=\"text/javascript\"> "
314 " new Ajax.PeriodicalUpdater('msg_inner', 'new_messages_html', "
315 " { method: 'get', frequency: 60 } ); "
316 " new Ajax.PeriodicalUpdater('tasks_inner', 'tasks_inner_html', "
317 " { method: 'get', frequency: 120 } ); "
318 " new Ajax.PeriodicalUpdater('calendar_inner', 'calendar_inner_html', "
319 " { method: 'get', frequency: 90 } ); "
320 " new Ajax.PeriodicalUpdater('do_template', 'template=wholistsummarysection', "
321 " { method: 'get', frequency: 30 } ); "
332 WebcitAddUrlHandler(HKEY("new_messages_html"), new_messages_section, AJAX);
333 WebcitAddUrlHandler(HKEY("tasks_inner_html"), tasks_section, AJAX);
334 WebcitAddUrlHandler(HKEY("calendar_inner_html"), calendar_section, AJAX);
335 WebcitAddUrlHandler(HKEY("mini_calendar"), ajax_mini_calendar, AJAX);
336 WebcitAddUrlHandler(HKEY("summary"), summary, 0);
337 WebcitAddUrlHandler(HKEY("summary_inner_div"), summary_inner_div, AJAX);