4 * Displays and customizes the iconbar.
13 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <netinet/in.h>
30 /* Values for ib_displayas */
35 void do_iconbar(void) {
38 char key[SIZ], value[SIZ];
41 /* The initialized values of these variables also happen to
42 * specify the default values for users who haven't customized
43 * their iconbars. These should probably be set in a master
44 * configuration somewhere.
46 int ib_displayas = 0; /* pictures and text, pictures, text */
47 int ib_logo = 0; /* Site logo */
48 int ib_summary = 1; /* Summary page icon */
49 int ib_inbox = 1; /* Inbox icon */
50 int ib_calendar = 1; /* Calendar icon */
51 int ib_contacts = 1; /* Contacts icon */
52 int ib_notes = 1; /* Notes icon */
53 int ib_tasks = 1; /* Tasks icon */
54 int ib_rooms = 1; /* Rooms icon */
55 int ib_users = 1; /* Users icon */
56 int ib_chat = 1; /* Chat icon */
57 int ib_advanced = 1; /* Advanced Options icon */
58 int ib_citadel = 1; /* 'Powered by Citadel' logo */
62 get_preference("iconbar", iconbar);
63 for (i=0; i<num_tokens(iconbar, ','); ++i) {
64 extract_token(buf, iconbar, i, ',');
65 extract_token(key, buf, 0, '=');
66 extract_token(value, buf, 1, '=');
68 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
69 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
70 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
71 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
72 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
73 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
74 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
75 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
76 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
77 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
78 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
79 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
80 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
83 wprintf("<div id=\"button\">\n"
89 if (ib_displayas != IB_TEXTONLY) {
90 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
91 "HEIGHT=\"32\" SRC=\"/image&name=hello\" ALT=\" \">\n"
97 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
98 "<li><div align=\"center\">"
99 "<A HREF=\"http://www.citadel.org\" "
100 "title=\"Find out more about Citadel\" target=\"aboutcit\" "
101 "<img border=\"0\" width=\"48\" height=\"48\" "
102 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\">"
109 wprintf("<li><A HREF=\"/summary\" "
110 "TITLE=\"Your summary page\" "
113 if (ib_displayas != IB_TEXTONLY) {
114 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
115 "SRC=\"/static/summary.gif\">");
117 if (ib_displayas != IB_PICONLY) {
120 wprintf("</A></li>\n");
125 "<A HREF=\"/dotgoto?room=_MAIL_\" "
126 "TITLE=\"Go to your e-mail inbox\" "
129 if (ib_displayas != IB_TEXTONLY) {
130 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
131 "SRC=\"/static/mail.gif\">");
133 if (ib_displayas != IB_PICONLY) {
136 wprintf("</A></li>\n");
141 "<A HREF=\"/dotgoto?room=Calendar\" "
142 "TITLE=\"Go to your personal calendar\" "
145 if (ib_displayas != IB_TEXTONLY) {
146 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
147 "SRC=\"/static/vcalendar.gif\">");
149 if (ib_displayas != IB_PICONLY) {
152 wprintf("</A></li>\n");
157 "<A HREF=\"/dotgoto?room=Contacts\" "
158 "TITLE=\"Go to your personal address book\" "
161 if (ib_displayas != IB_TEXTONLY) {
162 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
163 "SRC=\"/static/vcard.gif\">");
165 if (ib_displayas != IB_PICONLY) {
168 wprintf("</A></li>\n");
173 "<A HREF=\"/dotgoto?room=Notes\" "
174 "TITLE=\"Go to your personal notes\" "
177 if (ib_displayas != IB_TEXTONLY) {
178 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
179 "SRC=\"/static/note.gif\">");
181 if (ib_displayas != IB_PICONLY) {
184 wprintf("</A></li>\n");
189 "<A HREF=\"/dotgoto?room=Tasks\" "
190 "TITLE=\"Go to your personal task list\" "
193 if (ib_displayas != IB_TEXTONLY) {
194 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
195 "SRC=\"/static/vcalendar.gif\">");
197 if (ib_displayas != IB_PICONLY) {
200 wprintf("</A></li>\n");
205 "<A HREF=\"/knrooms\" TITLE=\"List all of your "
206 "accessible rooms\" >"
208 if (ib_displayas != IB_TEXTONLY) {
209 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
210 "SRC=\"/static/rooms-icon.gif\">");
212 if (ib_displayas != IB_PICONLY) {
215 wprintf("</A></li>\n");
220 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
223 if (ib_displayas != IB_TEXTONLY) {
224 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
225 "SRC=\"/static/users-icon.gif\">");
227 if (ib_displayas != IB_PICONLY) {
228 wprintf("Who is online?");
230 wprintf("</A></li>\n");
235 "<A HREF=\"#\" onClick=\"window.open('/chat', "
236 "'ctdl_chat_window', "
237 "'toolbar=no,location=no,directories=no,copyhistory=no,"
238 "status=no,scrollbars=yes,resizable=yes');\""
241 if (ib_displayas != IB_TEXTONLY) {
242 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
243 "SRC=\"/static/chat-icon.gif\">");
245 if (ib_displayas != IB_PICONLY) {
248 wprintf("</A></li>\n");
253 "<A HREF=\"/display_main_menu\" "
254 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
255 "Account Info, and Chat\" "
258 if (ib_displayas != IB_TEXTONLY) {
259 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
260 "SRC=\"/static/advanced-icon.gif\">");
262 if (ib_displayas != IB_PICONLY) {
265 wprintf("</A></li>\n");
268 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
270 "<A HREF=\"/display_aide_menu\" "
271 "TITLE=\"Room and system administration functions\" "
274 if (ib_displayas != IB_TEXTONLY) {
275 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
276 "SRC=\"/static/advanced-icon.gif\">");
278 if (ib_displayas != IB_PICONLY) {
279 wprintf("Administration");
281 wprintf("</A></li>\n");
286 "<A HREF=\"/termquit\" TITLE=\"Log off\" "
287 "onClick=\"return confirm('Log off now?');\">"
289 if (ib_displayas != IB_TEXTONLY) {
290 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
291 "SRC=\"/static/exit-icon.gif\">");
293 if (ib_displayas != IB_PICONLY) {
296 wprintf("</A></li>\n");
300 "<li><div align=\"center\">"
301 "<A HREF=\"/display_customize_iconbar\" "
302 "TITLE=\"Customize this menu\" "
303 ">customize this menu</A>"
313 void display_customize_iconbar(void) {
316 char key[SIZ], value[SIZ];
320 /* The initialized values of these variables also happen to
321 * specify the default values for users who haven't customized
322 * their iconbars. These should probably be set in a master
323 * configuration somewhere.
325 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
326 int ib_logo = 0; /* Site logo */
327 int ib_summary = 1; /* Summary page icon */
328 int ib_inbox = 1; /* Inbox icon */
329 int ib_calendar = 1; /* Calendar icon */
330 int ib_contacts = 1; /* Contacts icon */
331 int ib_notes = 1; /* Notes icon */
332 int ib_tasks = 1; /* Tasks icon */
333 int ib_rooms = 1; /* Rooms icon */
334 int ib_users = 1; /* Users icon */
335 int ib_chat = 1; /* Chat icon */
336 int ib_advanced = 1; /* Advanced Options icon */
337 int ib_citadel = 1; /* 'Powered by Citadel' logo */
341 get_preference("iconbar", iconbar);
342 for (i=0; i<num_tokens(iconbar, ','); ++i) {
343 extract_token(buf, iconbar, i, ',');
344 extract_token(key, buf, 0, '=');
345 extract_token(value, buf, 1, '=');
347 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
348 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
349 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
350 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
351 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
352 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
353 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
354 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
355 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
356 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
357 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
358 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
359 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
362 output_headers(1, 1, 2, 0, 0, 0, 0);
363 wprintf("<div id=\"banner\">\n"
364 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
365 "<SPAN CLASS=\"titlebar\">Customize the icon bar</SPAN>"
366 "</TD></TR></TABLE>\n"
367 "</div>\n<div id=\"content\">\n"
370 wprintf("<center><table border=0 width=99%% bgcolor=\"#ffffff\"><tr><td>");
372 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
375 "Display icons as: ");
376 for (i=0; i<=2; ++i) {
377 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
378 if (ib_displayas == i) wprintf(" CHECKED");
380 if (i == IB_PICTEXT) wprintf("pictures and text");
381 if (i == IB_PICONLY) wprintf("pictures only");
382 if (i == IB_TEXTONLY) wprintf("text only");
385 wprintf("<br /><br />\n");
387 wprintf("Select the icons you would like to see displayed "
388 "in the "icon bar" menu on the left side of the "
389 "screen.</CENTER><br />\n"
392 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
394 wprintf("<TR BGCOLOR=%s><TD>"
395 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
397 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
398 "SRC=\"/image&name=hello\" ALT=\" \">"
400 "<B>Site logo</B><br />"
401 "A graphic describing this site"
403 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
404 (ib_logo ? "CHECKED" : "")
407 wprintf("<TR bgcolor=%s><TD>"
408 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
410 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
411 "SRC=\"/static/summary.gif\" ALT=\" \">"
413 "<B>Summary</B><br />"
416 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
417 (ib_summary ? "CHECKED" : "")
420 wprintf("<TR bgcolor=%s><TD>"
421 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
423 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
424 "SRC=\"/static/mail.gif\" ALT=\" \">"
426 "<B>Mail (inbox)</B><br />"
427 "A shortcut to your e-mail Inbox."
429 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
430 (ib_inbox ? "CHECKED" : "")
433 wprintf("<TR bgcolor=%s><TD>"
434 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
437 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
438 "SRC=\"/static/vcard.gif\" ALT=\" \">"
440 "<B>Contacts</B><br />"
441 "Your personal address book."
443 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
444 (ib_contacts ? "CHECKED" : "")
447 wprintf("<TR bgcolor=%s><TD>"
448 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
451 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
452 "SRC=\"/static/note.gif\" ALT=\" \">"
455 "Your personal notes."
457 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
458 (ib_notes ? "CHECKED" : "")
461 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
462 wprintf("<TR bgcolor=%s><TD>"
463 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
466 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
467 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
469 "<B>Calendar</B><br />"
470 "A shortcut to your personal calendar."
472 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
473 (ib_calendar ? "CHECKED" : "")
476 wprintf("<TR bgcolor=%s><TD>"
477 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
479 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
480 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
483 "A shortcut to your personal task list."
485 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
486 (ib_tasks ? "CHECKED" : "")
488 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
490 wprintf("<TR bgcolor=%s><TD>"
491 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
493 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
494 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
497 "Clicking this icon displays a list of all accesible "
498 "rooms (or folders) available."
500 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
501 (ib_rooms ? "CHECKED" : "")
504 wprintf("<TR bgcolor=%s><TD>"
505 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
507 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
508 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
510 "<B>Who is online?</B><br />"
511 "Clicking this icon displays a list of all users "
512 "currently logged in."
514 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
515 (ib_users ? "CHECKED" : "")
518 wprintf("<TR bgcolor=%s><TD>"
519 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
521 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
522 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
525 "Clicking this icon enters real-time chat mode "
526 "with other users in the same room."
528 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
529 (ib_chat ? "CHECKED" : "")
532 wprintf("<TR bgcolor=%s><TD>"
533 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
536 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
537 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
539 "<B>Advanced options</B><br />"
540 "Access to the complete menu of Citadel functions."
542 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
543 (ib_advanced ? "CHECKED" : "")
546 wprintf("<TR bgcolor=%s><TD>"
547 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
550 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
551 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
553 "<B>Citadel logo</B><br />"
554 "Displays the "Powered by Citadel" graphic"
556 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
557 (ib_citadel ? "CHECKED" : "")
560 wprintf("</TABLE><br />\n"
562 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
564 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
568 wprintf("</td></tr></table></center>\n");
573 void commit_iconbar(void) {
593 if (strcmp(bstr("sc"), "OK")) {
598 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
600 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
601 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
602 if (!strcasecmp(bstr(boxen[i]), "yes")) {
603 sprintf(&iconbar[strlen(iconbar)], "1");
606 sprintf(&iconbar[strlen(iconbar)], "0");
610 set_preference("iconbar", iconbar);
612 output_headers(1, 1, 0, 0, 0, 0, 0);
614 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
615 "<IMG SRC=\"/static/advanced-icon.gif\">"
617 "Your icon bar has been updated. Please select any of its "
618 "choices to continue."
619 "</td></tr></table>\n"