4 * Displays and customizes the iconbar.
10 /** Values for ib_displayas */
11 #define IB_PICTEXT 0 /**< picture and text */
12 #define IB_PICONLY 1 /**< just a picture */
13 #define IB_TEXTONLY 2 /**< just text */
17 * \brief draw the icon bar?????
19 void do_selected_iconbar(void) {
20 if (WC->current_iconbar == current_iconbar_roomlist) {
21 do_iconbar_roomlist();
29 * \brief draw the icon bar???
31 void do_iconbar(void) {
34 char key[SIZ], value[SIZ];
37 WC->current_iconbar = current_iconbar_menu;
40 * The initialized values of these variables also happen to
41 * specify the default values for users who haven't customized
42 * their iconbars. These should probably be set in a master
43 * configuration somewhere.
45 int ib_displayas = 0; /**< pictures and text, pictures, text */
46 int ib_logo = 0; /**< Site logo */
47 int ib_summary = 1; /**< Summary page icon */
48 int ib_inbox = 1; /**< Inbox icon */
49 int ib_calendar = 1; /**< Calendar icon */
50 int ib_contacts = 1; /**< Contacts icon */
51 int ib_notes = 1; /**< Notes icon */
52 int ib_tasks = 1; /**< Tasks icon */
53 int ib_rooms = 1; /**< Rooms icon */
54 int ib_users = 1; /**< Users icon */
55 int ib_chat = 1; /**< Chat icon */
56 int ib_advanced = 1; /**< Advanced Options icon */
57 int ib_citadel = 1; /**< 'Powered by Citadel' logo */
61 get_preference("iconbar", iconbar, sizeof iconbar);
62 for (i=0; i<num_tokens(iconbar, ','); ++i) {
63 extract_token(buf, iconbar, i, ',', sizeof buf);
64 extract_token(key, buf, 0, '=', sizeof key);
65 extract_token(value, buf, 1, '=', sizeof value);
67 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
68 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
69 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
70 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
71 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
72 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
73 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
74 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
75 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
76 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
77 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
78 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
79 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
83 if (ib_displayas != IB_TEXTONLY) {
84 wprintf("<div class=\"logo\"> <img "
85 "src=\"image&name=hello\" alt=\" \"> "
92 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
93 "<div class=\"logo_citadel\"> "
94 "<a href=\"http://www.citadel.org\" "
95 "title=\"%s\" target=\"aboutcit\"> "
97 "src=\"static/citadel-logo.gif\" alt=\"%s\"></a> "
99 _("Find out more about Citadel"),
103 wprintf("<ul id=\"button\">\n");
105 wprintf("<li class=\"switch\"><a href=\"javascript:switch_to_room_list()\">");
106 wprintf(_("switch to room list"));
107 wprintf("</a></li>");
110 wprintf("<li><a href=\"summary\" "
112 ">", _("Your summary page")
114 if (ib_displayas != IB_TEXTONLY) {
115 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
116 "src=\"static/summscreen_32x.gif\">");
118 if (ib_displayas != IB_PICONLY) {
119 wprintf(_("Summary"));
121 wprintf("</a></li>\n");
126 "<a href=\"dotgoto?room=_MAIL_\" "
129 _("Go to your email inbox")
131 if (ib_displayas != IB_TEXTONLY) {
132 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
133 "src=\"static/privatemess_32x.gif\">");
135 if (ib_displayas != IB_PICONLY) {
137 if (WC->new_mail != WC->remember_new_mail) {
139 if (WC->new_mail > 0) {
140 wprintf(" <b>(%d)</b>", WC->new_mail);
143 WC->remember_new_mail = WC->new_mail;
146 wprintf("</a></li>\n");
151 "<a href=\"dotgoto?room=_CALENDAR_\" "
154 _("Go to your personal calendar")
156 if (ib_displayas != IB_TEXTONLY) {
157 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
158 "src=\"static/calarea_32x.gif\">");
160 if (ib_displayas != IB_PICONLY) {
161 wprintf(_("Calendar"));
163 wprintf("</a></li>\n");
168 "<a href=\"dotgoto?room=_CONTACTS_\" "
171 _("Go to your personal address book")
173 if (ib_displayas != IB_TEXTONLY) {
174 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
175 "src=\"static/viewcontacts_32x.gif\">");
177 if (ib_displayas != IB_PICONLY) {
178 wprintf(_("Contacts"));
180 wprintf("</a></li>\n");
185 "<a href=\"dotgoto?room=_NOTES_\" "
188 _("Go to your personal notes")
190 if (ib_displayas != IB_TEXTONLY) {
191 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
192 "src=\"static/storenotes_32x.gif\">");
194 if (ib_displayas != IB_PICONLY) {
197 wprintf("</a></li>\n");
202 "<a href=\"dotgoto?room=_TASKS_\" "
205 _("Go to your personal task list")
207 if (ib_displayas != IB_TEXTONLY) {
208 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
209 "src=\"static/taskmanag_32x.gif\">");
211 if (ib_displayas != IB_PICONLY) {
214 wprintf("</a></li>\n");
219 "<a href=\"knrooms\" title=\"%s\" >",
220 _("List all of your accessible rooms")
222 if (ib_displayas != IB_TEXTONLY) {
223 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
224 "src=\"static/chatrooms_32x.gif\">");
226 if (ib_displayas != IB_PICONLY) {
229 wprintf("</a></li>\n");
234 "<a href=\"who\" title=\"%s\" "
236 _("See who is online right now")
238 if (ib_displayas != IB_TEXTONLY) {
239 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
240 "src=\"static/usermanag_32x.gif\">");
242 if (ib_displayas != IB_PICONLY) {
243 wprintf(_("Who is online?"));
249 wprintf("<ul id=\"wholist\">");
250 wprintf("</ul></li>\n");
256 "<a href=\"#\" onClick=\"window.open('chat', "
257 "'ctdl_chat_window', "
258 "'toolbar=no,location=no,directories=no,copyhistory=no,"
259 "status=no,scrollbars=yes,resizable=yes');\""
262 if (ib_displayas != IB_TEXTONLY) {
263 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
264 "src=\"static/citadelchat_32x.gif\">");
266 if (ib_displayas != IB_PICONLY) {
269 wprintf("</a></li>\n");
274 "<a href=\"display_main_menu\" "
277 _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
279 if (ib_displayas != IB_TEXTONLY) {
280 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
281 "src=\"static/advanpage2_32x.gif\">");
283 if (ib_displayas != IB_PICONLY) {
284 wprintf(_("Advanced"));
286 wprintf("</a></li>\n");
289 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
291 "<a href=\"display_aide_menu\" "
294 _("Room and system administration functions")
296 if (ib_displayas != IB_TEXTONLY) {
297 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
298 "src=\"static/advanpage2_32x.gif\">");
300 if (ib_displayas != IB_PICONLY) {
301 wprintf(_("Administration"));
303 wprintf("</a></li>\n");
307 "<a href=\"termquit\" title=\"%s\" "
308 "onClick=\"return confirm('%s');\">",
313 if (ib_displayas != IB_TEXTONLY) {
314 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
315 "src=\"static/logoff_32x.gif\">");
317 if (ib_displayas != IB_PICONLY) {
318 wprintf(_("Log off"));
320 wprintf("</a></li>\n");
323 "<li class=\"switch\">"
324 "<a href=\"display_customize_iconbar\" "
328 _("Customize this menu"),
329 _("customize this menu")
336 "<script type=\"text/javascript\"> "
337 " new Ajax.PeriodicalUpdater('wholist', 'wholist_section', { method: 'get', frequency: 30 } );"
346 * \brief roomtree view of the iconbar
347 * If the user has toggled the icon bar over to a room list, here's where
348 * we generate its innerHTML...
350 void do_iconbar_roomlist(void) {
353 char key[SIZ], value[SIZ];
356 WC->current_iconbar = current_iconbar_roomlist;
359 * The initialized values of these variables also happen to
360 * specify the default values for users who haven't customized
361 * their iconbars. These should probably be set in a master
362 * configuration somewhere.
364 int ib_displayas = 0; /* pictures and text, pictures, text */
365 int ib_logo = 0; /* Site logo */
366 int ib_citadel = 1; /* 'Powered by Citadel' logo */
370 get_preference("iconbar", iconbar, sizeof iconbar);
371 for (i=0; i<num_tokens(iconbar, ','); ++i) {
372 extract_token(buf, iconbar, i, ',', sizeof buf);
373 extract_token(key, buf, 0, '=', sizeof key);
374 extract_token(value, buf, 1, '=', sizeof value);
376 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
377 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
378 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
382 if (ib_displayas != IB_TEXTONLY) {
383 wprintf("<div class=\"logo\"> <img "
384 "src=\"image&name=hello\" alt=\" \"> "
390 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
391 "<div class=\"logo_citadel\"> "
392 "<a href=\"http://www.citadel.org\" "
393 "title=\"%s\" target=\"aboutcit\"> "
395 "src=\"static/citadel-logo.gif\" alt=\"%s\"></a> "
397 _("Find out more about Citadel"),
401 wprintf("<ul id=\"button\">\n");
403 wprintf("<li class=\"switch\"><a href=\"javascript:switch_to_menu_buttons()\">");
404 wprintf(_("switch to menu"));
405 wprintf("</a></li>");
408 "<a href=\"termquit\" title=\"%s\" "
409 "onClick=\"return confirm('%s');\">",
414 if (ib_displayas != IB_TEXTONLY) {
415 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
416 "src=\"static/logoff_32x.gif\">");
418 if (ib_displayas != IB_PICONLY) {
419 wprintf(_("Log off"));
421 wprintf("</a></li>\n");
425 /** embed the room list */
426 list_all_rooms_by_floor("iconbar");
433 * \brief display a customized version of the iconbar
435 void display_customize_iconbar(void) {
438 char key[SIZ], value[SIZ];
443 * The initialized values of these variables also happen to
444 * specify the default values for users who haven't customized
445 * their iconbars. These should probably be set in a master
446 * configuration somewhere.
448 int ib_displayas = IB_PICTEXT; /**< pictures and text, pictures, text */
449 int ib_logo = 0; /**< Site logo */
450 int ib_summary = 1; /**< Summary page icon */
451 int ib_inbox = 1; /**< Inbox icon */
452 int ib_calendar = 1; /**< Calendar icon */
453 int ib_contacts = 1; /**< Contacts icon */
454 int ib_notes = 1; /**< Notes icon */
455 int ib_tasks = 1; /**< Tasks icon */
456 int ib_rooms = 1; /**< Rooms icon */
457 int ib_users = 1; /**< Users icon */
458 int ib_chat = 1; /**< Chat icon */
459 int ib_advanced = 1; /**< Advanced Options icon */
460 int ib_citadel = 1; /**< 'Powered by Citadel' logo */
464 get_preference("iconbar", iconbar, sizeof iconbar);
465 for (i=0; i<num_tokens(iconbar, ','); ++i) {
466 extract_token(buf, iconbar, i, ',', sizeof buf);
467 extract_token(key, buf, 0, '=', sizeof key);
468 extract_token(value, buf, 1, '=', sizeof value);
470 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
471 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
472 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
473 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
474 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
475 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
476 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
477 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
478 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
479 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
480 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
481 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
482 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
485 output_headers(1, 1, 2, 0, 0, 0);
486 wprintf("<div id=\"banner\">");
488 wprintf(_("Customize the icon bar"));
489 wprintf("</h1></div>\n");
491 wprintf("<div id=\"content\" class=\"service\">\n");
493 wprintf("<div class=\"fix_scrollbar_bug\">");
495 wprintf("<form method=\"post\" action=\"commit_iconbar\">\n");
496 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
498 wprintf("<table class=\"altern\" >\n");
499 wprintf("<tr><td></td><td colspan=\"2\"><b>");
500 wprintf(_("Display icons as:"));
502 for (i=0; i<=2; ++i) {
503 wprintf("<input type=\"radio\" name=\"ib_displayas\" value=\"%d\"", i);
504 if (ib_displayas == i) wprintf(" CHECKED");
506 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
507 if (i == IB_PICONLY) wprintf(_("pictures only"));
508 if (i == IB_TEXTONLY) wprintf(_("text only"));
513 wprintf(_("Select the icons you would like to see displayed "
514 "in the 'icon bar' menu on the left side of the "
516 wprintf("</td></tr>\n");
519 wprintf("<tr class=\"%s\"><td>"
520 "<input type=\"radio\" name=\"ib_logo\" value=\"yes\" %s> %s "
521 "<input type=\"radio\" name=\"ib_logo\" value=\"no\" %s> %s <br />"
523 "<img src=\"image&name=hello\" width=\"48\" alt=\" \">"
528 (bar ? "even" : "odd"),
529 (ib_logo ? "CHECKED" : ""),_("Yes"),
530 (!ib_logo ? "CHECKED" : ""),_("No"),
532 _("An icon describing this site")
536 wprintf("<tr class=\"%s\"><td>"
537 "<input type=\"radio\" name=\"ib_summary\" value=\"yes\" %s> %s "
538 "<input type=\"radio\" name=\"ib_summary\" value=\"no\" %s> %s <br />"
540 "<img src=\"static/summscreen_48x.gif\" alt=\" \">"
545 (bar ? "even" : "odd"),
546 (ib_summary ? "CHECKED" : ""),_("Yes"),
547 (!ib_summary ? "CHECKED" : ""),_("No"),
549 _("Your summary page")
553 wprintf("<tr class=\"%s\"><td>"
554 "<input type=\"radio\" name=\"ib_inbox\" value=\"yes\" %s> %s "
555 "<input type=\"radio\" name=\"ib_inbox\" value=\"no\" %s> %s <br />"
557 "<img src=\"static/privatemess_48x.gif\" alt=\" \">"
562 (bar ? "even" : "odd"),
563 (ib_inbox ? "CHECKED" : ""),_("Yes"),
564 (!ib_inbox ? "CHECKED" : ""),_("No"),
566 _("A shortcut to your email Inbox")
570 wprintf("<tr class=\"%s\"><td>"
571 "<input type=\"radio\" name=\"ib_contacts\" value=\"yes\" %s> %s "
572 "<input type=\"radio\" name=\"ib_contacts\" value=\"no\" %s> %s <br />"
574 "<img src=\"static/viewcontacts_48x.gif\" alt=\" \">"
579 (bar ? "even" : "odd"),
580 (ib_contacts ? "CHECKED" : ""),_("Yes"),
581 (!ib_contacts ? "CHECKED" : ""),_("No"),
583 _("Your personal address book")
587 wprintf("<tr class=\"%s\"><td>"
588 "<input type=\"radio\" name=\"ib_notes\" value=\"yes\" %s> %s "
589 "<input type=\"radio\" name=\"ib_notes\" value=\"no\" %s> %s <br />"
591 "<img src=\"static/storenotes_48x.gif\" alt=\" \">"
596 (bar ? "even" : "odd"),
597 (ib_notes ? "CHECKED" : ""),_("Yes"),
598 (!ib_notes ? "CHECKED" : ""),_("No"),
600 _("Your personal notes")
604 wprintf("<tr class=\"%s\"><td>"
605 "<input type=\"radio\" name=\"ib_calendar\" value=\"yes\" %s> %s "
606 "<input type=\"radio\" name=\"ib_calendar\" value=\"no\" %s> %s <br />"
608 "<img src=\"static/calarea_48x.gif\" alt=\" \">"
613 (bar ? "even" : "odd"),
614 (ib_calendar ? "CHECKED" : ""),_("Yes"),
615 (!ib_calendar ? "CHECKED" : ""),_("No"),
617 _("A shortcut to your personal calendar")
621 wprintf("<tr class=\"%s\"><td>"
622 "<input type=\"radio\" name=\"ib_tasks\" value=\"yes\" %s> %s "
623 "<input type=\"radio\" name=\"ib_tasks\" value=\"no\" %s> %s <br />"
625 "<img src=\"static/taskmanag_48x.gif\" alt=\" \">"
630 (bar ? "even" : "odd"),
631 (ib_tasks ? "CHECKED" : ""),_("Yes"),
632 (!ib_tasks ? "CHECKED" : ""),_("No"),
634 _("A shortcut to your personal task list")
638 wprintf("<tr class=\"%s\"><td>"
639 "<input type=\"radio\" name=\"ib_rooms\" value=\"yes\" %s> %s "
640 "<input type=\"radio\" name=\"ib_rooms\" value=\"no\" %s> %s <br />"
642 "<img src=\"static/chatrooms_48x.gif\" alt=\" \">"
647 (bar ? "even" : "odd"),
648 (ib_rooms ? "CHECKED" : ""),_("Yes"),
649 (!ib_rooms ? "CHECKED" : ""),_("No"),
651 _("Clicking this icon displays a list of all accessible "
652 "rooms (or folders) available.")
656 wprintf("<tr class=\"%s\"><td>"
657 "<input type=\"radio\" name=\"ib_users\" value=\"yes\" %s> %s "
658 "<input type=\"radio\" name=\"ib_users\" value=\"no\" %s> %s <br />"
659 "<input type=\"radio\" name=\"ib_users\" value=\"yeslist\" %s> %s"
661 "<img src=\"static/usermanag_48x.gif\" alt=\" \">"
666 (bar ? "even" : "odd"),
667 (ib_users ? "CHECKED" : ""),_("Yes"),
668 (!ib_users ? "CHECKED" : ""),_("No"),
669 ((ib_users > 1) ? "CHECKED" : ""),_("Yes with users list"),
671 _("Clicking this icon displays a list of all users "
672 "currently logged in.")
676 wprintf("<tr class=\"%s\"><td>"
677 "<input type=\"radio\" name=\"ib_chat\" value=\"yes\" %s> %s "
678 "<input type=\"radio\" name=\"ib_chat\" value=\"no\" %s> %s <br />"
680 "<img src=\"static/citadelchat_48x.gif\" alt=\" \">"
685 (bar ? "even" : "odd"),
686 (ib_chat ? "CHECKED" : ""),_("Yes"),
687 (!ib_chat ? "CHECKED" : ""),_("No"),
689 _("Clicking this icon enters real-time chat mode "
690 "with other users in the same room.")
695 wprintf("<tr class=\"%s\"><td>"
696 "<input type=\"radio\" name=\"ib_advanced\" value=\"yes\" %s> %s "
697 "<input type=\"radio\" name=\"ib_advanced\" value=\"no\" %s> %s <br />"
699 "<img src=\"static/advanpage2_48x.gif\" alt=\" \">"
704 (bar ? "even" : "odd"),
705 (ib_advanced ? "CHECKED" : ""),_("Yes"),
706 (!ib_advanced ? "CHECKED" : ""),_("No"),
707 _("Advanced options"),
708 _("Access to the complete menu of Citadel functions.")
713 wprintf("<tr class=\"%s\"><td>"
714 "<input type=\"radio\" name=\"ib_citadel\" value=\"yes\" %s> %s "
715 "<input type=\"radio\" name=\"ib_citadel\" value=\"no\" %s> %s <br />"
717 "<img border=\"0\" width=\"48\" height=\"48\" "
718 "src=\"static/citadel-logo.gif\" alt=\" \">"
723 (bar ? "even" : "odd"),
724 (ib_citadel ? "CHECKED" : ""),_("Yes"),
725 (!ib_citadel ? "CHECKED" : ""),_("No"),
727 _("Displays the 'Powered by Citadel' icon")
730 wprintf("</table><br />\n"
732 "<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
734 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">"
740 wprintf("</form></div>\n");
745 * \brief commit the changes of an edited iconbar ????
747 void commit_iconbar(void) {
767 if (!havebstr("ok_button")) {
772 sprintf(iconbar, "ib_displayas=%d", ibstr("ib_displayas"));
774 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
776 if (!strcasecmp(BSTR(boxen[i]), "yes")) {
779 else if (!strcasecmp(BSTR(boxen[i]), "yeslist")) {
785 sprintf(&iconbar[strlen(iconbar)], ",%s=%s", boxen[i], Val);
788 set_preference("iconbar", iconbar, 1);
790 output_headers(1, 1, 2, 0, 0, 0);
791 wprintf("<div id=\"banner\">\n");
793 wprintf(_("Customize the icon bar"));
794 wprintf("</h1></div>\n");
796 wprintf("<div id=\"content\" class=\"service\">\n");
798 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
799 "<img src=\"static/advanpage2_48x.gif\">"
801 wprintf(_("Your icon bar has been updated. Please select any of its "
802 "choices to continue."));
803 wprintf("</td></tr></table>\n");