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 wc_printf(_("(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 wc_printf("<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 wc_printf("<tr><td><a href=\"dotgoto?room=");
65 wc_printf("</a></td><td>%d/%d</td></tr>\n",
66 extract_int(&buf[4], 1),
67 extract_int(&buf[4], 2)
71 wc_printf("</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 wc_printf(_("(None)"));
117 wc_printf("</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 wc_printf(_("(Nothing)"));
169 wc_printf("</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 wc_printf("<div class=\"fix_scrollbar_bug\">"
201 "<table width=\"100%%\" cellspacing=\"10\" cellpadding=\"0\">"
207 wc_printf("<td width=33%%>");
208 wc_printf("<div class=\"box\">");
209 wc_printf("<div class=\"boxlabel\">");
210 wc_printf(_("Messages"));
211 wc_printf("</div><div class=\"boxcontent\">");
212 wc_printf("<div id=\"msg_inner\">");
213 new_messages_section();
214 wc_printf("</div></div></div>");
220 wc_printf("<td width=33%%>");
221 wc_printf("<div class=\"box\">");
222 wc_printf("<div class=\"boxlabel\">");
223 wc_printf(_("Tasks"));
224 wc_printf("</div><div class=\"boxcontent\">");
225 wc_printf("<div id=\"tasks_inner\">");
227 wc_printf("</div></div></div>");
233 wc_printf("<td width=33%%>");
234 wc_printf("<div class=\"box\">");
235 wc_printf("<div class=\"boxlabel\">");
236 wc_printf(_("Today on your calendar"));
237 wc_printf("</div><div class=\"boxcontent\">");
238 wc_printf("<div id=\"calendar_inner\">");
240 wc_printf("</div></div></div>");
243 wc_printf("</tr><tr valign=top>");
246 * Row Two - Column One
248 wc_printf("<td colspan=2>");
249 wc_printf("<div class=\"box\">");
250 wc_printf("<div class=\"boxlabel\">");
251 wc_printf(_("Who's online now"));
252 wc_printf("</div><div class=\"boxcontent\">");
253 wc_printf("<div id=\"who_inner\">");
254 do_template("who_summary", NULL);
255 wc_printf("</div></div></div>");
259 * Row Two - Column Two
261 wc_printf("<td width=33%%>");
262 wc_printf("<div class=\"box\">");
263 wc_printf("<div class=\"boxlabel\">");
264 wc_printf(_("About this server"));
265 wc_printf("</div><div class=\"boxcontent\">");
266 wc_printf("<div id=\"info_inner\">");
267 server_info_section();
268 wc_printf("</div></div></div>");
275 wc_printf("</tr></table>");
280 * Display this user's summary page
285 output_headers(1, 1, 2, 0, 0, 0);
286 wc_printf("<div id=\"banner\">\n");
287 wc_printf("<div class=\"room_banner\">");
288 wc_printf("<img src=\"static/summscreen_48x.gif\">");
290 snprintf(title, sizeof title, _("Summary page for %s"), ChrPtr(WC->wc_fullname));
292 wc_printf("</h1><h2>");
294 wc_printf("</h2></div>");
295 wc_printf("<div id=\"actiondiv\">");
296 wc_printf("<ul class=\"room_actions\">\n");
297 wc_printf("<li class=\"start_page\">");
298 offer_start_page(NULL, &NoCtx);
299 wc_printf("</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 wc_printf("<div id=\"content\" class=\"service\">\n");
310 wc_printf("</div>\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=who_summary', "
321 " { method: 'get', frequency: 30 } ); "
332 WebcitAddUrlHandler(HKEY("new_messages_html"), "", 0, new_messages_section, AJAX);
333 WebcitAddUrlHandler(HKEY("tasks_inner_html"), "", 0, tasks_section, AJAX);
334 WebcitAddUrlHandler(HKEY("calendar_inner_html"), "", 0, calendar_section, AJAX);
335 WebcitAddUrlHandler(HKEY("mini_calendar"), "", 0, ajax_mini_calendar, AJAX);
336 WebcitAddUrlHandler(HKEY("summary"), "", 0, summary, 0);
337 WebcitAddUrlHandler(HKEY("summary_inner_div"), "", 0, summary_inner_div, AJAX);