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 = 0; /* Summary page icon */
49 int ib_inbox = 0; /* Inbox icon */
50 int ib_calendar = 0; /* Calendar icon */
51 int ib_contacts = 0; /* Contacts icon */
52 int ib_notes = 0; /* Notes icon */
53 int ib_tasks = 0; /* Tasks icon */
54 int ib_rooms = 1; /* Rooms icon */
55 int ib_users = 1; /* Users icon */
56 int ib_chat = 0; /* 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) {
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 = 0; /* Summary page icon */
314 int ib_inbox = 0; /* Inbox icon */
315 int ib_calendar = 0; /* Calendar icon */
316 int ib_contacts = 0; /* Contacts icon */
317 int ib_notes = 0; /* Notes icon */
318 int ib_tasks = 0; /* Tasks icon */
319 int ib_rooms = 1; /* Rooms icon */
320 int ib_users = 1; /* Users icon */
321 int ib_chat = 0; /* 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, 0, 0, 0, 0, 0);
351 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
352 do_template("beginbox");
354 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
357 "Display icons as: ");
358 for (i=0; i<=2; ++i) {
359 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
360 if (ib_displayas == i) wprintf(" CHECKED");
362 if (i == IB_PICTEXT) wprintf("pictures and text");
363 if (i == IB_PICONLY) wprintf("pictures only");
364 if (i == IB_TEXTONLY) wprintf("text only");
367 wprintf("<br /><br />\n");
369 wprintf("Select the icons you would like to see displayed "
370 "in the "icon bar" menu on the left side of the "
371 "screen.</CENTER><br />\n"
374 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
376 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
377 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
379 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
380 "SRC=\"/image&name=hello\" ALT=\" \">"
382 "<B>Site logo</B><br />"
383 "A graphic describing this site"
385 (ib_logo ? "CHECKED" : "")
389 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
391 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
392 "SRC=\"/static/summary.gif\" ALT=\" \">"
394 "<B>Summary</B><br />"
397 (ib_summary ? "CHECKED" : "")
400 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
401 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
403 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
404 "SRC=\"/static/mail.gif\" ALT=\" \">"
406 "<B>Mail (inbox)</B><br />"
407 "A shortcut to your e-mail Inbox."
409 (ib_inbox ? "CHECKED" : "")
413 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
416 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
417 "SRC=\"/static/vcard.gif\" ALT=\" \">"
419 "<B>Contacts</B><br />"
420 "Your personal address book."
422 (ib_contacts ? "CHECKED" : "")
425 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
426 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
429 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
430 "SRC=\"/static/note.gif\" ALT=\" \">"
433 "Your personal notes."
435 (ib_notes ? "CHECKED" : "")
438 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
440 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
443 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
444 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
446 "<B>Calendar</B><br />"
447 "A shortcut to your personal calendar."
449 (ib_calendar ? "CHECKED" : "")
452 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
453 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
455 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
456 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
459 "A shortcut to your personal task list."
461 (ib_tasks ? "CHECKED" : "")
463 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
466 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
468 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
469 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
472 "Clicking this icon displays a list of all accesible "
473 "rooms (or folders) available."
475 (ib_rooms ? "CHECKED" : "")
478 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
479 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
481 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
482 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
485 "Clicking this icon displays a list of all users "
486 "currently logged in."
488 (ib_users ? "CHECKED" : "")
492 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
494 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
495 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
498 "Clicking this icon enters real-time chat mode "
499 "with other users in the same room."
501 (ib_chat ? "CHECKED" : "")
504 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
505 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
508 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
509 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
511 "<B>Advanced options</B><br />"
512 "Access to the complete menu of Citadel functions."
514 (ib_advanced ? "CHECKED" : "")
518 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
521 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
522 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
524 "<B>Log off</B><br />"
525 "Exit from the Citadel system. If you remove this icon "
526 "then you will have no way out!"
528 (ib_logoff ? "CHECKED" : "")
530 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
531 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
534 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
535 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
537 "<B>Citadel logo</B><br />"
538 "Displays the "Powered by Citadel" graphic"
540 (ib_citadel ? "CHECKED" : "")
543 wprintf("</TABLE><br />\n"
545 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
547 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
551 do_template("endbox");
556 void commit_iconbar(void) {
576 if (strcmp(bstr("sc"), "OK")) {
581 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
583 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
584 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
585 if (!strcasecmp(bstr(boxen[i]), "yes")) {
586 sprintf(&iconbar[strlen(iconbar)], "1");
589 sprintf(&iconbar[strlen(iconbar)], "0");
593 set_preference("iconbar", iconbar);
595 output_headers(1, 1, 0, 0, 0, 0, 0);
596 do_template("beginbox_nt");
598 "<IMG SRC=\"/static/advanced-icon.gif\">"
600 "Your icon bar has been updated. Please select any of its "
601 "choices to continue.\n"
603 do_template("endbox");