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_logoff = 1; /* Logoff button */
59 int ib_citadel = 1; /* 'Powered by Citadel' logo */
63 get_preference("iconbar", iconbar);
64 for (i=0; i<num_tokens(iconbar, ','); ++i) {
65 extract_token(buf, iconbar, i, ',');
66 extract_token(key, buf, 0, '=');
67 extract_token(value, buf, 1, '=');
69 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
70 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
71 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
72 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
73 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
74 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
75 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
76 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
77 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
78 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
79 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
80 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
81 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
82 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
85 wprintf("<div id=\"button\">\n"
91 if (ib_displayas != IB_TEXTONLY) {
92 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
93 "HEIGHT=\"32\" SRC=\"/image&name=hello\" ALT=\" \">\n"
100 wprintf("<li><A HREF=\"/summary\" "
101 "TITLE=\"Your summary page\" "
104 if (ib_displayas != IB_TEXTONLY) {
105 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
106 "SRC=\"/static/summary.gif\">");
108 if (ib_displayas != IB_PICONLY) {
111 wprintf("</A></li>\n");
116 "<A HREF=\"/dotgoto?room=_MAIL_\" "
117 "TITLE=\"Go to your e-mail inbox\" "
120 if (ib_displayas != IB_TEXTONLY) {
121 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
122 "SRC=\"/static/mail.gif\">");
124 if (ib_displayas != IB_PICONLY) {
127 wprintf("</A></li>\n");
132 "<A HREF=\"/dotgoto?room=Calendar\" "
133 "TITLE=\"Go to your personal calendar\" "
136 if (ib_displayas != IB_TEXTONLY) {
137 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
138 "SRC=\"/static/vcalendar.gif\">");
140 if (ib_displayas != IB_PICONLY) {
143 wprintf("</A></li>\n");
148 "<A HREF=\"/dotgoto?room=Contacts\" "
149 "TITLE=\"Go to your personal address book\" "
152 if (ib_displayas != IB_TEXTONLY) {
153 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
154 "SRC=\"/static/vcard.gif\">");
156 if (ib_displayas != IB_PICONLY) {
159 wprintf("</A></li>\n");
164 "<A HREF=\"/dotgoto?room=Notes\" "
165 "TITLE=\"Go to your personal notes\" "
168 if (ib_displayas != IB_TEXTONLY) {
169 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
170 "SRC=\"/static/note.gif\">");
172 if (ib_displayas != IB_PICONLY) {
175 wprintf("</A></li>\n");
180 "<A HREF=\"/dotgoto?room=Tasks\" "
181 "TITLE=\"Go to your personal task list\" "
184 if (ib_displayas != IB_TEXTONLY) {
185 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
186 "SRC=\"/static/vcalendar.gif\">");
188 if (ib_displayas != IB_PICONLY) {
191 wprintf("</A></li>\n");
196 "<A HREF=\"/knrooms\" TITLE=\"List all of your "
197 "accessible rooms\" >"
199 if (ib_displayas != IB_TEXTONLY) {
200 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
201 "SRC=\"/static/rooms-icon.gif\">");
203 if (ib_displayas != IB_PICONLY) {
206 wprintf("</A></li>\n");
211 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
214 if (ib_displayas != IB_TEXTONLY) {
215 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
216 "SRC=\"/static/users-icon.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/chat-icon.gif\">");
236 if (ib_displayas != IB_PICONLY) {
239 wprintf("</A></li>\n");
244 "<A HREF=\"/display_main_menu\" "
245 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
246 "Account Info, and Chat\" "
249 if (ib_displayas != IB_TEXTONLY) {
250 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
251 "SRC=\"/static/advanced-icon.gif\">");
253 if (ib_displayas != IB_PICONLY) {
256 wprintf("</A></li>\n");
261 "<A HREF=\"/termquit\" TITLE=\"Log off\" "
262 "onClick=\"return confirm('Log off now?');\">"
264 if (ib_displayas != IB_TEXTONLY) {
265 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
266 "SRC=\"/static/exit-icon.gif\">");
268 if (ib_displayas != IB_PICONLY) {
271 wprintf("</A></li>\n");
275 "<li><div align=\"center\">"
276 "<A HREF=\"/display_customize_iconbar\" "
277 "TITLE=\"Customize this menu\" "
278 ">customize this menu</A>"
282 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
283 "<li><div align=\"center\">"
284 "<A HREF=\"http://www.citadel.org\" "
285 "title=\"Find out more about Citadel\" target=\"aboutcit\" "
286 "onMouseOver=\"window.status='Find out more about "
287 "Citadel'; return true;\">powered by<br /><IMG "
288 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
289 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\">"
300 void display_customize_iconbar(void) {
303 char key[SIZ], value[SIZ];
306 /* The initialized values of these variables also happen to
307 * specify the default values for users who haven't customized
308 * their iconbars. These should probably be set in a master
309 * configuration somewhere.
311 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
312 int ib_logo = 0; /* Site logo */
313 int ib_summary = 1; /* Summary page icon */
314 int ib_inbox = 1; /* Inbox icon */
315 int ib_calendar = 1; /* Calendar icon */
316 int ib_contacts = 1; /* Contacts icon */
317 int ib_notes = 1; /* Notes icon */
318 int ib_tasks = 1; /* Tasks icon */
319 int ib_rooms = 1; /* Rooms icon */
320 int ib_users = 1; /* Users icon */
321 int ib_chat = 1; /* Chat icon */
322 int ib_advanced = 1; /* Advanced Options icon */
323 int ib_logoff = 1; /* Logoff button */
324 int ib_citadel = 1; /* 'Powered by Citadel' logo */
328 get_preference("iconbar", iconbar);
329 for (i=0; i<num_tokens(iconbar, ','); ++i) {
330 extract_token(buf, iconbar, i, ',');
331 extract_token(key, buf, 0, '=');
332 extract_token(value, buf, 1, '=');
334 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
335 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
336 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
337 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
338 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
339 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
340 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
341 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
342 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
343 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
344 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
345 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
346 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
347 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
350 output_headers(1, 1, 2, 0, 0, 0, 0);
351 wprintf("<div id=\"banner\">\n"
352 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
353 "<SPAN CLASS=\"titlebar\">Customize the icon bar</SPAN>"
354 "</TD></TR></TABLE>\n"
355 "</div>\n<div id=\"content\">\n"
358 wprintf("<center><table border=0 width=99%% bgcolor=\"#ffffff\"><tr><td>");
360 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
363 "Display icons as: ");
364 for (i=0; i<=2; ++i) {
365 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
366 if (ib_displayas == i) wprintf(" CHECKED");
368 if (i == IB_PICTEXT) wprintf("pictures and text");
369 if (i == IB_PICONLY) wprintf("pictures only");
370 if (i == IB_TEXTONLY) wprintf("text only");
373 wprintf("<br /><br />\n");
375 wprintf("Select the icons you would like to see displayed "
376 "in the "icon bar" menu on the left side of the "
377 "screen.</CENTER><br />\n"
380 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
382 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
383 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
385 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
386 "SRC=\"/image&name=hello\" ALT=\" \">"
388 "<B>Site logo</B><br />"
389 "A graphic describing this site"
391 (ib_logo ? "CHECKED" : "")
395 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
397 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
398 "SRC=\"/static/summary.gif\" ALT=\" \">"
400 "<B>Summary</B><br />"
403 (ib_summary ? "CHECKED" : "")
406 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
407 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
409 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
410 "SRC=\"/static/mail.gif\" ALT=\" \">"
412 "<B>Mail (inbox)</B><br />"
413 "A shortcut to your e-mail Inbox."
415 (ib_inbox ? "CHECKED" : "")
419 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
422 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
423 "SRC=\"/static/vcard.gif\" ALT=\" \">"
425 "<B>Contacts</B><br />"
426 "Your personal address book."
428 (ib_contacts ? "CHECKED" : "")
431 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
432 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
435 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
436 "SRC=\"/static/note.gif\" ALT=\" \">"
439 "Your personal notes."
441 (ib_notes ? "CHECKED" : "")
444 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
446 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
449 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
450 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
452 "<B>Calendar</B><br />"
453 "A shortcut to your personal calendar."
455 (ib_calendar ? "CHECKED" : "")
458 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
459 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
461 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
462 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
465 "A shortcut to your personal task list."
467 (ib_tasks ? "CHECKED" : "")
469 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
472 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
474 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
475 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
478 "Clicking this icon displays a list of all accesible "
479 "rooms (or folders) available."
481 (ib_rooms ? "CHECKED" : "")
484 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
485 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
487 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
488 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
490 "<B>Who is online?</B><br />"
491 "Clicking this icon displays a list of all users "
492 "currently logged in."
494 (ib_users ? "CHECKED" : "")
498 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
500 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
501 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
504 "Clicking this icon enters real-time chat mode "
505 "with other users in the same room."
507 (ib_chat ? "CHECKED" : "")
510 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
511 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
514 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
515 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
517 "<B>Advanced options</B><br />"
518 "Access to the complete menu of Citadel functions."
520 (ib_advanced ? "CHECKED" : "")
524 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
527 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
528 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
530 "<B>Log off</B><br />"
531 "Exit from the Citadel system. If you remove this icon "
532 "then you will have no way out!"
534 (ib_logoff ? "CHECKED" : "")
536 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
537 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
540 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
541 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
543 "<B>Citadel logo</B><br />"
544 "Displays the "Powered by Citadel" graphic"
546 (ib_citadel ? "CHECKED" : "")
549 wprintf("</TABLE><br />\n"
551 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
553 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
557 wprintf("</td></tr></table></center>\n");
562 void commit_iconbar(void) {
582 if (strcmp(bstr("sc"), "OK")) {
587 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
589 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
590 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
591 if (!strcasecmp(bstr(boxen[i]), "yes")) {
592 sprintf(&iconbar[strlen(iconbar)], "1");
595 sprintf(&iconbar[strlen(iconbar)], "0");
599 set_preference("iconbar", iconbar);
601 output_headers(1, 1, 0, 0, 0, 0, 0);
603 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
604 "<IMG SRC=\"/static/advanced-icon.gif\">"
606 "Your icon bar has been updated. Please select any of its "
607 "choices to continue."
608 "</td></tr></table>\n"