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);
84 wprintf("<div id=\"button\">\n"
90 if (ib_displayas != IB_TEXTONLY) {
91 wprintf("<IMG BORDER=\"0\" WIDTH=\"120\" "
92 "src=\"image&name=hello\" ALT=\" \">\n"
98 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
99 "<li><div align=\"center\">"
100 "<a href=\"http://www.citadel.org\" "
101 "title=\"%s\" target=\"aboutcit\">"
103 "src=\"static/citadel-logo.gif\" ALT=\"%s\"></a>"
105 _("Find out more about Citadel"),
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);
370 wprintf("<div id=\"button\">\n"
376 if (ib_displayas != IB_TEXTONLY) {
377 wprintf("<IMG BORDER=\"0\" WIDTH=\"120\" "
378 "src=\"image&name=hello\" ALT=\" \">\n"
384 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
385 "<li><div align=\"center\">"
386 "<a href=\"http://www.citadel.org\" "
387 "title=\"%s\" target=\"aboutcit\">"
389 "src=\"static/citadel-logo.gif\" ALT=\"%s\"></a>"
391 _("Find out more about Citadel"),
395 wprintf("<li><div align=\"center\"><a href=\"javascript:switch_to_menu_buttons()\">");
396 wprintf(_("switch to menu"));
397 wprintf("</a></div>");
400 "<a href=\"termquit\" TITLE=\"%s\" "
401 "onClick=\"return confirm('%s');\">",
406 if (ib_displayas != IB_TEXTONLY) {
407 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
408 "src=\"static/logoff_32x.gif\">");
410 if (ib_displayas != IB_PICONLY) {
411 wprintf(_("Log off"));
413 wprintf("</A></li>\n");
415 wprintf("</ul></div>\n");
417 /** embed the room list */
418 list_all_rooms_by_floor("iconbar");
425 * \brief display a customized version of the iconbar
427 void display_customize_iconbar(void) {
430 char key[SIZ], value[SIZ];
435 * The initialized values of these variables also happen to
436 * specify the default values for users who haven't customized
437 * their iconbars. These should probably be set in a master
438 * configuration somewhere.
440 int ib_displayas = IB_PICTEXT; /**< pictures and text, pictures, text */
441 int ib_logo = 0; /**< Site logo */
442 int ib_summary = 1; /**< Summary page icon */
443 int ib_inbox = 1; /**< Inbox icon */
444 int ib_calendar = 1; /**< Calendar icon */
445 int ib_contacts = 1; /**< Contacts icon */
446 int ib_notes = 1; /**< Notes icon */
447 int ib_tasks = 1; /**< Tasks icon */
448 int ib_rooms = 1; /**< Rooms icon */
449 int ib_users = 1; /**< Users icon */
450 int ib_chat = 1; /**< Chat icon */
451 int ib_advanced = 1; /**< Advanced Options icon */
452 int ib_citadel = 1; /**< 'Powered by Citadel' logo */
456 get_preference("iconbar", iconbar, sizeof iconbar);
457 for (i=0; i<num_tokens(iconbar, ','); ++i) {
458 extract_token(buf, iconbar, i, ',', sizeof buf);
459 extract_token(key, buf, 0, '=', sizeof key);
460 extract_token(value, buf, 1, '=', sizeof value);
462 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
463 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
464 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
465 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
466 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
467 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
468 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
469 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
470 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
471 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
472 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
473 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
474 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
477 output_headers(1, 1, 2, 0, 0, 0);
478 wprintf("<div id=\"banner\">\n"
479 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
480 "<SPAN CLASS=\"titlebar\">");
481 wprintf(_("Customize the icon bar"));
483 "</TD></TR></TABLE>\n"
484 "</div>\n<div id=\"content\">\n"
487 wprintf("<div class=\"fix_scrollbar_bug\">"
488 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
490 wprintf("<FORM METHOD=\"POST\" action=\"commit_iconbar\">\n");
493 wprintf(_("Display icons as:"));
495 for (i=0; i<=2; ++i) {
496 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
497 if (ib_displayas == i) wprintf(" CHECKED");
499 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
500 if (i == IB_PICONLY) wprintf(_("pictures only"));
501 if (i == IB_TEXTONLY) wprintf(_("text only"));
504 wprintf("<br /><br />\n");
506 wprintf(_("Select the icons you would like to see displayed "
507 "in the 'icon bar' menu on the left side of the "
509 wprintf("</CENTER><br />\n");
511 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
513 wprintf("<TR BGCOLOR=%s><TD>"
514 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
516 "<IMG BORDER=\"0\" WIDTH=\"48\" "
517 "src=\"image&name=hello\" ALT=\" \">"
522 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
523 (ib_logo ? "CHECKED" : ""),
525 _("An icon describing this site")
528 wprintf("<TR bgcolor=%s><TD>"
529 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
531 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
532 "src=\"static/summscreen_48x.gif\" ALT=\" \">"
537 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
538 (ib_summary ? "CHECKED" : ""),
540 _("Your summary page")
543 wprintf("<TR bgcolor=%s><TD>"
544 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
546 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
547 "src=\"static/privatemess_48x.gif\" ALT=\" \">"
552 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
553 (ib_inbox ? "CHECKED" : ""),
555 _("A shortcut to your email Inbox")
558 wprintf("<TR bgcolor=%s><TD>"
559 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
562 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
563 "src=\"static/viewcontacts_48x.gif\" ALT=\" \">"
568 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
569 (ib_contacts ? "CHECKED" : ""),
571 _("Your personal address book")
574 wprintf("<TR bgcolor=%s><TD>"
575 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
578 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
579 "src=\"static/storenotes_48x.gif\" ALT=\" \">"
584 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
585 (ib_notes ? "CHECKED" : ""),
587 _("Your personal notes")
590 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
591 wprintf("<TR bgcolor=%s><TD>"
592 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
595 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
596 "src=\"static/calarea_48x.gif\" ALT=\" \">"
601 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
602 (ib_calendar ? "CHECKED" : ""),
604 _("A shortcut to your personal calendar")
607 wprintf("<TR bgcolor=%s><TD>"
608 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
610 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
611 "src=\"static/taskmanag_48x.gif\" ALT=\" \">"
616 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
617 (ib_tasks ? "CHECKED" : ""),
619 _("A shortcut to your personal task list")
621 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
623 wprintf("<TR bgcolor=%s><TD>"
624 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
626 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
627 "src=\"static/chatrooms_48x.gif\" ALT=\" \">"
632 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
633 (ib_rooms ? "CHECKED" : ""),
635 _("Clicking this icon displays a list of all accessible "
636 "rooms (or folders) available.")
639 wprintf("<TR bgcolor=%s><TD>"
640 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
642 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
643 "src=\"static/usermanag_48x.gif\" ALT=\" \">"
648 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
649 (ib_users ? "CHECKED" : ""),
651 _("Clicking this icon displays a list of all users "
652 "currently logged in.")
655 wprintf("<TR bgcolor=%s><TD>"
656 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
658 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
659 "src=\"static/citadelchat_48x.gif\" ALT=\" \">"
664 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
665 (ib_chat ? "CHECKED" : ""),
667 _("Clicking this icon enters real-time chat mode "
668 "with other users in the same room.")
672 wprintf("<TR bgcolor=%s><TD>"
673 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
676 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
677 "src=\"static/advanpage2_48x.gif\" ALT=\" \">"
682 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
683 (ib_advanced ? "CHECKED" : ""),
684 _("Advanced options"),
685 _("Access to the complete menu of Citadel functions.")
689 wprintf("<TR bgcolor=%s><TD>"
690 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
693 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
694 "src=\"static/citadel-logo.gif\" ALT=\" \">"
699 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
700 (ib_citadel ? "CHECKED" : ""),
702 _("Displays the 'Powered by Citadel' icon")
705 wprintf("</TABLE><br />\n"
707 "<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
709 "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
710 "</CENTER></FORM>\n",
715 wprintf("</td></tr></table></div>\n");
720 * \brief commit the changes of an edited iconbar ????
722 void commit_iconbar(void) {
742 if (strlen(bstr("ok_button")) == 0) {
747 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
749 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
750 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
751 if (!strcasecmp(bstr(boxen[i]), "yes")) {
752 sprintf(&iconbar[strlen(iconbar)], "1");
755 sprintf(&iconbar[strlen(iconbar)], "0");
759 set_preference("iconbar", iconbar, 1);
761 output_headers(1, 1, 0, 0, 0, 0);
763 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
764 "<img src=\"static/advanpage2_48x.gif\">"
766 wprintf(_("Your icon bar has been updated. Please select any of its "
767 "choices to continue."));
768 wprintf("</td></tr></table>\n");