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) {
117 if (WC->new_mail != WC->remember_new_mail) {
118 wprintf(" <b>(%d)</b>", WC->new_mail);
119 WC->remember_new_mail = WC->new_mail;
122 wprintf("</A></li>\n");
127 "<A HREF=\"/dotgoto?room=_CALENDAR_\" "
130 _("Go to your personal calendar")
132 if (ib_displayas != IB_TEXTONLY) {
133 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
134 "SRC=\"/static/calarea_32x.gif\">");
136 if (ib_displayas != IB_PICONLY) {
137 wprintf(_("Calendar"));
139 wprintf("</A></li>\n");
144 "<A HREF=\"/dotgoto?room=_CONTACTS_\" "
147 _("Go to your personal address book")
149 if (ib_displayas != IB_TEXTONLY) {
150 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
151 "SRC=\"/static/viewcontacts_32x.gif\">");
153 if (ib_displayas != IB_PICONLY) {
154 wprintf(_("Contacts"));
156 wprintf("</A></li>\n");
161 "<A HREF=\"/dotgoto?room=_NOTES_\" "
164 _("Go to your personal notes")
166 if (ib_displayas != IB_TEXTONLY) {
167 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
168 "SRC=\"/static/storenotes_32x.gif\">");
170 if (ib_displayas != IB_PICONLY) {
173 wprintf("</A></li>\n");
178 "<A HREF=\"/dotgoto?room=_TASKS_\" "
181 _("Go to your personal task list")
183 if (ib_displayas != IB_TEXTONLY) {
184 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
185 "SRC=\"/static/taskmanag_32x.gif\">");
187 if (ib_displayas != IB_PICONLY) {
190 wprintf("</A></li>\n");
195 "<A HREF=\"/knrooms\" TITLE=\"%s\" >",
196 _("List all of your accessible rooms")
198 if (ib_displayas != IB_TEXTONLY) {
199 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
200 "SRC=\"/static/chatrooms_32x.gif\">");
202 if (ib_displayas != IB_PICONLY) {
205 wprintf("</A></li>\n");
210 "<A HREF=\"/who\" TITLE=\"%s\" "
212 _("See who is online right now")
214 if (ib_displayas != IB_TEXTONLY) {
215 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
216 "SRC=\"/static/usermanag_32x.gif\">");
218 if (ib_displayas != IB_PICONLY) {
219 wprintf(_("Who is online?"));
221 wprintf("</A></li>\n");
226 "<A HREF=\"#\" onClick=\"window.open('/chat', "
227 "'ctdl_chat_window', "
228 "'toolbar=no,location=no,directories=no,copyhistory=no,"
229 "status=no,scrollbars=yes,resizable=yes');\""
232 if (ib_displayas != IB_TEXTONLY) {
233 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
234 "SRC=\"/static/citadelchat_32x.gif\">");
236 if (ib_displayas != IB_PICONLY) {
239 wprintf("</A></li>\n");
244 "<A HREF=\"/display_main_menu\" "
247 _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
249 if (ib_displayas != IB_TEXTONLY) {
250 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
251 "SRC=\"/static/advanpage2_32x.gif\">");
253 if (ib_displayas != IB_PICONLY) {
254 wprintf(_("Advanced"));
256 wprintf("</A></li>\n");
259 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
261 "<A HREF=\"/display_aide_menu\" "
264 _("Room and system administration functions")
266 if (ib_displayas != IB_TEXTONLY) {
267 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
268 "SRC=\"/static/advanpage2_32x.gif\">");
270 if (ib_displayas != IB_PICONLY) {
271 wprintf(_("Administration"));
273 wprintf("</A></li>\n");
278 "<A HREF=\"/termquit\" TITLE=\"%s\" "
279 "onClick=\"return confirm('%s');\">",
284 if (ib_displayas != IB_TEXTONLY) {
285 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
286 "SRC=\"/static/logoff_32x.gif\">");
288 if (ib_displayas != IB_PICONLY) {
289 wprintf(_("Log off"));
291 wprintf("</A></li>\n");
295 "<li><div align=\"center\">"
296 "<A HREF=\"/display_customize_iconbar\" "
300 _("Customize this menu"),
301 _("customize this menu")
310 void display_customize_iconbar(void) {
313 char key[SIZ], value[SIZ];
317 /* The initialized values of these variables also happen to
318 * specify the default values for users who haven't customized
319 * their iconbars. These should probably be set in a master
320 * configuration somewhere.
322 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
323 int ib_logo = 0; /* Site logo */
324 int ib_summary = 1; /* Summary page icon */
325 int ib_inbox = 1; /* Inbox icon */
326 int ib_calendar = 1; /* Calendar icon */
327 int ib_contacts = 1; /* Contacts icon */
328 int ib_notes = 1; /* Notes icon */
329 int ib_tasks = 1; /* Tasks icon */
330 int ib_rooms = 1; /* Rooms icon */
331 int ib_users = 1; /* Users icon */
332 int ib_chat = 1; /* Chat icon */
333 int ib_advanced = 1; /* Advanced Options icon */
334 int ib_citadel = 1; /* 'Powered by Citadel' logo */
338 get_preference("iconbar", iconbar, sizeof iconbar);
339 for (i=0; i<num_tokens(iconbar, ','); ++i) {
340 extract_token(buf, iconbar, i, ',', sizeof buf);
341 extract_token(key, buf, 0, '=', sizeof key);
342 extract_token(value, buf, 1, '=', sizeof value);
344 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
345 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
346 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
347 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
348 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
349 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
350 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
351 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
352 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
353 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
354 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
355 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
356 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
359 output_headers(1, 1, 2, 0, 0, 0);
360 wprintf("<div id=\"banner\">\n"
361 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
362 "<SPAN CLASS=\"titlebar\">");
363 wprintf(_("Customize the icon bar"));
365 "</TD></TR></TABLE>\n"
366 "</div>\n<div id=\"content\">\n"
369 wprintf("<div id=\"fix_scrollbar_bug\">"
370 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
372 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
375 wprintf(_("Display icons as:"));
377 for (i=0; i<=2; ++i) {
378 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
379 if (ib_displayas == i) wprintf(" CHECKED");
381 if (i == IB_PICTEXT) wprintf(_("pictures and text"));
382 if (i == IB_PICONLY) wprintf(_("pictures only"));
383 if (i == IB_TEXTONLY) wprintf(_("text only"));
386 wprintf("<br /><br />\n");
388 wprintf(_("Select the icons you would like to see displayed "
389 "in the 'icon bar' menu on the left side of the "
391 wprintf("</CENTER><br />\n");
393 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
395 wprintf("<TR BGCOLOR=%s><TD>"
396 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
398 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
399 "SRC=\"/image&name=hello\" ALT=\" \">"
404 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
405 (ib_logo ? "CHECKED" : ""),
407 _("An icon describing this site")
410 wprintf("<TR bgcolor=%s><TD>"
411 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
413 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
414 "SRC=\"/static/summscreen_48x.gif\" ALT=\" \">"
419 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
420 (ib_summary ? "CHECKED" : ""),
422 _("Your summary page")
425 wprintf("<TR bgcolor=%s><TD>"
426 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
428 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
429 "SRC=\"/static/privatemess_48x.gif\" ALT=\" \">"
434 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
435 (ib_inbox ? "CHECKED" : ""),
437 _("A shortcut to your email Inbox")
440 wprintf("<TR bgcolor=%s><TD>"
441 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
444 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
445 "SRC=\"/static/viewcontacts_48x.gif\" ALT=\" \">"
450 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
451 (ib_contacts ? "CHECKED" : ""),
453 _("Your personal address book")
456 wprintf("<TR bgcolor=%s><TD>"
457 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
460 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
461 "SRC=\"/static/storenotes_48x.gif\" ALT=\" \">"
466 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
467 (ib_notes ? "CHECKED" : ""),
469 _("Your personal notes")
472 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
473 wprintf("<TR bgcolor=%s><TD>"
474 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
477 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
478 "SRC=\"/static/calarea_48x.gif\" ALT=\" \">"
483 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
484 (ib_calendar ? "CHECKED" : ""),
486 _("A shortcut to your personal calendar")
489 wprintf("<TR bgcolor=%s><TD>"
490 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
492 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
493 "SRC=\"/static/taskmanag_48x.gif\" ALT=\" \">"
498 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
499 (ib_tasks ? "CHECKED" : ""),
501 _("A shortcut to your personal task list")
503 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
505 wprintf("<TR bgcolor=%s><TD>"
506 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
508 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
509 "SRC=\"/static/chatrooms_48x.gif\" ALT=\" \">"
514 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
515 (ib_rooms ? "CHECKED" : ""),
517 _("Clicking this icon displays a list of all accesible "
518 "rooms (or folders) available.")
521 wprintf("<TR bgcolor=%s><TD>"
522 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
524 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
525 "SRC=\"/static/usermanag_48x.gif\" ALT=\" \">"
530 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
531 (ib_users ? "CHECKED" : ""),
533 _("Clicking this icon displays a list of all users "
534 "currently logged in.")
537 wprintf("<TR bgcolor=%s><TD>"
538 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
540 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
541 "SRC=\"/static/citadelchat_48x.gif\" ALT=\" \">"
546 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
547 (ib_chat ? "CHECKED" : ""),
549 _("Clicking this icon enters real-time chat mode "
550 "with other users in the same room.")
554 wprintf("<TR bgcolor=%s><TD>"
555 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
558 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
559 "SRC=\"/static/advanpage2_48x.gif\" ALT=\" \">"
564 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
565 (ib_advanced ? "CHECKED" : ""),
566 _("Advanced options"),
567 _("Access to the complete menu of Citadel functions.")
571 wprintf("<TR bgcolor=%s><TD>"
572 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
575 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
576 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
581 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
582 (ib_citadel ? "CHECKED" : ""),
584 _("Displays the 'Powered by Citadel' icon")
587 wprintf("</TABLE><br />\n"
589 "<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
591 "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
592 "</CENTER></FORM>\n",
597 wprintf("</td></tr></table></div>\n");
602 void commit_iconbar(void) {
622 if (strlen(bstr("ok_button")) == 0) {
627 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
629 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
630 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
631 if (!strcasecmp(bstr(boxen[i]), "yes")) {
632 sprintf(&iconbar[strlen(iconbar)], "1");
635 sprintf(&iconbar[strlen(iconbar)], "0");
639 set_preference("iconbar", iconbar, 1);
641 output_headers(1, 1, 0, 0, 0, 0);
643 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
644 "<IMG SRC=\"/static/advanpage2_48x.gif\">"
646 wprintf(_("Your icon bar has been updated. Please select any of its "
647 "choices to continue."));
648 wprintf("</td></tr></table>\n");