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/tasks.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("<div id=\"fix_scrollbar_bug\">"
371 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
373 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
376 "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 "
390 "screen.</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=\" \">"
401 "<B>Site logo</B><br />"
402 "A graphic describing this site"
404 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
405 (ib_logo ? "CHECKED" : "")
408 wprintf("<TR bgcolor=%s><TD>"
409 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
411 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
412 "SRC=\"/static/summary.gif\" ALT=\" \">"
414 "<B>Summary</B><br />"
417 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
418 (ib_summary ? "CHECKED" : "")
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/mail.gif\" ALT=\" \">"
427 "<B>Mail (inbox)</B><br />"
428 "A shortcut to your e-mail Inbox."
430 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
431 (ib_inbox ? "CHECKED" : "")
434 wprintf("<TR bgcolor=%s><TD>"
435 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
438 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
439 "SRC=\"/static/vcard.gif\" ALT=\" \">"
441 "<B>Contacts</B><br />"
442 "Your personal address book."
444 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
445 (ib_contacts ? "CHECKED" : "")
448 wprintf("<TR bgcolor=%s><TD>"
449 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
452 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
453 "SRC=\"/static/note.gif\" ALT=\" \">"
456 "Your personal notes."
458 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
459 (ib_notes ? "CHECKED" : "")
462 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
463 wprintf("<TR bgcolor=%s><TD>"
464 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
467 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
468 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
470 "<B>Calendar</B><br />"
471 "A shortcut to your personal calendar."
473 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
474 (ib_calendar ? "CHECKED" : "")
477 wprintf("<TR bgcolor=%s><TD>"
478 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
480 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
481 "SRC=\"/static/tasks.gif\" ALT=\" \">"
484 "A shortcut to your personal task list."
486 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
487 (ib_tasks ? "CHECKED" : "")
489 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
491 wprintf("<TR bgcolor=%s><TD>"
492 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
494 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
495 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
498 "Clicking this icon displays a list of all accesible "
499 "rooms (or folders) available."
501 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
502 (ib_rooms ? "CHECKED" : "")
505 wprintf("<TR bgcolor=%s><TD>"
506 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
508 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
509 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
511 "<B>Who is online?</B><br />"
512 "Clicking this icon displays a list of all users "
513 "currently logged in."
515 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
516 (ib_users ? "CHECKED" : "")
519 wprintf("<TR bgcolor=%s><TD>"
520 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
522 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
523 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
526 "Clicking this icon enters real-time chat mode "
527 "with other users in the same room."
529 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
530 (ib_chat ? "CHECKED" : "")
533 wprintf("<TR bgcolor=%s><TD>"
534 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
537 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
538 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
540 "<B>Advanced options</B><br />"
541 "Access to the complete menu of Citadel functions."
543 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
544 (ib_advanced ? "CHECKED" : "")
547 wprintf("<TR bgcolor=%s><TD>"
548 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
551 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
552 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
554 "<B>Citadel logo</B><br />"
555 "Displays the "Powered by Citadel" graphic"
557 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
558 (ib_citadel ? "CHECKED" : "")
561 wprintf("</TABLE><br />\n"
563 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
565 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
569 wprintf("</td></tr></table></div>\n");
574 void commit_iconbar(void) {
594 if (strcmp(bstr("sc"), "OK")) {
599 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
601 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
602 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
603 if (!strcasecmp(bstr(boxen[i]), "yes")) {
604 sprintf(&iconbar[strlen(iconbar)], "1");
607 sprintf(&iconbar[strlen(iconbar)], "0");
611 set_preference("iconbar", iconbar);
613 output_headers(1, 1, 0, 0, 0, 0, 0);
615 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
616 "<IMG SRC=\"/static/advanced-icon.gif\">"
618 "Your icon bar has been updated. Please select any of its "
619 "choices to continue."
620 "</td></tr></table>\n"