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?"));
251 wprintf("<ul id=\"wholist\">");
252 wprintf("</ul></li>\n");
258 "<a href=\"#\" onClick=\"window.open('chat', "
259 "'ctdl_chat_window', "
260 "'toolbar=no,location=no,directories=no,copyhistory=no,"
261 "status=no,scrollbars=yes,resizable=yes');\""
264 if (ib_displayas != IB_TEXTONLY) {
265 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
266 "src=\"static/citadelchat_32x.gif\">");
268 if (ib_displayas != IB_PICONLY) {
271 wprintf("</a></li>\n");
276 "<a href=\"display_main_menu\" "
279 _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
281 if (ib_displayas != IB_TEXTONLY) {
282 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
283 "src=\"static/advanpage2_32x.gif\">");
285 if (ib_displayas != IB_PICONLY) {
286 wprintf(_("Advanced"));
288 wprintf("</a></li>\n");
291 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
293 "<a href=\"display_aide_menu\" "
296 _("Room and system administration functions")
298 if (ib_displayas != IB_TEXTONLY) {
299 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
300 "src=\"static/advanpage2_32x.gif\">");
302 if (ib_displayas != IB_PICONLY) {
303 wprintf(_("Administration"));
305 wprintf("</a></li>\n");
309 "<a href=\"termquit\" title=\"%s\" "
310 "onClick=\"return confirm('%s');\">",
315 if (ib_displayas != IB_TEXTONLY) {
316 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
317 "src=\"static/logoff_32x.gif\">");
319 if (ib_displayas != IB_PICONLY) {
320 wprintf(_("Log off"));
322 wprintf("</a></li>\n");
325 "<li class=\"switch\">"
326 "<a href=\"display_customize_iconbar\" "
330 _("Customize this menu"),
331 _("customize this menu")
338 "<script type=\"text/javascript\"> "
339 " new Ajax.PeriodicalUpdater('wholist', 'wholist_section', { method: 'get', frequency: 30 } );"
348 * \brief roomtree view of the iconbar
349 * If the user has toggled the icon bar over to a room list, here's where
350 * we generate its innerHTML...
352 void do_iconbar_roomlist(void) {
355 char key[SIZ], value[SIZ];
358 WC->current_iconbar = current_iconbar_roomlist;
361 * The initialized values of these variables also happen to
362 * specify the default values for users who haven't customized
363 * their iconbars. These should probably be set in a master
364 * configuration somewhere.
366 int ib_displayas = 0; /* pictures and text, pictures, text */
367 int ib_logo = 0; /* Site logo */
368 int ib_citadel = 1; /* 'Powered by Citadel' logo */
372 get_preference("iconbar", iconbar, sizeof iconbar);
373 for (i=0; i<num_tokens(iconbar, ','); ++i) {
374 extract_token(buf, iconbar, i, ',', sizeof buf);
375 extract_token(key, buf, 0, '=', sizeof key);
376 extract_token(value, buf, 1, '=', sizeof value);
378 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
379 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
380 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
384 if (ib_displayas != IB_TEXTONLY) {
385 wprintf("<div class=\"logo\"> <img "
386 "src=\"image&name=hello\" alt=\" \"> "
392 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
393 "<div class=\"logo_citadel\"> "
394 "<a href=\"http://www.citadel.org\" "
395 "title=\"%s\" target=\"aboutcit\"> "
397 "src=\"static/citadel-logo.gif\" alt=\"%s\"></a> "
399 _("Find out more about Citadel"),
403 wprintf("<ul id=\"button\">\n");
405 wprintf("<li class=\"switch\"><a href=\"javascript:switch_to_menu_buttons()\">");
406 wprintf(_("switch to menu"));
407 wprintf("</a></li>");
410 "<a href=\"termquit\" title=\"%s\" "
411 "onClick=\"return confirm('%s');\">",
416 if (ib_displayas != IB_TEXTONLY) {
417 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
418 "src=\"static/logoff_32x.gif\">");
420 if (ib_displayas != IB_PICONLY) {
421 wprintf(_("Log off"));
423 wprintf("</a></li>\n");
427 /** embed the room list */
428 list_all_rooms_by_floor("iconbar");
435 * \brief display a customized version of the iconbar
437 void display_customize_iconbar(void) {
440 char key[SIZ], value[SIZ];
445 * The initialized values of these variables also happen to
446 * specify the default values for users who haven't customized
447 * their iconbars. These should probably be set in a master
448 * configuration somewhere.
450 int ib_displayas = IB_PICTEXT; /**< pictures and text, pictures, text */
451 int ib_logo = 0; /**< Site logo */
452 int ib_summary = 1; /**< Summary page icon */
453 int ib_inbox = 1; /**< Inbox icon */
454 int ib_calendar = 1; /**< Calendar icon */
455 int ib_contacts = 1; /**< Contacts icon */
456 int ib_notes = 1; /**< Notes icon */
457 int ib_tasks = 1; /**< Tasks icon */
458 int ib_rooms = 1; /**< Rooms icon */
459 int ib_users = 1; /**< Users icon */
460 int ib_chat = 1; /**< Chat icon */
461 int ib_advanced = 1; /**< Advanced Options icon */
462 int ib_citadel = 1; /**< 'Powered by Citadel' logo */
466 get_preference("iconbar", iconbar, sizeof iconbar);
467 for (i=0; i<num_tokens(iconbar, ','); ++i) {
468 extract_token(buf, iconbar, i, ',', sizeof buf);
469 extract_token(key, buf, 0, '=', sizeof key);
470 extract_token(value, buf, 1, '=', sizeof value);
472 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
473 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
474 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
475 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
476 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
477 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
478 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
479 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
480 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
481 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
482 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
483 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
484 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
487 output_headers(1, 1, 2, 0, 0, 0);
488 wprintf("<div id=\"banner\" class=\"service\">\n");
490 wprintf(_("Customize the icon bar"));
491 wprintf("</h1></div>\n");
492 wprintf("<div id=\"content\" class=\"customize_menu\">\n");
494 wprintf("<div class=\"fix_scrollbar_bug\">");
496 wprintf("<form method=\"post\" action=\"commit_iconbar\">\n");
497 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
499 wprintf("<table class=\"altern\" >\n");
500 wprintf("<tr><td></td><td colspan=\"2\"><b>");
501 wprintf(_("Display icons as:"));
503 for (i=0; i<=2; ++i) {
504 wprintf("<input type=\"radio\" name=\"ib_displayas\" value=\"%d\"", i);
505 if (ib_displayas == i) wprintf(" CHECKED");
507 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
508 if (i == IB_PICONLY) wprintf(_("pictures only"));
509 if (i == IB_TEXTONLY) wprintf(_("text only"));
514 wprintf(_("Select the icons you would like to see displayed "
515 "in the 'icon bar' menu on the left side of the "
517 wprintf("</td></tr>\n");
520 wprintf("<tr class=\"%s\"><td>"
521 "<input type=\"radio\" name=\"ib_logo\" value=\"yes\" %s> %s "
522 "<input type=\"radio\" name=\"ib_logo\" value=\"no\" %s> %s <br />"
524 "<img src=\"image&name=hello\" width=\"48\" alt=\" \">"
529 (bar ? "even" : "odd"),
530 (ib_logo ? "CHECKED" : ""),_("Yes"),
531 (!ib_logo ? "CHECKED" : ""),_("No"),
533 _("An icon describing this site")
537 wprintf("<tr class=\"%s\"><td>"
538 "<input type=\"radio\" name=\"ib_summary\" value=\"yes\" %s> %s "
539 "<input type=\"radio\" name=\"ib_summary\" value=\"no\" %s> %s <br />"
541 "<img src=\"static/summscreen_48x.gif\" alt=\" \">"
546 (bar ? "even" : "odd"),
547 (ib_summary ? "CHECKED" : ""),_("Yes"),
548 (!ib_summary ? "CHECKED" : ""),_("No"),
550 _("Your summary page")
554 wprintf("<tr class=\"%s\"><td>"
555 "<input type=\"radio\" name=\"ib_inbox\" value=\"yes\" %s> %s "
556 "<input type=\"radio\" name=\"ib_inbox\" value=\"no\" %s> %s <br />"
558 "<img src=\"static/privatemess_48x.gif\" alt=\" \">"
563 (bar ? "even" : "odd"),
564 (ib_inbox ? "CHECKED" : ""),_("Yes"),
565 (!ib_inbox ? "CHECKED" : ""),_("No"),
567 _("A shortcut to your email Inbox")
571 wprintf("<tr class=\"%s\"><td>"
572 "<input type=\"radio\" name=\"ib_contacts\" value=\"yes\" %s> %s "
573 "<input type=\"radio\" name=\"ib_contacts\" value=\"no\" %s> %s <br />"
575 "<img src=\"static/viewcontacts_48x.gif\" alt=\" \">"
580 (bar ? "even" : "odd"),
581 (ib_contacts ? "CHECKED" : ""),_("Yes"),
582 (!ib_contacts ? "CHECKED" : ""),_("No"),
584 _("Your personal address book")
588 wprintf("<tr class=\"%s\"><td>"
589 "<input type=\"radio\" name=\"ib_notes\" value=\"yes\" %s> %s "
590 "<input type=\"radio\" name=\"ib_notes\" value=\"no\" %s> %s <br />"
592 "<img src=\"static/storenotes_48x.gif\" alt=\" \">"
597 (bar ? "even" : "odd"),
598 (ib_notes ? "CHECKED" : ""),_("Yes"),
599 (!ib_notes ? "CHECKED" : ""),_("No"),
601 _("Your personal notes")
604 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
606 wprintf("<tr class=\"%s\"><td>"
607 "<input type=\"radio\" name=\"ib_calendar\" value=\"yes\" %s> %s "
608 "<input type=\"radio\" name=\"ib_calendar\" value=\"no\" %s> %s <br />"
610 "<img src=\"static/calarea_48x.gif\" alt=\" \">"
615 (bar ? "even" : "odd"),
616 (ib_calendar ? "CHECKED" : ""),_("Yes"),
617 (!ib_calendar ? "CHECKED" : ""),_("No"),
619 _("A shortcut to your personal calendar")
623 wprintf("<tr class=\"%s\"><td>"
624 "<input type=\"radio\" name=\"ib_tasks\" value=\"yes\" %s> %s "
625 "<input type=\"radio\" name=\"ib_tasks\" value=\"no\" %s> %s <br />"
627 "<img src=\"static/taskmanag_48x.gif\" alt=\" \">"
632 (bar ? "even" : "odd"),
633 (ib_tasks ? "CHECKED" : ""),_("Yes"),
634 (!ib_tasks ? "CHECKED" : ""),_("No"),
636 _("A shortcut to your personal task list")
638 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
641 wprintf("<tr class=\"%s\"><td>"
642 "<input type=\"radio\" name=\"ib_rooms\" value=\"yes\" %s> %s "
643 "<input type=\"radio\" name=\"ib_rooms\" value=\"no\" %s> %s <br />"
645 "<img src=\"static/chatrooms_48x.gif\" alt=\" \">"
650 (bar ? "even" : "odd"),
651 (ib_rooms ? "CHECKED" : ""),_("Yes"),
652 (!ib_rooms ? "CHECKED" : ""),_("No"),
654 _("Clicking this icon displays a list of all accessible "
655 "rooms (or folders) available.")
659 wprintf("<tr class=\"%s\"><td>"
660 "<input type=\"radio\" name=\"ib_users\" value=\"yes\" %s> %s "
661 "<input type=\"radio\" name=\"ib_users\" value=\"no\" %s> %s <br />"
662 "<input type=\"radio\" name=\"ib_users\" value=\"yeslist\" %s> %s"
664 "<img src=\"static/usermanag_48x.gif\" alt=\" \">"
669 (bar ? "even" : "odd"),
670 (ib_users ? "CHECKED" : ""),_("Yes"),
671 (!ib_users ? "CHECKED" : ""),_("No"),
672 ((ib_users > 1) ? "CHECKED" : ""),_("Yes with users list"),
674 _("Clicking this icon displays a list of all users "
675 "currently logged in.")
679 wprintf("<tr class=\"%s\"><td>"
680 "<input type=\"radio\" name=\"ib_chat\" value=\"yes\" %s> %s "
681 "<input type=\"radio\" name=\"ib_chat\" value=\"no\" %s> %s <br />"
683 "<img src=\"static/citadelchat_48x.gif\" alt=\" \">"
688 (bar ? "even" : "odd"),
689 (ib_chat ? "CHECKED" : ""),_("Yes"),
690 (!ib_chat ? "CHECKED" : ""),_("No"),
692 _("Clicking this icon enters real-time chat mode "
693 "with other users in the same room.")
698 wprintf("<tr class=\"%s\"><td>"
699 "<input type=\"radio\" name=\"ib_advanced\" value=\"yes\" %s> %s "
700 "<input type=\"radio\" name=\"ib_advanced\" value=\"no\" %s> %s <br />"
702 "<img src=\"static/advanpage2_48x.gif\" alt=\" \">"
707 (bar ? "even" : "odd"),
708 (ib_advanced ? "CHECKED" : ""),_("Yes"),
709 (!ib_advanced ? "CHECKED" : ""),_("No"),
710 _("Advanced options"),
711 _("Access to the complete menu of Citadel functions.")
716 wprintf("<tr class=\"%s\"><td>"
717 "<input type=\"radio\" name=\"ib_citadel\" value=\"yes\" %s> %s "
718 "<input type=\"radio\" name=\"ib_citadel\" value=\"no\" %s> %s <br />"
720 "<img border=\"0\" width=\"48\" height=\"48\" "
721 "src=\"static/citadel-logo.gif\" alt=\" \">"
726 (bar ? "even" : "odd"),
727 (ib_citadel ? "CHECKED" : ""),_("Yes"),
728 (!ib_citadel ? "CHECKED" : ""),_("No"),
730 _("Displays the 'Powered by Citadel' icon")
733 wprintf("</table><br />\n"
735 "<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
737 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">"
743 wprintf("</form></div>\n");
748 * \brief commit the changes of an edited iconbar ????
750 void commit_iconbar(void) {
770 if (IsEmptyStr(bstr("ok_button"))) {
775 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
777 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
779 if (!strcasecmp(bstr(boxen[i]), "yes")) {
782 else if (!strcasecmp(bstr(boxen[i]), "yeslist")) {
788 sprintf(&iconbar[strlen(iconbar)], ",%s=%s", boxen[i], Val);
791 set_preference("iconbar", iconbar, 1);
793 output_headers(1, 1, 2, 0, 0, 0);
794 wprintf("<div id=\"banner\" class=\"service\">\n");
796 wprintf(_("Customize the icon bar"));
797 wprintf("</h1></div>\n");
798 wprintf("<div id=\"content\" class=\"customize_menu\">\n");
800 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
801 "<img src=\"static/advanpage2_48x.gif\">"
803 wprintf(_("Your icon bar has been updated. Please select any of its "
804 "choices to continue."));
805 wprintf("</td></tr></table>\n");