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, sizeof iconbar);
63 for (i=0; i<num_tokens(iconbar, ','); ++i) {
64 extract_token(buf, iconbar, i, ',', sizeof buf);
65 extract_token(key, buf, 0, '=', sizeof key);
66 extract_token(value, buf, 1, '=', sizeof value);
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\">"
102 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\"></a>"
108 wprintf("<li><A HREF=\"/summary\" "
109 "TITLE=\"Your summary page\" "
112 if (ib_displayas != IB_TEXTONLY) {
113 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
114 "SRC=\"/static/summscreen_32x.gif\">");
116 if (ib_displayas != IB_PICONLY) {
119 wprintf("</A></li>\n");
124 "<A HREF=\"/dotgoto?room=_MAIL_\" "
125 "TITLE=\"Go to your e-mail inbox\" "
128 if (ib_displayas != IB_TEXTONLY) {
129 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
130 "SRC=\"/static/privatemess_32x.gif\">");
132 if (ib_displayas != IB_PICONLY) {
135 wprintf("</A></li>\n");
140 "<A HREF=\"/dotgoto?room=_CALENDAR_\" "
141 "TITLE=\"Go to your personal calendar\" "
144 if (ib_displayas != IB_TEXTONLY) {
145 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
146 "SRC=\"/static/calarea_32x.gif\">");
148 if (ib_displayas != IB_PICONLY) {
151 wprintf("</A></li>\n");
156 "<A HREF=\"/dotgoto?room=_CONTACTS_\" "
157 "TITLE=\"Go to your personal address book\" "
160 if (ib_displayas != IB_TEXTONLY) {
161 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
162 "SRC=\"/static/viewcontacts_32x.gif\">");
164 if (ib_displayas != IB_PICONLY) {
167 wprintf("</A></li>\n");
172 "<A HREF=\"/dotgoto?room=_NOTES_\" "
173 "TITLE=\"Go to your personal notes\" "
176 if (ib_displayas != IB_TEXTONLY) {
177 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
178 "SRC=\"/static/storenotes_32x.gif\">");
180 if (ib_displayas != IB_PICONLY) {
183 wprintf("</A></li>\n");
188 "<A HREF=\"/dotgoto?room=_TASKS_\" "
189 "TITLE=\"Go to your personal task list\" "
192 if (ib_displayas != IB_TEXTONLY) {
193 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
194 "SRC=\"/static/taskmanag_32x.gif\">");
196 if (ib_displayas != IB_PICONLY) {
199 wprintf("</A></li>\n");
204 "<A HREF=\"/knrooms\" TITLE=\"List all of your "
205 "accessible rooms\" >"
207 if (ib_displayas != IB_TEXTONLY) {
208 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
209 "SRC=\"/static/chatrooms_32x.gif\">");
211 if (ib_displayas != IB_PICONLY) {
214 wprintf("</A></li>\n");
219 "<A HREF=\"/who\" TITLE=\"See who is online right now\" "
222 if (ib_displayas != IB_TEXTONLY) {
223 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
224 "SRC=\"/static/usermanag_32x.gif\">");
226 if (ib_displayas != IB_PICONLY) {
227 wprintf("Who is online?");
229 wprintf("</A></li>\n");
234 "<A HREF=\"#\" onClick=\"window.open('/chat', "
235 "'ctdl_chat_window', "
236 "'toolbar=no,location=no,directories=no,copyhistory=no,"
237 "status=no,scrollbars=yes,resizable=yes');\""
240 if (ib_displayas != IB_TEXTONLY) {
241 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
242 "SRC=\"/static/citadelchat_32x.gif\">");
244 if (ib_displayas != IB_PICONLY) {
247 wprintf("</A></li>\n");
252 "<A HREF=\"/display_main_menu\" "
253 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
254 "Account Info, and Chat\" "
257 if (ib_displayas != IB_TEXTONLY) {
258 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
259 "SRC=\"/static/advanpage2_32x.gif\">");
261 if (ib_displayas != IB_PICONLY) {
264 wprintf("</A></li>\n");
267 if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
269 "<A HREF=\"/display_aide_menu\" "
270 "TITLE=\"Room and system administration functions\" "
273 if (ib_displayas != IB_TEXTONLY) {
274 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
275 "SRC=\"/static/advanpage2_32x.gif\">");
277 if (ib_displayas != IB_PICONLY) {
278 wprintf("Administration");
280 wprintf("</A></li>\n");
285 "<A HREF=\"/termquit\" TITLE=\"Log off\" "
286 "onClick=\"return confirm('Log off now?');\">"
288 if (ib_displayas != IB_TEXTONLY) {
289 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
290 "SRC=\"/static/logoff_32x.gif\">");
292 if (ib_displayas != IB_PICONLY) {
295 wprintf("</A></li>\n");
299 "<li><div align=\"center\">"
300 "<A HREF=\"/display_customize_iconbar\" "
301 "TITLE=\"Customize this menu\" "
302 ">customize this menu"
312 void display_customize_iconbar(void) {
315 char key[SIZ], value[SIZ];
319 /* The initialized values of these variables also happen to
320 * specify the default values for users who haven't customized
321 * their iconbars. These should probably be set in a master
322 * configuration somewhere.
324 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
325 int ib_logo = 0; /* Site logo */
326 int ib_summary = 1; /* Summary page icon */
327 int ib_inbox = 1; /* Inbox icon */
328 int ib_calendar = 1; /* Calendar icon */
329 int ib_contacts = 1; /* Contacts icon */
330 int ib_notes = 1; /* Notes icon */
331 int ib_tasks = 1; /* Tasks icon */
332 int ib_rooms = 1; /* Rooms icon */
333 int ib_users = 1; /* Users icon */
334 int ib_chat = 1; /* Chat icon */
335 int ib_advanced = 1; /* Advanced Options icon */
336 int ib_citadel = 1; /* 'Powered by Citadel' logo */
340 get_preference("iconbar", iconbar, sizeof iconbar);
341 for (i=0; i<num_tokens(iconbar, ','); ++i) {
342 extract_token(buf, iconbar, i, ',', sizeof buf);
343 extract_token(key, buf, 0, '=', sizeof key);
344 extract_token(value, buf, 1, '=', sizeof value);
346 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
347 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
348 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
349 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
350 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
351 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
352 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
353 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
354 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
355 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
356 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
357 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
358 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
361 output_headers(1, 1, 2, 0, 0, 0, 0);
362 wprintf("<div id=\"banner\">\n"
363 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
364 "<SPAN CLASS=\"titlebar\">Customize the icon bar</SPAN>"
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 "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 "An icon 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/summscreen_48x.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/privatemess_48x.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/viewcontacts_48x.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/storenotes_48x.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/calarea_48x.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/taskmanag_48x.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/chatrooms_48x.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/usermanag_48x.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/citadelchat_48x.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/advanpage2_48x.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" icon"
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></div>\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, 1);
612 output_headers(1, 1, 0, 0, 0, 0, 0);
614 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
615 "<IMG SRC=\"/static/advanpage2_48x.gif\">"
617 "Your icon bar has been updated. Please select any of its "
618 "choices to continue."
619 "</td></tr></table>\n"