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));
91 Buf = NewStrBufPlain(HKEY("_TASKS_"));
94 if (WCC->wc_view != VIEW_TASKS) {
98 num_msgs = load_msg_ptrs("MSGS ALL", &Stat);
102 at = GetNewHashPos(WCC->summ, 0);
103 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
104 Msg = (message_summary*) vMsg;
105 tasks_LoadMsgFromServer(NULL, NULL, Msg, 0, 0);
110 if (calendar_summary_view() < 1) {
112 wprintf(_("(None)"));
113 wprintf("</i><br />\n");
121 void calendar_section(void) {
128 message_summary *Msg;
133 SharedMessageStatus Stat;
135 memset(&Stat, 0, sizeof(SharedMessageStatus));
136 Buf = NewStrBufPlain(HKEY("_CALENDAR_"));
139 if ( (WC->wc_view != VIEW_CALENDAR) && (WC->wc_view != VIEW_CALBRIEF) ) {
143 num_msgs = load_msg_ptrs("MSGS ALL", &Stat);
145 calendar_GetParamsGetServerCall(&Stat,
152 at = GetNewHashPos(WCC->summ, 0);
153 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
154 Msg = (message_summary*) vMsg;
155 calendar_LoadMsgFromServer(NULL, &v, Msg, 0, 0);
159 if (calendar_summary_view() < 1) {
161 wprintf(_("(Nothing)"));
162 wprintf("</i><br />\n");
167 * Server info section (fluff, really)
169 void server_info_section(void) {
173 snprintf(message, sizeof message,
174 _("You are connected to %s, running %s with %s, server build %s and located in %s. Your system administrator is %s."),
175 ChrPtr(WCC->serv_info->serv_humannode),
176 ChrPtr(WCC->serv_info->serv_software),
178 ChrPtr(WCC->serv_info->serv_svn_revision),
179 ChrPtr(WCC->serv_info->serv_bbs_city),
180 ChrPtr(WCC->serv_info->serv_sysadm));
185 * Now let's do three columns of crap. All portals and all groupware
186 * clients seem to want to do three columns, so we'll do three
187 * columns too. Conformity is not inherently a virtue, but there are
188 * a lot of really shallow people out there, and even though they're
189 * not people I consider worthwhile, I still want them to use WebCit.
191 void summary_inner_div(void) {
192 wprintf("<div class=\"fix_scrollbar_bug\">"
193 "<table width=\"100%%\" cellspacing=\"10\" cellpadding=\"0\">"
199 wprintf("<td width=33%%>");
200 wprintf("<div class=\"box\">");
201 wprintf("<div class=\"boxlabel\">");
202 wprintf(_("Messages"));
203 wprintf("</div><div class=\"boxcontent\">");
204 wprintf("<div id=\"msg_inner\">");
205 new_messages_section();
206 wprintf("</div></div></div>");
212 wprintf("<td width=33%%>");
213 wprintf("<div class=\"box\">");
214 wprintf("<div class=\"boxlabel\">");
216 wprintf("</div><div class=\"boxcontent\">");
217 wprintf("<div id=\"tasks_inner\">");
219 wprintf("</div></div></div>");
225 wprintf("<td width=33%%>");
226 wprintf("<div class=\"box\">");
227 wprintf("<div class=\"boxlabel\">");
228 wprintf(_("Today on your calendar"));
229 wprintf("</div><div class=\"boxcontent\">");
230 wprintf("<div id=\"calendar_inner\">");
232 wprintf("</div></div></div>");
235 wprintf("</tr><tr valign=top>");
238 * Row Two - Column One
240 wprintf("<td colspan=2>");
241 wprintf("<div class=\"box\">");
242 wprintf("<div class=\"boxlabel\">");
243 wprintf(_("Who's online now"));
244 wprintf("</div><div class=\"boxcontent\">");
245 wprintf("<div id=\"who_inner\">");
246 do_template("wholistsummarysection", NULL);
247 wprintf("</div></div></div>");
251 * Row Two - Column Two
253 wprintf("<td width=33%%>");
254 wprintf("<div class=\"box\">");
255 wprintf("<div class=\"boxlabel\">");
256 wprintf(_("About this server"));
257 wprintf("</div><div class=\"boxcontent\">");
258 wprintf("<div id=\"info_inner\">");
259 server_info_section();
260 wprintf("</div></div></div>");
267 wprintf("</tr></table>");
272 * Display this user's summary page
277 output_headers(1, 1, 2, 0, 0, 0);
278 wprintf("<div id=\"banner\">\n");
279 wprintf("<div class=\"room_banner\">");
280 wprintf("<img src=\"static/summscreen_48x.gif\">");
282 snprintf(title, sizeof title, _("Summary page for %s"), ChrPtr(WC->wc_fullname));
284 wprintf("</h1><h2>");
286 wprintf("</h2></div>");
287 wprintf("<div id=\"actiondiv\">");
288 wprintf("<ul class=\"room_actions\">\n");
289 wprintf("<li class=\"start_page\">");
290 offer_start_page(NULL, &NoCtx);
291 wprintf("</li></ul>");
296 * You guessed it ... we're going to refresh using ajax.
297 * In the future we might consider updating individual sections of the summary
298 * instead of the whole thing.
300 wprintf("<div id=\"content\" class=\"service\">\n");
305 "<script type=\"text/javascript\"> "
306 " new Ajax.PeriodicalUpdater('msg_inner', 'new_messages_html', "
307 " { method: 'get', frequency: 60 } ); "
308 " new Ajax.PeriodicalUpdater('tasks_inner', 'tasks_inner_html', "
309 " { method: 'get', frequency: 120 } ); "
310 " new Ajax.PeriodicalUpdater('calendar_inner', 'calendar_inner_html', "
311 " { method: 'get', frequency: 90 } ); "
312 " new Ajax.PeriodicalUpdater('do_template', 'template=wholistsummarysection', "
313 " { method: 'get', frequency: 30 } ); "
324 WebcitAddUrlHandler(HKEY("new_messages_html"), new_messages_section, AJAX);
325 WebcitAddUrlHandler(HKEY("tasks_inner_html"), tasks_section, AJAX);
326 WebcitAddUrlHandler(HKEY("calendar_inner_html"), calendar_section, AJAX);
327 WebcitAddUrlHandler(HKEY("mini_calendar"), ajax_mini_calendar, AJAX);
328 WebcitAddUrlHandler(HKEY("summary"), summary, 0);
329 WebcitAddUrlHandler(HKEY("summary_inner_div"), summary_inner_div, AJAX);