11 #include <sys/socket.h>
14 #include <netinet/in.h>
26 /* Values for ib_displayas */
31 void do_iconbar(void) {
34 char key[SIZ], value[SIZ];
37 /* The initialized values of these variables also happen to
38 * specify the default values for users who haven't customized
39 * their iconbars. These should probably be set in a master
40 * configuration somewhere.
42 int ib_displayas = 0; /* pictures and text, pictures, text */
43 int ib_logo = 0; /* Site logo */
44 int ib_summary = 0; /* Summary page icon */
45 int ib_inbox = 0; /* Inbox icon */
46 int ib_calendar = 0; /* Calendar icon */
47 int ib_contacts = 0; /* Contacts icon */
48 int ib_notes = 0; /* Notes icon */
49 int ib_tasks = 0; /* Tasks icon */
50 int ib_rooms = 1; /* Rooms icon */
51 int ib_users = 1; /* Users icon */
52 int ib_chat = 0; /* Chat icon */
53 int ib_advanced = 1; /* Advanced Options icon */
54 int ib_logoff = 1; /* Logoff button */
55 int ib_citadel = 1; /* 'Powered by Citadel' logo */
59 get_preference("iconbar", iconbar);
60 for (i=0; i<num_tokens(iconbar, ','); ++i) {
61 extract_token(buf, iconbar, i, ',');
62 extract_token(key, buf, 0, '=');
63 extract_token(value, buf, 1, '=');
65 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
66 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
67 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
68 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
69 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
70 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
71 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
72 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
73 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
74 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
75 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
76 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
77 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
78 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
81 wprintf("<div id=\"button\">\n"
87 if (ib_displayas != IB_TEXTONLY) {
88 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
89 "HEIGHT=\"32\" SRC=\"/image&name=hello\" ALT=\" \">\n"
96 wprintf("<li><A HREF=\"/summary\" "
97 "TITLE=\"Your summary page\" "
100 if (ib_displayas != IB_TEXTONLY) {
101 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
102 "SRC=\"/static/summary.gif\">");
104 if (ib_displayas != IB_PICONLY) {
107 wprintf("</A></li>\n");
112 "<A HREF=\"/dotgoto?room=_MAIL_\" "
113 "TITLE=\"Go to your e-mail inbox\" "
116 if (ib_displayas != IB_TEXTONLY) {
117 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
118 "SRC=\"/static/mail.gif\">");
120 if (ib_displayas != IB_PICONLY) {
123 wprintf("</A></li>\n");
128 "<A HREF=\"/dotgoto?room=Calendar\" "
129 "TITLE=\"Go to your personal calendar\" "
132 if (ib_displayas != IB_TEXTONLY) {
133 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
134 "SRC=\"/static/vcalendar.gif\">");
136 if (ib_displayas != IB_PICONLY) {
139 wprintf("</A></li>\n");
144 "<A HREF=\"/dotgoto?room=Contacts\" "
145 "TITLE=\"Go to your personal address book\" "
148 if (ib_displayas != IB_TEXTONLY) {
149 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
150 "SRC=\"/static/vcard.gif\">");
152 if (ib_displayas != IB_PICONLY) {
155 wprintf("</A></li>\n");
160 "<A HREF=\"/dotgoto?room=Notes\" "
161 "TITLE=\"Go to your personal notes\" "
164 if (ib_displayas != IB_TEXTONLY) {
165 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
166 "SRC=\"/static/note.gif\">");
168 if (ib_displayas != IB_PICONLY) {
171 wprintf("</A></li>\n");
176 "<A HREF=\"/dotgoto?room=Tasks\" "
177 "TITLE=\"Go to your personal task list\" "
180 if (ib_displayas != IB_TEXTONLY) {
181 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
182 "SRC=\"/static/vcalendar.gif\">");
184 if (ib_displayas != IB_PICONLY) {
187 wprintf("</A></li>\n");
192 "<A HREF=\"/knrooms\" TITLE=\"List all of your "
193 "accessible rooms\" >"
195 if (ib_displayas != IB_TEXTONLY) {
196 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
197 "SRC=\"/static/rooms-icon.gif\">");
199 if (ib_displayas != IB_PICONLY) {
202 wprintf("</A></li>\n");
207 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
210 if (ib_displayas != IB_TEXTONLY) {
211 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
212 "SRC=\"/static/users-icon.gif\">");
214 if (ib_displayas != IB_PICONLY) {
217 wprintf("</A></li>\n");
222 "<A HREF=\"#\" onClick=\"window.open('/chat', "
223 "'ctdl_chat_window', "
224 "'toolbar=no,location=no,directories=no,copyhistory=no,"
225 "status=no,scrollbars=yes,resizable=yes');\""
228 if (ib_displayas != IB_TEXTONLY) {
229 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
230 "SRC=\"/static/chat-icon.gif\">");
232 if (ib_displayas != IB_PICONLY) {
235 wprintf("</A></li>\n");
240 "<A HREF=\"/display_main_menu\" "
241 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
242 "Account Info, and Chat\" "
245 if (ib_displayas != IB_TEXTONLY) {
246 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
247 "SRC=\"/static/advanced-icon.gif\">");
249 if (ib_displayas != IB_PICONLY) {
252 wprintf("</A></li>\n");
257 "<A HREF=\"/termquit\" TITLE=\"Log off\" "
258 "onClick=\"return confirm('Log off now?');\">"
260 if (ib_displayas != IB_TEXTONLY) {
261 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
262 "SRC=\"/static/exit-icon.gif\">");
264 if (ib_displayas != IB_PICONLY) {
267 wprintf("</A></li>\n");
271 "<li><div align=\"center\">"
272 "<A HREF=\"/display_customize_iconbar\" "
273 "TITLE=\"Customize this menu\" "
274 ">customize this menu</A>"
278 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
279 "<li><div align=\"center\">"
280 "<A HREF=\"http://www.citadel.org\" "
281 "title=\"Find out more about Citadel\" target=\"aboutcit\" "
282 "onMouseOver=\"window.status='Find out more about "
283 "Citadel'; return true;\">powered by<br /><IMG "
284 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
285 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\">"
296 void display_customize_iconbar(void) {
299 char key[SIZ], value[SIZ];
302 /* The initialized values of these variables also happen to
303 * specify the default values for users who haven't customized
304 * their iconbars. These should probably be set in a master
305 * configuration somewhere.
307 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
308 int ib_logo = 0; /* Site logo */
309 int ib_summary = 0; /* Summary page icon */
310 int ib_inbox = 0; /* Inbox icon */
311 int ib_calendar = 0; /* Calendar icon */
312 int ib_contacts = 0; /* Contacts icon */
313 int ib_notes = 0; /* Notes icon */
314 int ib_tasks = 0; /* Tasks icon */
315 int ib_rooms = 1; /* Rooms icon */
316 int ib_users = 1; /* Users icon */
317 int ib_chat = 0; /* Chat icon */
318 int ib_advanced = 1; /* Advanced Options icon */
319 int ib_logoff = 1; /* Logoff button */
320 int ib_citadel = 1; /* 'Powered by Citadel' logo */
324 get_preference("iconbar", iconbar);
325 for (i=0; i<num_tokens(iconbar, ','); ++i) {
326 extract_token(buf, iconbar, i, ',');
327 extract_token(key, buf, 0, '=');
328 extract_token(value, buf, 1, '=');
330 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
331 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
332 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
333 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
334 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
335 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
336 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
337 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
338 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
339 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
340 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
341 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
342 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
343 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
346 output_headers(1, 1, 0, 0, 0, 0, 0);
347 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
348 do_template("beginbox");
350 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
353 "Display icons as: ");
354 for (i=0; i<=2; ++i) {
355 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
356 if (ib_displayas == i) wprintf(" CHECKED");
358 if (i == IB_PICTEXT) wprintf("pictures and text");
359 if (i == IB_PICONLY) wprintf("pictures only");
360 if (i == IB_TEXTONLY) wprintf("text only");
363 wprintf("<br /><br />\n");
365 wprintf("Select the icons you would like to see displayed "
366 "in the "icon bar" menu on the left side of the "
367 "screen.</CENTER><br />\n"
370 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
372 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
373 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
375 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
376 "SRC=\"/image&name=hello\" ALT=\" \">"
378 "<B>Site logo</B><br />"
379 "A graphic describing this site"
381 (ib_logo ? "CHECKED" : "")
385 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
387 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
388 "SRC=\"/static/summary.gif\" ALT=\" \">"
390 "<B>Summary</B><br />"
393 (ib_summary ? "CHECKED" : "")
396 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
397 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
399 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
400 "SRC=\"/static/mail.gif\" ALT=\" \">"
402 "<B>Mail (inbox)</B><br />"
403 "A shortcut to your e-mail Inbox."
405 (ib_inbox ? "CHECKED" : "")
409 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
412 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
413 "SRC=\"/static/vcard.gif\" ALT=\" \">"
415 "<B>Contacts</B><br />"
416 "Your personal address book."
418 (ib_contacts ? "CHECKED" : "")
421 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
422 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
425 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
426 "SRC=\"/static/note.gif\" ALT=\" \">"
429 "Your personal notes."
431 (ib_notes ? "CHECKED" : "")
434 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
436 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
439 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
440 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
442 "<B>Calendar</B><br />"
443 "A shortcut to your personal calendar."
445 (ib_calendar ? "CHECKED" : "")
448 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
449 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
451 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
452 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
455 "A shortcut to your personal task list."
457 (ib_tasks ? "CHECKED" : "")
459 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
462 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
464 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
465 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
468 "Clicking this icon displays a list of all accesible "
469 "rooms (or folders) available."
471 (ib_rooms ? "CHECKED" : "")
474 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
475 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
477 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
478 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
481 "Clicking this icon displays a list of all users "
482 "currently logged in."
484 (ib_users ? "CHECKED" : "")
488 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
490 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
491 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
494 "Clicking this icon enters real-time chat mode "
495 "with other users in the same room."
497 (ib_chat ? "CHECKED" : "")
500 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
501 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
504 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
505 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
507 "<B>Advanced options</B><br />"
508 "Access to the complete menu of Citadel functions."
510 (ib_advanced ? "CHECKED" : "")
514 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
517 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
518 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
520 "<B>Log off</B><br />"
521 "Exit from the Citadel system. If you remove this icon "
522 "then you will have no way out!"
524 (ib_logoff ? "CHECKED" : "")
526 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
527 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
530 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
531 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
533 "<B>Citadel logo</B><br />"
534 "Displays the "Powered by Citadel" graphic"
536 (ib_citadel ? "CHECKED" : "")
539 wprintf("</TABLE><br />\n"
541 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
543 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
547 do_template("endbox");
552 void commit_iconbar(void) {
572 if (strcmp(bstr("sc"), "OK")) {
577 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
579 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
580 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
581 if (!strcasecmp(bstr(boxen[i]), "yes")) {
582 sprintf(&iconbar[strlen(iconbar)], "1");
585 sprintf(&iconbar[strlen(iconbar)], "0");
589 set_preference("iconbar", iconbar);
591 output_headers(1, 1, 0, 0, 0, 0, 0);
592 do_template("beginbox_nt");
594 "<IMG SRC=\"/static/advanced-icon.gif\">"
596 "Your icon bar has been updated. Please select any of its "
597 "choices to continue.\n"
599 do_template("endbox");