5 * \defgroup IconBar Displays and customizes the iconbar.
6 * \ingroup MenuInfrastructure
12 /** Values for ib_displayas */
13 #define IB_PICTEXT 0 /**< picture and text */
14 #define IB_PICONLY 1 /**< just a picture */
15 #define IB_TEXTONLY 2 /**< just text */
19 * \brief draw the icon bar?????
21 void do_selected_iconbar(void) {
22 if (WC->current_iconbar == current_iconbar_roomlist) {
23 do_iconbar_roomlist();
31 * \brief draw the icon bar???
33 void do_iconbar(void) {
36 char key[SIZ], value[SIZ];
39 WC->current_iconbar = current_iconbar_menu;
42 * The initialized values of these variables also happen to
43 * specify the default values for users who haven't customized
44 * their iconbars. These should probably be set in a master
45 * configuration somewhere.
47 int ib_displayas = 0; /**< pictures and text, pictures, text */
48 int ib_logo = 0; /**< Site logo */
49 int ib_summary = 1; /**< Summary page icon */
50 int ib_inbox = 1; /**< Inbox icon */
51 int ib_calendar = 1; /**< Calendar icon */
52 int ib_contacts = 1; /**< Contacts icon */
53 int ib_notes = 1; /**< Notes icon */
54 int ib_tasks = 1; /**< Tasks icon */
55 int ib_rooms = 1; /**< Rooms icon */
56 int ib_users = 1; /**< Users icon */
57 int ib_chat = 1; /**< Chat icon */
58 int ib_advanced = 1; /**< Advanced Options icon */
59 int ib_citadel = 1; /**< 'Powered by Citadel' logo */
63 get_preference("iconbar", iconbar, sizeof iconbar);
64 for (i=0; i<num_tokens(iconbar, ','); ++i) {
65 extract_token(buf, iconbar, i, ',', sizeof buf);
66 extract_token(key, buf, 0, '=', sizeof key);
67 extract_token(value, buf, 1, '=', sizeof value);
69 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
70 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
71 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
72 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
73 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
74 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
75 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
76 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
77 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
78 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
79 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
80 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
81 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
85 if (ib_displayas != IB_TEXTONLY) {
86 wprintf("<div class=\"logo\"> <img "
87 "src=\"image&name=hello\" alt=\" \"> "
94 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
95 "<div class=\"logo_citadel\"> "
96 "<a href=\"http://www.citadel.org\" "
97 "title=\"%s\" target=\"aboutcit\"> "
99 "src=\"static/citadel-logo.gif\" alt=\"%s\"></a> "
101 _("Find out more about Citadel"),
105 wprintf("<ul id=\"button\">\n");
107 wprintf("<li class=\"switch\"><a href=\"javascript:switch_to_room_list()\">");
108 wprintf(_("switch to room list"));
109 wprintf("</a></li>");
112 wprintf("<li><a href=\"summary\" "
114 ">", _("Your summary page")
116 if (ib_displayas != IB_TEXTONLY) {
117 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
118 "src=\"static/summscreen_32x.gif\">");
120 if (ib_displayas != IB_PICONLY) {
121 wprintf(_("Summary"));
123 wprintf("</a></li>\n");
128 "<a href=\"dotgoto?room=_MAIL_\" "
131 _("Go to your email inbox")
133 if (ib_displayas != IB_TEXTONLY) {
134 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
135 "src=\"static/privatemess_32x.gif\">");
137 if (ib_displayas != IB_PICONLY) {
139 if (WC->new_mail != WC->remember_new_mail) {
141 if (WC->new_mail > 0) {
142 wprintf(" <b>(%d)</b>", WC->new_mail);
145 WC->remember_new_mail = WC->new_mail;
148 wprintf("</a></li>\n");
153 "<a href=\"dotgoto?room=_CALENDAR_\" "
156 _("Go to your personal calendar")
158 if (ib_displayas != IB_TEXTONLY) {
159 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
160 "src=\"static/calarea_32x.gif\">");
162 if (ib_displayas != IB_PICONLY) {
163 wprintf(_("Calendar"));
165 wprintf("</a></li>\n");
170 "<a href=\"dotgoto?room=_CONTACTS_\" "
173 _("Go to your personal address book")
175 if (ib_displayas != IB_TEXTONLY) {
176 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
177 "src=\"static/viewcontacts_32x.gif\">");
179 if (ib_displayas != IB_PICONLY) {
180 wprintf(_("Contacts"));
182 wprintf("</a></li>\n");
187 "<a href=\"dotgoto?room=_NOTES_\" "
190 _("Go to your personal notes")
192 if (ib_displayas != IB_TEXTONLY) {
193 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
194 "src=\"static/storenotes_32x.gif\">");
196 if (ib_displayas != IB_PICONLY) {
199 wprintf("</a></li>\n");
204 "<a href=\"dotgoto?room=_TASKS_\" "
207 _("Go to your personal task list")
209 if (ib_displayas != IB_TEXTONLY) {
210 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
211 "src=\"static/taskmanag_32x.gif\">");
213 if (ib_displayas != IB_PICONLY) {
216 wprintf("</a></li>\n");
221 "<a href=\"knrooms\" title=\"%s\" >",
222 _("List all of your accessible rooms")
224 if (ib_displayas != IB_TEXTONLY) {
225 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
226 "src=\"static/chatrooms_32x.gif\">");
228 if (ib_displayas != IB_PICONLY) {
231 wprintf("</a></li>\n");
236 "<a href=\"who\" title=\"%s\" "
238 _("See who is online right now")
240 if (ib_displayas != IB_TEXTONLY) {
241 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
242 "src=\"static/usermanag_32x.gif\">");
244 if (ib_displayas != IB_PICONLY) {
245 wprintf(_("Who is online?"));
247 wprintf("</a></li>\n");
252 "<a href=\"#\" onClick=\"window.open('chat', "
253 "'ctdl_chat_window', "
254 "'toolbar=no,location=no,directories=no,copyhistory=no,"
255 "status=no,scrollbars=yes,resizable=yes');\""
258 if (ib_displayas != IB_TEXTONLY) {
259 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
260 "src=\"static/citadelchat_32x.gif\">");
262 if (ib_displayas != IB_PICONLY) {
265 wprintf("</a></li>\n");
270 "<a href=\"display_main_menu\" "
273 _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
275 if (ib_displayas != IB_TEXTONLY) {
276 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
277 "src=\"static/advanpage2_32x.gif\">");
279 if (ib_displayas != IB_PICONLY) {
280 wprintf(_("Advanced"));
282 wprintf("</a></li>\n");
285 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
287 "<a href=\"display_aide_menu\" "
290 _("Room and system administration functions")
292 if (ib_displayas != IB_TEXTONLY) {
293 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
294 "src=\"static/advanpage2_32x.gif\">");
296 if (ib_displayas != IB_PICONLY) {
297 wprintf(_("Administration"));
299 wprintf("</a></li>\n");
303 "<a href=\"termquit\" title=\"%s\" "
304 "onClick=\"return confirm('%s');\">",
309 if (ib_displayas != IB_TEXTONLY) {
310 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
311 "src=\"static/logoff_32x.gif\">");
313 if (ib_displayas != IB_PICONLY) {
314 wprintf(_("Log off"));
316 wprintf("</a></li>\n");
319 "<li class=\"switch\">"
320 "<a href=\"display_customize_iconbar\" "
324 _("Customize this menu"),
325 _("customize this menu")
333 * \brief roomtree view of the iconbar
334 * If the user has toggled the icon bar over to a room list, here's where
335 * we generate its innerHTML...
337 void do_iconbar_roomlist(void) {
340 char key[SIZ], value[SIZ];
343 WC->current_iconbar = current_iconbar_roomlist;
346 * The initialized values of these variables also happen to
347 * specify the default values for users who haven't customized
348 * their iconbars. These should probably be set in a master
349 * configuration somewhere.
351 int ib_displayas = 0; /* pictures and text, pictures, text */
352 int ib_logo = 0; /* Site logo */
353 int ib_citadel = 1; /* 'Powered by Citadel' logo */
357 get_preference("iconbar", iconbar, sizeof iconbar);
358 for (i=0; i<num_tokens(iconbar, ','); ++i) {
359 extract_token(buf, iconbar, i, ',', sizeof buf);
360 extract_token(key, buf, 0, '=', sizeof key);
361 extract_token(value, buf, 1, '=', sizeof value);
363 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
364 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
365 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
369 if (ib_displayas != IB_TEXTONLY) {
370 wprintf("<div class=\"logo\"> <img "
371 "src=\"image&name=hello\" alt=\" \"> "
377 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
378 "<div class=\"logo_citadel\"> "
379 "<a href=\"http://www.citadel.org\" "
380 "title=\"%s\" target=\"aboutcit\"> "
382 "src=\"static/citadel-logo.gif\" alt=\"%s\"></a> "
384 _("Find out more about Citadel"),
388 wprintf("<ul id=\"button\">\n");
390 wprintf("<li class=\"switch\"><a href=\"javascript:switch_to_menu_buttons()\">");
391 wprintf(_("switch to menu"));
392 wprintf("</a></li>");
395 "<a href=\"termquit\" title=\"%s\" "
396 "onClick=\"return confirm('%s');\">",
401 if (ib_displayas != IB_TEXTONLY) {
402 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
403 "src=\"static/logoff_32x.gif\">");
405 if (ib_displayas != IB_PICONLY) {
406 wprintf(_("Log off"));
408 wprintf("</a></li>\n");
412 /** embed the room list */
413 list_all_rooms_by_floor("iconbar");
420 * \brief display a customized version of the iconbar
422 void display_customize_iconbar(void) {
425 char key[SIZ], value[SIZ];
430 * The initialized values of these variables also happen to
431 * specify the default values for users who haven't customized
432 * their iconbars. These should probably be set in a master
433 * configuration somewhere.
435 int ib_displayas = IB_PICTEXT; /**< pictures and text, pictures, text */
436 int ib_logo = 0; /**< Site logo */
437 int ib_summary = 1; /**< Summary page icon */
438 int ib_inbox = 1; /**< Inbox icon */
439 int ib_calendar = 1; /**< Calendar icon */
440 int ib_contacts = 1; /**< Contacts icon */
441 int ib_notes = 1; /**< Notes icon */
442 int ib_tasks = 1; /**< Tasks icon */
443 int ib_rooms = 1; /**< Rooms icon */
444 int ib_users = 1; /**< Users icon */
445 int ib_chat = 1; /**< Chat icon */
446 int ib_advanced = 1; /**< Advanced Options icon */
447 int ib_citadel = 1; /**< 'Powered by Citadel' logo */
451 get_preference("iconbar", iconbar, sizeof iconbar);
452 for (i=0; i<num_tokens(iconbar, ','); ++i) {
453 extract_token(buf, iconbar, i, ',', sizeof buf);
454 extract_token(key, buf, 0, '=', sizeof key);
455 extract_token(value, buf, 1, '=', sizeof value);
457 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
458 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
459 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
460 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
461 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
462 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
463 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
464 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
465 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
466 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
467 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
468 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
469 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
472 output_headers(1, 1, 2, 0, 0, 0);
473 wprintf("<div id=\"banner\">\n"
474 "<TABLE class=\"iconbar_banner\"><tr><td>"
475 "<SPAN CLASS=\"titlebar\">");
476 wprintf(_("Customize the icon bar"));
478 "</td></tr></table>\n"
479 "</div>\n<div id=\"content\">\n"
482 wprintf("<div class=\"fix_scrollbar_bug\">"
483 "<table class=\"iconbar_background\"><tr><td>");
485 wprintf("<FORM METHOD=\"POST\" action=\"commit_iconbar\">\n");
488 wprintf(_("Display icons as:"));
490 for (i=0; i<=2; ++i) {
491 wprintf("<input type=\"radio\" name=\"ib_displayas\" value=\"%d\"", i);
492 if (ib_displayas == i) wprintf(" CHECKED");
494 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
495 if (i == IB_PICONLY) wprintf(_("pictures only"));
496 if (i == IB_TEXTONLY) wprintf(_("text only"));
499 wprintf("<br /><br />\n");
501 wprintf(_("Select the icons you would like to see displayed "
502 "in the 'icon bar' menu on the left side of the "
504 wprintf("</CENTER><br />\n");
506 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
508 wprintf("<tr BGCOLOR=%s><td>"
509 "<input type=\"checkbox\" name=\"ib_logo\" value=\"yes\" %s>"
511 "<img border=\"0\" width=\"48\" "
512 "src=\"image&name=hello\" alt=\" \">"
517 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
518 (ib_logo ? "CHECKED" : ""),
520 _("An icon describing this site")
523 wprintf("<tr bgcolor=%s><td>"
524 "<input type=\"checkbox\" name=\"ib_summary\" value=\"yes\" %s>"
526 "<img border=\"0\" width=\"48\" height=\"48\" "
527 "src=\"static/summscreen_48x.gif\" alt=\" \">"
532 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
533 (ib_summary ? "CHECKED" : ""),
535 _("Your summary page")
538 wprintf("<tr bgcolor=%s><td>"
539 "<input type=\"checkbox\" name=\"ib_inbox\" value=\"yes\" %s>"
541 "<img border=\"0\" width=\"48\" height=\"48\" "
542 "src=\"static/privatemess_48x.gif\" alt=\" \">"
547 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
548 (ib_inbox ? "CHECKED" : ""),
550 _("A shortcut to your email Inbox")
553 wprintf("<tr bgcolor=%s><td>"
554 "<input type=\"checkbox\" name=\"ib_contacts\" "
557 "<img border=\"0\" width=\"48\" height=\"48\" "
558 "src=\"static/viewcontacts_48x.gif\" alt=\" \">"
563 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
564 (ib_contacts ? "CHECKED" : ""),
566 _("Your personal address book")
569 wprintf("<tr bgcolor=%s><td>"
570 "<input type=\"checkbox\" name=\"ib_notes\" "
573 "<img border=\"0\" width=\"48\" height=\"48\" "
574 "src=\"static/storenotes_48x.gif\" alt=\" \">"
579 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
580 (ib_notes ? "CHECKED" : ""),
582 _("Your personal notes")
585 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
586 wprintf("<tr bgcolor=%s><td>"
587 "<input type=\"checkbox\" name=\"ib_calendar\" "
590 "<img border=\"0\" width=\"48\" height=\"48\" "
591 "src=\"static/calarea_48x.gif\" alt=\" \">"
596 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
597 (ib_calendar ? "CHECKED" : ""),
599 _("A shortcut to your personal calendar")
602 wprintf("<tr bgcolor=%s><td>"
603 "<input type=\"checkbox\" name=\"ib_tasks\" value=\"yes\" %s>"
605 "<img border=\"0\" width=\"48\" height=\"48\" "
606 "src=\"static/taskmanag_48x.gif\" alt=\" \">"
611 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
612 (ib_tasks ? "CHECKED" : ""),
614 _("A shortcut to your personal task list")
616 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
618 wprintf("<tr bgcolor=%s><td>"
619 "<input type=\"checkbox\" name=\"ib_rooms\" value=\"yes\" %s>"
621 "<img border=\"0\" width=\"48\" height=\"48\" "
622 "src=\"static/chatrooms_48x.gif\" alt=\" \">"
627 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
628 (ib_rooms ? "CHECKED" : ""),
630 _("Clicking this icon displays a list of all accessible "
631 "rooms (or folders) available.")
634 wprintf("<tr bgcolor=%s><td>"
635 "<input type=\"checkbox\" name=\"ib_users\" value=\"yes\" %s>"
637 "<img border=\"0\" width=\"48\" height=\"48\" "
638 "src=\"static/usermanag_48x.gif\" alt=\" \">"
643 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
644 (ib_users ? "CHECKED" : ""),
646 _("Clicking this icon displays a list of all users "
647 "currently logged in.")
650 wprintf("<tr bgcolor=%s><td>"
651 "<input type=\"checkbox\" name=\"ib_chat\" value=\"yes\" %s>"
653 "<img border=\"0\" width=\"48\" height=\"48\" "
654 "src=\"static/citadelchat_48x.gif\" alt=\" \">"
659 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
660 (ib_chat ? "CHECKED" : ""),
662 _("Clicking this icon enters real-time chat mode "
663 "with other users in the same room.")
667 wprintf("<tr bgcolor=%s><td>"
668 "<input type=\"checkbox\" name=\"ib_advanced\" "
671 "<img border=\"0\" width=\"48\" height=\"48\" "
672 "src=\"static/advanpage2_48x.gif\" alt=\" \">"
677 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
678 (ib_advanced ? "CHECKED" : ""),
679 _("Advanced options"),
680 _("Access to the complete menu of Citadel functions.")
684 wprintf("<tr bgcolor=%s><td>"
685 "<input type=\"checkbox\" name=\"ib_citadel\" "
688 "<img border=\"0\" width=\"48\" height=\"48\" "
689 "src=\"static/citadel-logo.gif\" alt=\" \">"
694 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
695 (ib_citadel ? "CHECKED" : ""),
697 _("Displays the 'Powered by Citadel' icon")
700 wprintf("</table><br />\n"
702 "<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
704 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">"
705 "</CENTER></FORM>\n",
710 wprintf("</td></tr></table></div>\n");
715 * \brief commit the changes of an edited iconbar ????
717 void commit_iconbar(void) {
737 if (strlen(bstr("ok_button")) == 0) {
742 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
744 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
745 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
746 if (!strcasecmp(bstr(boxen[i]), "yes")) {
747 sprintf(&iconbar[strlen(iconbar)], "1");
750 sprintf(&iconbar[strlen(iconbar)], "0");
754 set_preference("iconbar", iconbar, 1);
756 output_headers(1, 1, 0, 0, 0, 0);
758 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
759 "<img src=\"static/advanpage2_48x.gif\">"
761 wprintf(_("Your icon bar has been updated. Please select any of its "
762 "choices to continue."));
763 wprintf("</td></tr></table>\n");