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("<div id=\"button\">\n"
109 wprintf("<li><div align=\"center\"><a href=\"javascript:switch_to_room_list()\">");
110 wprintf(_("switch to room list"));
111 wprintf("</a></div>");
114 wprintf("<li><a href=\"summary\" "
116 ">", _("Your summary page")
118 if (ib_displayas != IB_TEXTONLY) {
119 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
120 "src=\"static/summscreen_32x.gif\">");
122 if (ib_displayas != IB_PICONLY) {
123 wprintf(_("Summary"));
125 wprintf("</a></li>\n");
130 "<a href=\"dotgoto?room=_MAIL_\" "
133 _("Go to your email inbox")
135 if (ib_displayas != IB_TEXTONLY) {
136 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
137 "src=\"static/privatemess_32x.gif\">");
139 if (ib_displayas != IB_PICONLY) {
141 if (WC->new_mail != WC->remember_new_mail) {
143 if (WC->new_mail > 0) {
144 wprintf(" <b>(%d)</b>", WC->new_mail);
147 WC->remember_new_mail = WC->new_mail;
150 wprintf("</a></li>\n");
155 "<a href=\"dotgoto?room=_CALENDAR_\" "
158 _("Go to your personal calendar")
160 if (ib_displayas != IB_TEXTONLY) {
161 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
162 "src=\"static/calarea_32x.gif\">");
164 if (ib_displayas != IB_PICONLY) {
165 wprintf(_("Calendar"));
167 wprintf("</a></li>\n");
172 "<a href=\"dotgoto?room=_CONTACTS_\" "
175 _("Go to your personal address book")
177 if (ib_displayas != IB_TEXTONLY) {
178 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
179 "src=\"static/viewcontacts_32x.gif\">");
181 if (ib_displayas != IB_PICONLY) {
182 wprintf(_("Contacts"));
184 wprintf("</a></li>\n");
189 "<a href=\"dotgoto?room=_NOTES_\" "
192 _("Go to your personal notes")
194 if (ib_displayas != IB_TEXTONLY) {
195 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
196 "src=\"static/storenotes_32x.gif\">");
198 if (ib_displayas != IB_PICONLY) {
201 wprintf("</a></li>\n");
206 "<a href=\"dotgoto?room=_TASKS_\" "
209 _("Go to your personal task list")
211 if (ib_displayas != IB_TEXTONLY) {
212 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
213 "src=\"static/taskmanag_32x.gif\">");
215 if (ib_displayas != IB_PICONLY) {
218 wprintf("</a></li>\n");
223 "<a href=\"knrooms\" title=\"%s\" >",
224 _("List all of your accessible rooms")
226 if (ib_displayas != IB_TEXTONLY) {
227 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
228 "src=\"static/chatrooms_32x.gif\">");
230 if (ib_displayas != IB_PICONLY) {
233 wprintf("</a></li>\n");
238 "<a href=\"who\" title=\"%s\" "
240 _("See who is online right now")
242 if (ib_displayas != IB_TEXTONLY) {
243 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
244 "src=\"static/usermanag_32x.gif\">");
246 if (ib_displayas != IB_PICONLY) {
247 wprintf(_("Who is online?"));
249 wprintf("</a></li>\n");
254 "<a href=\"#\" onClick=\"window.open('chat', "
255 "'ctdl_chat_window', "
256 "'toolbar=no,location=no,directories=no,copyhistory=no,"
257 "status=no,scrollbars=yes,resizable=yes');\""
260 if (ib_displayas != IB_TEXTONLY) {
261 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
262 "src=\"static/citadelchat_32x.gif\">");
264 if (ib_displayas != IB_PICONLY) {
267 wprintf("</a></li>\n");
272 "<a href=\"display_main_menu\" "
275 _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
277 if (ib_displayas != IB_TEXTONLY) {
278 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
279 "src=\"static/advanpage2_32x.gif\">");
281 if (ib_displayas != IB_PICONLY) {
282 wprintf(_("Advanced"));
284 wprintf("</a></li>\n");
287 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
289 "<a href=\"display_aide_menu\" "
292 _("Room and system administration functions")
294 if (ib_displayas != IB_TEXTONLY) {
295 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
296 "src=\"static/advanpage2_32x.gif\">");
298 if (ib_displayas != IB_PICONLY) {
299 wprintf(_("Administration"));
301 wprintf("</a></li>\n");
305 "<a href=\"termquit\" title=\"%s\" "
306 "onClick=\"return confirm('%s');\">",
311 if (ib_displayas != IB_TEXTONLY) {
312 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
313 "src=\"static/logoff_32x.gif\">");
315 if (ib_displayas != IB_PICONLY) {
316 wprintf(_("Log off"));
318 wprintf("</a></li>\n");
321 "<li><div align=\"center\">"
322 "<a href=\"display_customize_iconbar\" "
326 _("Customize this menu"),
327 _("customize this menu")
330 wprintf("</ul></div>\n");
335 * \brief roomtree view of the iconbar
336 * If the user has toggled the icon bar over to a room list, here's where
337 * we generate its innerHTML...
339 void do_iconbar_roomlist(void) {
342 char key[SIZ], value[SIZ];
345 WC->current_iconbar = current_iconbar_roomlist;
348 * The initialized values of these variables also happen to
349 * specify the default values for users who haven't customized
350 * their iconbars. These should probably be set in a master
351 * configuration somewhere.
353 int ib_displayas = 0; /* pictures and text, pictures, text */
354 int ib_logo = 0; /* Site logo */
355 int ib_citadel = 1; /* 'Powered by Citadel' logo */
359 get_preference("iconbar", iconbar, sizeof iconbar);
360 for (i=0; i<num_tokens(iconbar, ','); ++i) {
361 extract_token(buf, iconbar, i, ',', sizeof buf);
362 extract_token(key, buf, 0, '=', sizeof key);
363 extract_token(value, buf, 1, '=', sizeof value);
365 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
366 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
367 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
371 if (ib_displayas != IB_TEXTONLY) {
372 wprintf("<div class=\"logo\"> <img "
373 "src=\"image&name=hello\" alt=\" \"> "
379 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
380 "<div class=\"logo_citadel\"> "
381 "<a href=\"http://www.citadel.org\" "
382 "title=\"%s\" target=\"aboutcit\"> "
384 "src=\"static/citadel-logo.gif\" alt=\"%s\"></a> "
386 _("Find out more about Citadel"),
390 wprintf("<div id=\"button\">\n"
394 wprintf("<div id=\"button\">\n"
398 wprintf("<li><div align=\"center\"><a href=\"javascript:switch_to_menu_buttons()\">");
399 wprintf(_("switch to menu"));
400 wprintf("</a></div>");
403 "<a href=\"termquit\" title=\"%s\" "
404 "onClick=\"return confirm('%s');\">",
409 if (ib_displayas != IB_TEXTONLY) {
410 wprintf("<img border=\"0\" width=\"32\" height=\"32\" "
411 "src=\"static/logoff_32x.gif\">");
413 if (ib_displayas != IB_PICONLY) {
414 wprintf(_("Log off"));
416 wprintf("</a></li>\n");
418 wprintf("</ul></div>\n");
420 /** embed the room list */
421 list_all_rooms_by_floor("iconbar");
428 * \brief display a customized version of the iconbar
430 void display_customize_iconbar(void) {
433 char key[SIZ], value[SIZ];
438 * The initialized values of these variables also happen to
439 * specify the default values for users who haven't customized
440 * their iconbars. These should probably be set in a master
441 * configuration somewhere.
443 int ib_displayas = IB_PICTEXT; /**< pictures and text, pictures, text */
444 int ib_logo = 0; /**< Site logo */
445 int ib_summary = 1; /**< Summary page icon */
446 int ib_inbox = 1; /**< Inbox icon */
447 int ib_calendar = 1; /**< Calendar icon */
448 int ib_contacts = 1; /**< Contacts icon */
449 int ib_notes = 1; /**< Notes icon */
450 int ib_tasks = 1; /**< Tasks icon */
451 int ib_rooms = 1; /**< Rooms icon */
452 int ib_users = 1; /**< Users icon */
453 int ib_chat = 1; /**< Chat icon */
454 int ib_advanced = 1; /**< Advanced Options icon */
455 int ib_citadel = 1; /**< 'Powered by Citadel' logo */
459 get_preference("iconbar", iconbar, sizeof iconbar);
460 for (i=0; i<num_tokens(iconbar, ','); ++i) {
461 extract_token(buf, iconbar, i, ',', sizeof buf);
462 extract_token(key, buf, 0, '=', sizeof key);
463 extract_token(value, buf, 1, '=', sizeof value);
465 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
466 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
467 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
468 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
469 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
470 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
471 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
472 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
473 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
474 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
475 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
476 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
477 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
480 output_headers(1, 1, 2, 0, 0, 0);
481 wprintf("<div id=\"banner\">\n"
482 "<TABLE class=\"iconbar_banner\"><tr><td>"
483 "<SPAN CLASS=\"titlebar\">");
484 wprintf(_("Customize the icon bar"));
486 "</td></tr></table>\n"
487 "</div>\n<div id=\"content\">\n"
490 wprintf("<div class=\"fix_scrollbar_bug\">"
491 "<table class=\"iconbar_background\"><tr><td>");
493 wprintf("<FORM METHOD=\"POST\" action=\"commit_iconbar\">\n");
496 wprintf(_("Display icons as:"));
498 for (i=0; i<=2; ++i) {
499 wprintf("<input type=\"radio\" name=\"ib_displayas\" value=\"%d\"", i);
500 if (ib_displayas == i) wprintf(" CHECKED");
502 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
503 if (i == IB_PICONLY) wprintf(_("pictures only"));
504 if (i == IB_TEXTONLY) wprintf(_("text only"));
507 wprintf("<br /><br />\n");
509 wprintf(_("Select the icons you would like to see displayed "
510 "in the 'icon bar' menu on the left side of the "
512 wprintf("</CENTER><br />\n");
514 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
516 wprintf("<tr BGCOLOR=%s><td>"
517 "<input type=\"checkbox\" name=\"ib_logo\" value=\"yes\" %s>"
519 "<img border=\"0\" width=\"48\" "
520 "src=\"image&name=hello\" alt=\" \">"
525 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
526 (ib_logo ? "CHECKED" : ""),
528 _("An icon describing this site")
531 wprintf("<tr bgcolor=%s><td>"
532 "<input type=\"checkbox\" name=\"ib_summary\" value=\"yes\" %s>"
534 "<img border=\"0\" width=\"48\" height=\"48\" "
535 "src=\"static/summscreen_48x.gif\" alt=\" \">"
540 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
541 (ib_summary ? "CHECKED" : ""),
543 _("Your summary page")
546 wprintf("<tr bgcolor=%s><td>"
547 "<input type=\"checkbox\" name=\"ib_inbox\" value=\"yes\" %s>"
549 "<img border=\"0\" width=\"48\" height=\"48\" "
550 "src=\"static/privatemess_48x.gif\" alt=\" \">"
555 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
556 (ib_inbox ? "CHECKED" : ""),
558 _("A shortcut to your email Inbox")
561 wprintf("<tr bgcolor=%s><td>"
562 "<input type=\"checkbox\" name=\"ib_contacts\" "
565 "<img border=\"0\" width=\"48\" height=\"48\" "
566 "src=\"static/viewcontacts_48x.gif\" alt=\" \">"
571 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
572 (ib_contacts ? "CHECKED" : ""),
574 _("Your personal address book")
577 wprintf("<tr bgcolor=%s><td>"
578 "<input type=\"checkbox\" name=\"ib_notes\" "
581 "<img border=\"0\" width=\"48\" height=\"48\" "
582 "src=\"static/storenotes_48x.gif\" alt=\" \">"
587 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
588 (ib_notes ? "CHECKED" : ""),
590 _("Your personal notes")
593 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
594 wprintf("<tr bgcolor=%s><td>"
595 "<input type=\"checkbox\" name=\"ib_calendar\" "
598 "<img border=\"0\" width=\"48\" height=\"48\" "
599 "src=\"static/calarea_48x.gif\" alt=\" \">"
604 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
605 (ib_calendar ? "CHECKED" : ""),
607 _("A shortcut to your personal calendar")
610 wprintf("<tr bgcolor=%s><td>"
611 "<input type=\"checkbox\" name=\"ib_tasks\" value=\"yes\" %s>"
613 "<img border=\"0\" width=\"48\" height=\"48\" "
614 "src=\"static/taskmanag_48x.gif\" alt=\" \">"
619 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
620 (ib_tasks ? "CHECKED" : ""),
622 _("A shortcut to your personal task list")
624 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
626 wprintf("<tr bgcolor=%s><td>"
627 "<input type=\"checkbox\" name=\"ib_rooms\" value=\"yes\" %s>"
629 "<img border=\"0\" width=\"48\" height=\"48\" "
630 "src=\"static/chatrooms_48x.gif\" alt=\" \">"
635 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
636 (ib_rooms ? "CHECKED" : ""),
638 _("Clicking this icon displays a list of all accessible "
639 "rooms (or folders) available.")
642 wprintf("<tr bgcolor=%s><td>"
643 "<input type=\"checkbox\" name=\"ib_users\" value=\"yes\" %s>"
645 "<img border=\"0\" width=\"48\" height=\"48\" "
646 "src=\"static/usermanag_48x.gif\" alt=\" \">"
651 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
652 (ib_users ? "CHECKED" : ""),
654 _("Clicking this icon displays a list of all users "
655 "currently logged in.")
658 wprintf("<tr bgcolor=%s><td>"
659 "<input type=\"checkbox\" name=\"ib_chat\" value=\"yes\" %s>"
661 "<img border=\"0\" width=\"48\" height=\"48\" "
662 "src=\"static/citadelchat_48x.gif\" alt=\" \">"
667 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
668 (ib_chat ? "CHECKED" : ""),
670 _("Clicking this icon enters real-time chat mode "
671 "with other users in the same room.")
675 wprintf("<tr bgcolor=%s><td>"
676 "<input type=\"checkbox\" name=\"ib_advanced\" "
679 "<img border=\"0\" width=\"48\" height=\"48\" "
680 "src=\"static/advanpage2_48x.gif\" alt=\" \">"
685 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
686 (ib_advanced ? "CHECKED" : ""),
687 _("Advanced options"),
688 _("Access to the complete menu of Citadel functions.")
692 wprintf("<tr bgcolor=%s><td>"
693 "<input type=\"checkbox\" name=\"ib_citadel\" "
696 "<img border=\"0\" width=\"48\" height=\"48\" "
697 "src=\"static/citadel-logo.gif\" alt=\" \">"
702 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
703 (ib_citadel ? "CHECKED" : ""),
705 _("Displays the 'Powered by Citadel' icon")
708 wprintf("</table><br />\n"
710 "<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
712 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">"
713 "</CENTER></FORM>\n",
718 wprintf("</td></tr></table></div>\n");
723 * \brief commit the changes of an edited iconbar ????
725 void commit_iconbar(void) {
745 if (strlen(bstr("ok_button")) == 0) {
750 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
752 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
753 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
754 if (!strcasecmp(bstr(boxen[i]), "yes")) {
755 sprintf(&iconbar[strlen(iconbar)], "1");
758 sprintf(&iconbar[strlen(iconbar)], "0");
762 set_preference("iconbar", iconbar, 1);
764 output_headers(1, 1, 0, 0, 0, 0);
766 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
767 "<img src=\"static/advanpage2_48x.gif\">"
769 wprintf(_("Your icon bar has been updated. Please select any of its "
770 "choices to continue."));
771 wprintf("</td></tr></table>\n");