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("beginbox", 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) {
83 if (WC->wc_view != VIEW_TASKS) {
87 num_msgs = load_msg_ptrs("MSGS ALL", 0);
93 wprintf("</i><br />\n");
96 for (i=0; i<num_msgs; ++i) {
97 display_task(WC->msgarr[i], 0);
101 calendar_summary_view();
108 void calendar_section(void) {
112 gotoroom("_CALENDAR_");
113 if ( (WC->wc_view != VIEW_CALENDAR) && (WC->wc_view != VIEW_CALBRIEF) ) {
117 num_msgs = load_msg_ptrs("MSGS ALL", 0);
122 wprintf(_("(Nothing)"));
123 wprintf("</i><br />\n");
126 for (i=0; i<num_msgs; ++i) {
127 display_calendar(WC->msgarr[i], 0);
129 calendar_summary_view();
134 * Server info section (fluff, really)
136 void server_info_section(void) {
139 snprintf(message, sizeof message,
140 _("You are connected to %s, running %s with %s, server build %s and located in %s. Your system administrator is %s."),
141 serv_info.serv_humannode,
142 serv_info.serv_software,
144 serv_info.serv_svn_revision,
145 serv_info.serv_bbs_city,
146 serv_info.serv_sysadm);
151 * Now let's do three columns of crap. All portals and all groupware
152 * clients seem to want to do three columns, so we'll do three
153 * columns too. Conformity is not inherently a virtue, but there are
154 * a lot of really shallow people out there, and even though they're
155 * not people I consider worthwhile, I still want them to use WebCit.
157 void summary_inner_div(void) {
158 wprintf("<div class=\"fix_scrollbar_bug\">"
159 "<table width=\"100%%\" cellspacing=\"10\" cellpadding=\"0\">"
165 wprintf("<td width=33%%>");
166 wprintf("<div class=\"box\">");
167 wprintf("<div class=\"boxlabel\">");
168 wprintf(_("Messages"));
169 wprintf("</div><div class=\"boxcontent\">");
170 wprintf("<div id=\"msg_inner\">");
171 new_messages_section();
172 wprintf("</div></div></div>");
178 wprintf("<td width=33%%>");
179 wprintf("<div class=\"box\">");
180 wprintf("<div class=\"boxlabel\">");
182 wprintf("</div><div class=\"boxcontent\">");
183 wprintf("<div id=\"tasks_inner\">");
185 wprintf("</div></div></div>");
191 wprintf("<td width=33%%>");
192 wprintf("<div class=\"box\">");
193 wprintf("<div class=\"boxlabel\">");
194 wprintf(_("Today on your calendar"));
195 wprintf("</div><div class=\"boxcontent\">");
196 wprintf("<div id=\"calendar_inner\">");
198 wprintf("</div></div></div>");
201 wprintf("</tr><tr valign=top>");
204 * Row Two - Column One
206 wprintf("<td colspan=2>");
207 wprintf("<div class=\"box\">");
208 wprintf("<div class=\"boxlabel\">");
209 wprintf(_("Who's online now"));
210 wprintf("</div><div class=\"boxcontent\">");
211 wprintf("<div id=\"who_inner\">");
212 do_template("wholistsummarysection", NULL);
213 wprintf("</div></div></div>");
217 * Row Two - Column Two
219 wprintf("<td width=33%%>");
220 wprintf("<div class=\"box\">");
221 wprintf("<div class=\"boxlabel\">");
222 wprintf(_("About this server"));
223 wprintf("</div><div class=\"boxcontent\">");
224 wprintf("<div id=\"info_inner\">");
225 server_info_section();
226 wprintf("</div></div></div>");
233 wprintf("</tr></table>");
238 * Display this user's summary page
243 output_headers(1, 1, 2, 0, 0, 0);
244 wprintf("<div id=\"banner\">\n");
245 wprintf("<div class=\"room_banner\">");
246 wprintf("<img src=\"static/summscreen_48x.gif\">");
248 snprintf(title, sizeof title, _("Summary page for %s"), WC->wc_fullname);
250 wprintf("</h1><h2>");
252 wprintf("</h2></div>");
253 wprintf("<ul class=\"room_actions\">\n");
254 wprintf("<li class=\"start_page\">");
255 offer_start_page(NULL, 0, NULL, NULL, CTX_NONE);
256 wprintf("</li></ul>");
260 * You guessed it ... we're going to refresh using ajax.
261 * In the future we might consider updating individual sections of the summary
262 * instead of the whole thing.
264 wprintf("<div id=\"content\" class=\"service\">\n");
269 "<script type=\"text/javascript\"> "
270 " new Ajax.PeriodicalUpdater('msg_inner', 'new_messages_html', "
271 " { method: 'get', frequency: 60 } ); "
272 " new Ajax.PeriodicalUpdater('tasks_inner', 'tasks_inner_html', "
273 " { method: 'get', frequency: 120 } ); "
274 " new Ajax.PeriodicalUpdater('calendar_inner', 'calendar_inner_html', "
275 " { method: 'get', frequency: 90 } ); "
276 " new Ajax.PeriodicalUpdater('do_template', 'template=wholistsummarysection', "
277 " { method: 'get', frequency: 30 } ); "
288 WebcitAddUrlHandler(HKEY("new_messages_html"), new_messages_section, AJAX);
289 WebcitAddUrlHandler(HKEY("tasks_inner_html"), tasks_section, AJAX);
290 WebcitAddUrlHandler(HKEY("calendar_inner_html"), calendar_section, AJAX);
291 WebcitAddUrlHandler(HKEY("mini_calendar"), ajax_mini_calendar, AJAX);
292 WebcitAddUrlHandler(HKEY("summary"), summary, 0);
293 WebcitAddUrlHandler(HKEY("summary_inner_div"), summary_inner_div, AJAX);