4 * Displays and customizes the iconbar.
10 /* Values for ib_displayas */
15 void do_iconbar(void) {
18 char key[SIZ], value[SIZ];
21 /* The initialized values of these variables also happen to
22 * specify the default values for users who haven't customized
23 * their iconbars. These should probably be set in a master
24 * configuration somewhere.
26 int ib_displayas = 0; /* pictures and text, pictures, text */
27 int ib_logo = 0; /* Site logo */
28 int ib_summary = 1; /* Summary page icon */
29 int ib_inbox = 1; /* Inbox icon */
30 int ib_calendar = 1; /* Calendar icon */
31 int ib_contacts = 1; /* Contacts icon */
32 int ib_notes = 1; /* Notes icon */
33 int ib_tasks = 1; /* Tasks icon */
34 int ib_rooms = 1; /* Rooms icon */
35 int ib_users = 1; /* Users icon */
36 int ib_chat = 1; /* Chat icon */
37 int ib_advanced = 1; /* Advanced Options icon */
38 int ib_citadel = 1; /* 'Powered by Citadel' logo */
42 get_preference("iconbar", iconbar, sizeof iconbar);
43 for (i=0; i<num_tokens(iconbar, ','); ++i) {
44 extract_token(buf, iconbar, i, ',', sizeof buf);
45 extract_token(key, buf, 0, '=', sizeof key);
46 extract_token(value, buf, 1, '=', sizeof value);
48 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
49 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
50 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
51 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
52 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
53 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
54 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
55 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
56 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
57 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
58 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
59 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
60 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
63 wprintf("<div id=\"button\">\n"
69 if (ib_displayas != IB_TEXTONLY) {
70 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
71 "HEIGHT=\"32\" SRC=\"/image&name=hello\" ALT=\" \">\n"
77 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
78 "<li><div align=\"center\">"
79 "<A HREF=\"http://www.citadel.org\" "
80 "title=\"%s\" target=\"aboutcit\">"
82 "SRC=\"/static/citadel-logo.gif\" ALT=\"%s\"></a>"
84 _("Find out more about Citadel"),
90 wprintf("<li><A HREF=\"/summary\" "
92 ">", _("Your summary page")
94 if (ib_displayas != IB_TEXTONLY) {
95 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
96 "SRC=\"/static/summscreen_32x.gif\">");
98 if (ib_displayas != IB_PICONLY) {
99 wprintf(_("Summary"));
101 wprintf("</A></li>\n");
106 "<A HREF=\"/dotgoto?room=_MAIL_\" "
109 _("Go to your email inbox")
111 if (ib_displayas != IB_TEXTONLY) {
112 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
113 "SRC=\"/static/privatemess_32x.gif\">");
115 if (ib_displayas != IB_PICONLY) {
117 if (WC->new_mail != WC->remember_new_mail) {
118 if (WC->new_mail > 0) {
119 wprintf(" <b>(%d)</b>", WC->new_mail);
121 WC->remember_new_mail = WC->new_mail;
124 wprintf("</A></li>\n");
129 "<A HREF=\"/dotgoto?room=_CALENDAR_\" "
132 _("Go to your personal calendar")
134 if (ib_displayas != IB_TEXTONLY) {
135 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
136 "SRC=\"/static/calarea_32x.gif\">");
138 if (ib_displayas != IB_PICONLY) {
139 wprintf(_("Calendar"));
141 wprintf("</A></li>\n");
146 "<A HREF=\"/dotgoto?room=_CONTACTS_\" "
149 _("Go to your personal address book")
151 if (ib_displayas != IB_TEXTONLY) {
152 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
153 "SRC=\"/static/viewcontacts_32x.gif\">");
155 if (ib_displayas != IB_PICONLY) {
156 wprintf(_("Contacts"));
158 wprintf("</A></li>\n");
163 "<A HREF=\"/dotgoto?room=_NOTES_\" "
166 _("Go to your personal notes")
168 if (ib_displayas != IB_TEXTONLY) {
169 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
170 "SRC=\"/static/storenotes_32x.gif\">");
172 if (ib_displayas != IB_PICONLY) {
175 wprintf("</A></li>\n");
180 "<A HREF=\"/dotgoto?room=_TASKS_\" "
183 _("Go to your personal task list")
185 if (ib_displayas != IB_TEXTONLY) {
186 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
187 "SRC=\"/static/taskmanag_32x.gif\">");
189 if (ib_displayas != IB_PICONLY) {
192 wprintf("</A></li>\n");
197 "<A HREF=\"/knrooms\" TITLE=\"%s\" >",
198 _("List all of your accessible rooms")
200 if (ib_displayas != IB_TEXTONLY) {
201 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
202 "SRC=\"/static/chatrooms_32x.gif\">");
204 if (ib_displayas != IB_PICONLY) {
207 wprintf("</A></li>\n");
212 "<A HREF=\"/who\" TITLE=\"%s\" "
214 _("See who is online right now")
216 if (ib_displayas != IB_TEXTONLY) {
217 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
218 "SRC=\"/static/usermanag_32x.gif\">");
220 if (ib_displayas != IB_PICONLY) {
221 wprintf(_("Who is online?"));
223 wprintf("</A></li>\n");
228 "<A HREF=\"#\" onClick=\"window.open('/chat', "
229 "'ctdl_chat_window', "
230 "'toolbar=no,location=no,directories=no,copyhistory=no,"
231 "status=no,scrollbars=yes,resizable=yes');\""
234 if (ib_displayas != IB_TEXTONLY) {
235 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
236 "SRC=\"/static/citadelchat_32x.gif\">");
238 if (ib_displayas != IB_PICONLY) {
241 wprintf("</A></li>\n");
246 "<A HREF=\"/display_main_menu\" "
249 _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
251 if (ib_displayas != IB_TEXTONLY) {
252 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
253 "SRC=\"/static/advanpage2_32x.gif\">");
255 if (ib_displayas != IB_PICONLY) {
256 wprintf(_("Advanced"));
258 wprintf("</A></li>\n");
261 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
263 "<A HREF=\"/display_aide_menu\" "
266 _("Room and system administration functions")
268 if (ib_displayas != IB_TEXTONLY) {
269 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
270 "SRC=\"/static/advanpage2_32x.gif\">");
272 if (ib_displayas != IB_PICONLY) {
273 wprintf(_("Administration"));
275 wprintf("</A></li>\n");
280 "<A HREF=\"/termquit\" TITLE=\"%s\" "
281 "onClick=\"return confirm('%s');\">",
286 if (ib_displayas != IB_TEXTONLY) {
287 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
288 "SRC=\"/static/logoff_32x.gif\">");
290 if (ib_displayas != IB_PICONLY) {
291 wprintf(_("Log off"));
293 wprintf("</A></li>\n");
297 "<li><div align=\"center\">"
298 "<A HREF=\"/display_customize_iconbar\" "
302 _("Customize this menu"),
303 _("customize this menu")
312 void display_customize_iconbar(void) {
315 char key[SIZ], value[SIZ];
319 /* The initialized values of these variables also happen to
320 * specify the default values for users who haven't customized
321 * their iconbars. These should probably be set in a master
322 * configuration somewhere.
324 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
325 int ib_logo = 0; /* Site logo */
326 int ib_summary = 1; /* Summary page icon */
327 int ib_inbox = 1; /* Inbox icon */
328 int ib_calendar = 1; /* Calendar icon */
329 int ib_contacts = 1; /* Contacts icon */
330 int ib_notes = 1; /* Notes icon */
331 int ib_tasks = 1; /* Tasks icon */
332 int ib_rooms = 1; /* Rooms icon */
333 int ib_users = 1; /* Users icon */
334 int ib_chat = 1; /* Chat icon */
335 int ib_advanced = 1; /* Advanced Options icon */
336 int ib_citadel = 1; /* 'Powered by Citadel' logo */
340 get_preference("iconbar", iconbar, sizeof iconbar);
341 for (i=0; i<num_tokens(iconbar, ','); ++i) {
342 extract_token(buf, iconbar, i, ',', sizeof buf);
343 extract_token(key, buf, 0, '=', sizeof key);
344 extract_token(value, buf, 1, '=', sizeof value);
346 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
347 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
348 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
349 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
350 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
351 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
352 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
353 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
354 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
355 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
356 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
357 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
358 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
361 output_headers(1, 1, 2, 0, 0, 0);
362 wprintf("<div id=\"banner\">\n"
363 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
364 "<SPAN CLASS=\"titlebar\">");
365 wprintf(_("Customize the icon bar"));
367 "</TD></TR></TABLE>\n"
368 "</div>\n<div id=\"content\">\n"
371 wprintf("<div id=\"fix_scrollbar_bug\">"
372 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
374 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
377 wprintf(_("Display icons as:"));
379 for (i=0; i<=2; ++i) {
380 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
381 if (ib_displayas == i) wprintf(" CHECKED");
383 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
384 if (i == IB_PICONLY) wprintf(_("pictures only"));
385 if (i == IB_TEXTONLY) wprintf(_("text only"));
388 wprintf("<br /><br />\n");
390 wprintf(_("Select the icons you would like to see displayed "
391 "in the 'icon bar' menu on the left side of the "
393 wprintf("</CENTER><br />\n");
395 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
397 wprintf("<TR BGCOLOR=%s><TD>"
398 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
400 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
401 "SRC=\"/image&name=hello\" ALT=\" \">"
406 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
407 (ib_logo ? "CHECKED" : ""),
409 _("An icon describing this site")
412 wprintf("<TR bgcolor=%s><TD>"
413 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
415 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
416 "SRC=\"/static/summscreen_48x.gif\" ALT=\" \">"
421 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
422 (ib_summary ? "CHECKED" : ""),
424 _("Your summary page")
427 wprintf("<TR bgcolor=%s><TD>"
428 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
430 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
431 "SRC=\"/static/privatemess_48x.gif\" ALT=\" \">"
436 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
437 (ib_inbox ? "CHECKED" : ""),
439 _("A shortcut to your email Inbox")
442 wprintf("<TR bgcolor=%s><TD>"
443 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
446 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
447 "SRC=\"/static/viewcontacts_48x.gif\" ALT=\" \">"
452 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
453 (ib_contacts ? "CHECKED" : ""),
455 _("Your personal address book")
458 wprintf("<TR bgcolor=%s><TD>"
459 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
462 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
463 "SRC=\"/static/storenotes_48x.gif\" ALT=\" \">"
468 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
469 (ib_notes ? "CHECKED" : ""),
471 _("Your personal notes")
474 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
475 wprintf("<TR bgcolor=%s><TD>"
476 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
479 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
480 "SRC=\"/static/calarea_48x.gif\" ALT=\" \">"
485 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
486 (ib_calendar ? "CHECKED" : ""),
488 _("A shortcut to your personal calendar")
491 wprintf("<TR bgcolor=%s><TD>"
492 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
494 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
495 "SRC=\"/static/taskmanag_48x.gif\" ALT=\" \">"
500 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
501 (ib_tasks ? "CHECKED" : ""),
503 _("A shortcut to your personal task list")
505 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
507 wprintf("<TR bgcolor=%s><TD>"
508 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
510 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
511 "SRC=\"/static/chatrooms_48x.gif\" ALT=\" \">"
516 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
517 (ib_rooms ? "CHECKED" : ""),
519 _("Clicking this icon displays a list of all accesible "
520 "rooms (or folders) available.")
523 wprintf("<TR bgcolor=%s><TD>"
524 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
526 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
527 "SRC=\"/static/usermanag_48x.gif\" ALT=\" \">"
532 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
533 (ib_users ? "CHECKED" : ""),
535 _("Clicking this icon displays a list of all users "
536 "currently logged in.")
539 wprintf("<TR bgcolor=%s><TD>"
540 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
542 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
543 "SRC=\"/static/citadelchat_48x.gif\" ALT=\" \">"
548 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
549 (ib_chat ? "CHECKED" : ""),
551 _("Clicking this icon enters real-time chat mode "
552 "with other users in the same room.")
556 wprintf("<TR bgcolor=%s><TD>"
557 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
560 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
561 "SRC=\"/static/advanpage2_48x.gif\" ALT=\" \">"
566 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
567 (ib_advanced ? "CHECKED" : ""),
568 _("Advanced options"),
569 _("Access to the complete menu of Citadel functions.")
573 wprintf("<TR bgcolor=%s><TD>"
574 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
577 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
578 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
583 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
584 (ib_citadel ? "CHECKED" : ""),
586 _("Displays the 'Powered by Citadel' icon")
589 wprintf("</TABLE><br />\n"
591 "<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
593 "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
594 "</CENTER></FORM>\n",
599 wprintf("</td></tr></table></div>\n");
604 void commit_iconbar(void) {
624 if (strlen(bstr("ok_button")) == 0) {
629 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
631 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
632 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
633 if (!strcasecmp(bstr(boxen[i]), "yes")) {
634 sprintf(&iconbar[strlen(iconbar)], "1");
637 sprintf(&iconbar[strlen(iconbar)], "0");
641 set_preference("iconbar", iconbar, 1);
643 output_headers(1, 1, 0, 0, 0, 0);
645 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
646 "<IMG SRC=\"/static/advanpage2_48x.gif\">"
648 wprintf(_("Your icon bar has been updated. Please select any of its "
649 "choices to continue."));
650 wprintf("</td></tr></table>\n");