4 * Displays and customizes the iconbar.
10 /* Values for ib_displayas */
15 void do_iconbar(void) {
18 char key[SIZ], value[SIZ];
21 /* The initialized values of these variables also happen to
22 * specify the default values for users who haven't customized
23 * their iconbars. These should probably be set in a master
24 * configuration somewhere.
26 int ib_displayas = 0; /* pictures and text, pictures, text */
27 int ib_logo = 0; /* Site logo */
28 int ib_summary = 1; /* Summary page icon */
29 int ib_inbox = 1; /* Inbox icon */
30 int ib_calendar = 1; /* Calendar icon */
31 int ib_contacts = 1; /* Contacts icon */
32 int ib_notes = 1; /* Notes icon */
33 int ib_tasks = 1; /* Tasks icon */
34 int ib_rooms = 1; /* Rooms icon */
35 int ib_users = 1; /* Users icon */
36 int ib_chat = 1; /* Chat icon */
37 int ib_advanced = 1; /* Advanced Options icon */
38 int ib_citadel = 1; /* 'Powered by Citadel' logo */
42 get_preference("iconbar", iconbar, sizeof iconbar);
43 for (i=0; i<num_tokens(iconbar, ','); ++i) {
44 extract_token(buf, iconbar, i, ',', sizeof buf);
45 extract_token(key, buf, 0, '=', sizeof key);
46 extract_token(value, buf, 1, '=', sizeof value);
48 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
49 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
50 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
51 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
52 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
53 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
54 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
55 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
56 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
57 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
58 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
59 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
60 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
63 wprintf("<div id=\"button\">\n"
69 if (ib_displayas != IB_TEXTONLY) {
70 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
71 "HEIGHT=\"32\" SRC=\"/image&name=hello\" ALT=\" \">\n"
77 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
78 "<li><div align=\"center\">"
79 "<A HREF=\"http://www.citadel.org\" "
80 "title=\"%s\" target=\"aboutcit\">"
82 "SRC=\"/static/citadel-logo.gif\" ALT=\"%s\"></a>"
84 _("Find out more about Citadel"),
90 wprintf("<li><A HREF=\"/summary\" "
92 ">", _("Your summary page")
94 if (ib_displayas != IB_TEXTONLY) {
95 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
96 "SRC=\"/static/summscreen_32x.gif\">");
98 if (ib_displayas != IB_PICONLY) {
99 wprintf(_("Summary"));
101 wprintf("</A></li>\n");
106 "<A HREF=\"/dotgoto?room=_MAIL_\" "
109 _("Go to your email inbox")
111 if (ib_displayas != IB_TEXTONLY) {
112 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
113 "SRC=\"/static/privatemess_32x.gif\">");
115 if (ib_displayas != IB_PICONLY) {
118 wprintf("</A></li>\n");
123 "<A HREF=\"/dotgoto?room=_CALENDAR_\" "
126 _("Go to your personal calendar")
128 if (ib_displayas != IB_TEXTONLY) {
129 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
130 "SRC=\"/static/calarea_32x.gif\">");
132 if (ib_displayas != IB_PICONLY) {
133 wprintf(_("Calendar"));
135 wprintf("</A></li>\n");
140 "<A HREF=\"/dotgoto?room=_CONTACTS_\" "
143 _("Go to your personal address book")
145 if (ib_displayas != IB_TEXTONLY) {
146 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
147 "SRC=\"/static/viewcontacts_32x.gif\">");
149 if (ib_displayas != IB_PICONLY) {
150 wprintf(_("Contacts"));
152 wprintf("</A></li>\n");
157 "<A HREF=\"/dotgoto?room=_NOTES_\" "
160 _("Go to your personal notes")
162 if (ib_displayas != IB_TEXTONLY) {
163 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
164 "SRC=\"/static/storenotes_32x.gif\">");
166 if (ib_displayas != IB_PICONLY) {
169 wprintf("</A></li>\n");
174 "<A HREF=\"/dotgoto?room=_TASKS_\" "
177 _("Go to your personal task list")
179 if (ib_displayas != IB_TEXTONLY) {
180 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
181 "SRC=\"/static/taskmanag_32x.gif\">");
183 if (ib_displayas != IB_PICONLY) {
186 wprintf("</A></li>\n");
191 "<A HREF=\"/knrooms\" TITLE=\"%s\" >",
192 _("List all of your accessible rooms")
194 if (ib_displayas != IB_TEXTONLY) {
195 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
196 "SRC=\"/static/chatrooms_32x.gif\">");
198 if (ib_displayas != IB_PICONLY) {
201 wprintf("</A></li>\n");
206 "<A HREF=\"/who\" TITLE=\"%s\" "
208 _("See who is online right now")
210 if (ib_displayas != IB_TEXTONLY) {
211 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
212 "SRC=\"/static/usermanag_32x.gif\">");
214 if (ib_displayas != IB_PICONLY) {
215 wprintf(_("Who is online?"));
217 wprintf("</A></li>\n");
222 "<A HREF=\"#\" onClick=\"window.open('/chat', "
223 "'ctdl_chat_window', "
224 "'toolbar=no,location=no,directories=no,copyhistory=no,"
225 "status=no,scrollbars=yes,resizable=yes');\""
228 if (ib_displayas != IB_TEXTONLY) {
229 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
230 "SRC=\"/static/citadelchat_32x.gif\">");
232 if (ib_displayas != IB_PICONLY) {
235 wprintf("</A></li>\n");
240 "<A HREF=\"/display_main_menu\" "
243 _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
245 if (ib_displayas != IB_TEXTONLY) {
246 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
247 "SRC=\"/static/advanpage2_32x.gif\">");
249 if (ib_displayas != IB_PICONLY) {
250 wprintf(_("Advanced"));
252 wprintf("</A></li>\n");
255 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
257 "<A HREF=\"/display_aide_menu\" "
260 _("Room and system administration functions")
262 if (ib_displayas != IB_TEXTONLY) {
263 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
264 "SRC=\"/static/advanpage2_32x.gif\">");
266 if (ib_displayas != IB_PICONLY) {
267 wprintf(_("Administration"));
269 wprintf("</A></li>\n");
274 "<A HREF=\"/termquit\" TITLE=\"%s\" "
275 "onClick=\"return confirm('%s');\">",
280 if (ib_displayas != IB_TEXTONLY) {
281 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
282 "SRC=\"/static/logoff_32x.gif\">");
284 if (ib_displayas != IB_PICONLY) {
285 wprintf(_("Log off"));
287 wprintf("</A></li>\n");
291 "<li><div align=\"center\">"
292 "<A HREF=\"/display_customize_iconbar\" "
296 _("Customize this menu"),
297 _("customize this menu")
306 void display_customize_iconbar(void) {
309 char key[SIZ], value[SIZ];
313 /* The initialized values of these variables also happen to
314 * specify the default values for users who haven't customized
315 * their iconbars. These should probably be set in a master
316 * configuration somewhere.
318 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
319 int ib_logo = 0; /* Site logo */
320 int ib_summary = 1; /* Summary page icon */
321 int ib_inbox = 1; /* Inbox icon */
322 int ib_calendar = 1; /* Calendar icon */
323 int ib_contacts = 1; /* Contacts icon */
324 int ib_notes = 1; /* Notes icon */
325 int ib_tasks = 1; /* Tasks icon */
326 int ib_rooms = 1; /* Rooms icon */
327 int ib_users = 1; /* Users icon */
328 int ib_chat = 1; /* Chat icon */
329 int ib_advanced = 1; /* Advanced Options icon */
330 int ib_citadel = 1; /* 'Powered by Citadel' logo */
334 get_preference("iconbar", iconbar, sizeof iconbar);
335 for (i=0; i<num_tokens(iconbar, ','); ++i) {
336 extract_token(buf, iconbar, i, ',', sizeof buf);
337 extract_token(key, buf, 0, '=', sizeof key);
338 extract_token(value, buf, 1, '=', sizeof value);
340 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
341 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
342 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
343 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
344 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
345 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
346 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
347 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
348 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
349 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
350 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
351 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
352 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
355 output_headers(1, 1, 2, 0, 0, 0);
356 wprintf("<div id=\"banner\">\n"
357 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
358 "<SPAN CLASS=\"titlebar\">");
359 wprintf(_("Customize the icon bar"));
361 "</TD></TR></TABLE>\n"
362 "</div>\n<div id=\"content\">\n"
365 wprintf("<div id=\"fix_scrollbar_bug\">"
366 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
368 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
371 wprintf(_("Display icons as:"));
373 for (i=0; i<=2; ++i) {
374 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
375 if (ib_displayas == i) wprintf(" CHECKED");
377 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
378 if (i == IB_PICONLY) wprintf(_("pictures only"));
379 if (i == IB_TEXTONLY) wprintf(_("text only"));
382 wprintf("<br /><br />\n");
384 wprintf(_("Select the icons you would like to see displayed "
385 "in the 'icon bar' menu on the left side of the "
387 wprintf("</CENTER><br />\n");
389 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
391 wprintf("<TR BGCOLOR=%s><TD>"
392 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
394 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
395 "SRC=\"/image&name=hello\" ALT=\" \">"
400 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
401 (ib_logo ? "CHECKED" : ""),
403 _("An icon describing this site")
406 wprintf("<TR bgcolor=%s><TD>"
407 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
409 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
410 "SRC=\"/static/summscreen_48x.gif\" ALT=\" \">"
415 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
416 (ib_summary ? "CHECKED" : ""),
418 _("Your summary page")
421 wprintf("<TR bgcolor=%s><TD>"
422 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
424 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
425 "SRC=\"/static/privatemess_48x.gif\" ALT=\" \">"
430 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
431 (ib_inbox ? "CHECKED" : ""),
433 _("A shortcut to your email Inbox")
436 wprintf("<TR bgcolor=%s><TD>"
437 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
440 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
441 "SRC=\"/static/viewcontacts_48x.gif\" ALT=\" \">"
446 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
447 (ib_contacts ? "CHECKED" : ""),
449 _("Your personal address book")
452 wprintf("<TR bgcolor=%s><TD>"
453 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
456 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
457 "SRC=\"/static/storenotes_48x.gif\" ALT=\" \">"
462 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
463 (ib_notes ? "CHECKED" : ""),
465 _("Your personal notes")
468 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
469 wprintf("<TR bgcolor=%s><TD>"
470 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
473 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
474 "SRC=\"/static/calarea_48x.gif\" ALT=\" \">"
479 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
480 (ib_calendar ? "CHECKED" : ""),
482 _("A shortcut to your personal calendar")
485 wprintf("<TR bgcolor=%s><TD>"
486 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
488 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
489 "SRC=\"/static/taskmanag_48x.gif\" ALT=\" \">"
494 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
495 (ib_tasks ? "CHECKED" : ""),
497 _("A shortcut to your personal task list")
499 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
501 wprintf("<TR bgcolor=%s><TD>"
502 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
504 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
505 "SRC=\"/static/chatrooms_48x.gif\" ALT=\" \">"
510 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
511 (ib_rooms ? "CHECKED" : ""),
513 _("Clicking this icon displays a list of all accesible "
514 "rooms (or folders) available.")
517 wprintf("<TR bgcolor=%s><TD>"
518 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
520 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
521 "SRC=\"/static/usermanag_48x.gif\" ALT=\" \">"
526 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
527 (ib_users ? "CHECKED" : ""),
529 _("Clicking this icon displays a list of all users "
530 "currently logged in.")
533 wprintf("<TR bgcolor=%s><TD>"
534 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
536 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
537 "SRC=\"/static/citadelchat_48x.gif\" ALT=\" \">"
542 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
543 (ib_chat ? "CHECKED" : ""),
545 _("Clicking this icon enters real-time chat mode "
546 "with other users in the same room.")
550 wprintf("<TR bgcolor=%s><TD>"
551 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
554 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
555 "SRC=\"/static/advanpage2_48x.gif\" ALT=\" \">"
560 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
561 (ib_advanced ? "CHECKED" : ""),
562 _("Advanced options"),
563 _("Access to the complete menu of Citadel functions.")
567 wprintf("<TR bgcolor=%s><TD>"
568 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
571 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
572 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
577 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
578 (ib_citadel ? "CHECKED" : ""),
580 _("Displays the 'Powered by Citadel' icon")
583 wprintf("</TABLE><br />\n"
585 "<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
587 "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
588 "</CENTER></FORM>\n",
593 wprintf("</td></tr></table></div>\n");
598 void commit_iconbar(void) {
618 if (strlen(bstr("ok_button")) == 0) {
623 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
625 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
626 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
627 if (!strcasecmp(bstr(boxen[i]), "yes")) {
628 sprintf(&iconbar[strlen(iconbar)], "1");
631 sprintf(&iconbar[strlen(iconbar)], "0");
635 set_preference("iconbar", iconbar, 1);
637 output_headers(1, 1, 0, 0, 0, 0);
639 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
640 "<IMG SRC=\"/static/advanpage2_48x.gif\">"
642 wprintf(_("Your icon bar has been updated. Please select any of its "
643 "choices to continue."));
644 wprintf("</td></tr></table>\n");