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);
26 * New messages section
28 void new_messages_section(void) {
32 int number_of_rooms_to_check;
33 char *rooms_to_check = "Mail|Lobby";
36 number_of_rooms_to_check = num_tokens(rooms_to_check, '|');
37 if (number_of_rooms_to_check == 0) return;
39 wc_printf("<table border=0 width=100%%>\n");
40 for (i=0; i<number_of_rooms_to_check; ++i) {
41 extract_token(room, rooms_to_check, i, '|', sizeof room);
43 serv_printf("GOTO %s", room);
44 serv_getln(buf, sizeof buf);
46 extract_token(room, &buf[4], 0, '|', sizeof room);
47 wc_printf("<tr><td><a href=\"dotgoto?room=");
51 wc_printf("</a></td><td>%d/%d</td></tr>\n",
52 extract_int(&buf[4], 1),
53 extract_int(&buf[4], 2)
57 wc_printf("</table>\n");
65 void tasks_section(void) {
74 SharedMessageStatus Stat;
76 memset(&Stat, 0, sizeof(SharedMessageStatus));
78 Stat.lowest_found = (-1);
79 Stat.highest_found = (-1);
81 Buf = NewStrBufPlain(HKEY("_TASKS_"));
85 if (WCC->CurRoom.view != VIEW_TASKS) {
89 num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
93 at = GetNewHashPos(WCC->summ, 0);
94 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
95 Msg = (message_summary*) vMsg;
96 tasks_LoadMsgFromServer(NULL, NULL, Msg, 0, 0);
101 if (calendar_summary_view() < 1) {
103 wc_printf(_("(None)"));
104 wc_printf("</i><br />\n");
112 void calendar_section(void) {
119 message_summary *Msg;
123 SharedMessageStatus Stat;
125 memset(&Stat, 0, sizeof(SharedMessageStatus));
126 Stat.maxload = 10000;
127 Stat.lowest_found = (-1);
128 Stat.highest_found = (-1);
130 Buf = NewStrBufPlain(HKEY("_CALENDAR_"));
133 if ( (WC->CurRoom.view != VIEW_CALENDAR) && (WC->CurRoom.view != VIEW_CALBRIEF) ) {
137 num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
139 calendar_GetParamsGetServerCall(&Stat,
146 at = GetNewHashPos(WCC->summ, 0);
147 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
148 Msg = (message_summary*) vMsg;
149 calendar_LoadMsgFromServer(NULL, &v, Msg, 0, 0);
153 if (calendar_summary_view() < 1) {
155 wc_printf(_("(Nothing)"));
156 wc_printf("</i><br />\n");
158 __calendar_Cleanup(&v);
162 * Server info section (fluff, really)
164 void server_info_section(void) {
168 snprintf(message, sizeof message,
169 _("You are connected to %s, running %s with %s, server build %s and located in %s. Your system administrator is %s."),
170 ChrPtr(WCC->serv_info->serv_humannode),
171 ChrPtr(WCC->serv_info->serv_software),
173 ChrPtr(WCC->serv_info->serv_svn_revision),
174 ChrPtr(WCC->serv_info->serv_bbs_city),
175 ChrPtr(WCC->serv_info->serv_sysadm));
180 * Now let's do three columns of crap. All portals and all groupware
181 * clients seem to want to do three columns, so we'll do three
182 * columns too. Conformity is not inherently a virtue, but there are
183 * a lot of really shallow people out there, and even though they're
184 * not people I consider worthwhile, I still want them to use WebCit.
186 void summary_inner_div(void) {
188 wc_printf("<table width=\"98%%\" cellspacing=\"3\" cellpadding=\"0\">");
189 wc_printf("<tr valign=top>");
194 wc_printf("<td width=33%%>");
195 wc_printf("<div class=\"box\">");
196 wc_printf("<div class=\"boxlabel\">");
197 wc_printf(_("Messages"));
198 wc_printf("</div><div class=\"boxcontent\">");
199 wc_printf("<div id=\"msg_inner\">");
200 new_messages_section();
201 wc_printf("</div></div></div>");
207 wc_printf("<td width=33%%>");
208 wc_printf("<div class=\"box\">");
209 wc_printf("<div class=\"boxlabel\">");
210 wc_printf(_("Tasks"));
211 wc_printf("</div><div class=\"boxcontent\">");
212 wc_printf("<div id=\"tasks_inner\">");
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(_("Today on your calendar"));
224 wc_printf("</div><div class=\"boxcontent\">");
225 wc_printf("<div id=\"calendar_inner\">");
227 wc_printf("</div></div></div>");
230 wc_printf("</tr><tr valign=top>");
233 * Row Two - Column One
235 wc_printf("<td colspan=2>");
236 wc_printf("<div class=\"box\">");
237 wc_printf("<div class=\"boxlabel\">");
238 wc_printf(_("Who's online now"));
239 wc_printf("</div><div class=\"boxcontent\">");
240 wc_printf("<div id=\"who_inner\">");
241 do_template("who_summary", NULL);
242 wc_printf("</div></div></div>");
246 * Row Two - Column Two
248 wc_printf("<td width=33%%>");
249 wc_printf("<div class=\"box\">");
250 wc_printf("<div class=\"boxlabel\">");
251 wc_printf(_("About this server"));
252 wc_printf("</div><div class=\"boxcontent\">");
253 wc_printf("<div id=\"info_inner\">");
254 server_info_section();
255 wc_printf("</div></div></div>");
262 wc_printf("</tr></table>");
267 * Display this user's summary page
272 output_headers(1, 1, 2, 0, 0, 0);
273 wc_printf("<div id=\"banner\" class=\"banner\">\n");
274 wc_printf("<table border=0><tr>");
275 wc_printf("<td><img src=\"static/summscreen_48x.gif\"></td>");
276 wc_printf("<td><h1>");
277 snprintf(title, sizeof title, _("Summary page for %s"), ChrPtr(WC->wc_fullname));
279 wc_printf("</h1><h2>");
281 wc_printf("</h2></td></tr></table>");
282 wc_printf("<div id=\"actiondiv\">");
283 wc_printf("<ul class=\"room_actions\">\n");
284 wc_printf("<li class=\"start_page\">");
285 offer_start_page(NULL, &NoCtx);
286 wc_printf("</li></ul>");
287 wc_printf("</div>"); /* actiondiv */
288 wc_printf("</div>"); /* banner */
291 * You guessed it ... we're going to refresh using ajax.
292 * In the future we might consider updating individual sections of the summary
293 * instead of the whole thing.
295 wc_printf("<div id=\"content\" class=\"service\">\n");
297 wc_printf("</div>\n");
300 "<script type=\"text/javascript\"> "
301 " new Ajax.PeriodicalUpdater('msg_inner', 'new_messages_html', "
302 " { method: 'get', frequency: 60 } ); "
303 " new Ajax.PeriodicalUpdater('tasks_inner', 'tasks_inner_html', "
304 " { method: 'get', frequency: 120 } ); "
305 " new Ajax.PeriodicalUpdater('calendar_inner', 'calendar_inner_html', "
306 " { method: 'get', frequency: 90 } ); "
307 " new Ajax.PeriodicalUpdater('do_template', 'template=who_summary', "
308 " { method: 'get', frequency: 30 } ); "
319 WebcitAddUrlHandler(HKEY("new_messages_html"), "", 0, new_messages_section, AJAX);
320 WebcitAddUrlHandler(HKEY("tasks_inner_html"), "", 0, tasks_section, AJAX);
321 WebcitAddUrlHandler(HKEY("calendar_inner_html"), "", 0, calendar_section, AJAX);
322 WebcitAddUrlHandler(HKEY("mini_calendar"), "", 0, ajax_mini_calendar, AJAX);
323 WebcitAddUrlHandler(HKEY("summary"), "", 0, summary, 0);
324 WebcitAddUrlHandler(HKEY("summary_inner_div"), "", 0, summary_inner_div, AJAX);