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 do_template("beginbox_nt");
83 wprintf("<center>\n");
85 if (ib_logo) if (ib_displayas != IB_TEXTONLY) wprintf(
86 "<IMG BORDER=\"0\" WIDTH=\"48\" "
87 "HEIGHT=\"48\" SRC=\"/image&name=hello\" ALT=\" \">"
92 wprintf("<SPAN CLASS=\"iconbar_link\">"
93 "<A HREF=\"/summary\" "
94 "TITLE=\"Your summary page\" "
97 if (ib_displayas != IB_TEXTONLY) {
98 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
99 "SRC=\"/static/summary.gif\"><br />");
101 if (ib_displayas != IB_PICONLY) {
102 wprintf("Summary<br />");
104 wprintf("</A></P></SPAN>\n");
108 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
109 "<A HREF=\"/dotgoto?room=_MAIL_\" "
110 "TITLE=\"Go to your e-mail inbox\" "
113 if (ib_displayas != IB_TEXTONLY) {
114 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
115 "SRC=\"/static/mail.gif\"><br />");
117 if (ib_displayas != IB_PICONLY) {
118 wprintf("Mail<br />");
120 wprintf("</A></P></SPAN>\n");
124 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
125 "<A HREF=\"/dotgoto?room=Calendar\" "
126 "TITLE=\"Go to your personal calendar\" "
129 if (ib_displayas != IB_TEXTONLY) {
130 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
131 "SRC=\"/static/vcalendar.gif\"><br />");
133 if (ib_displayas != IB_PICONLY) {
134 wprintf("Calendar<br />");
136 wprintf("</A></P></SPAN>\n");
140 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
141 "<A HREF=\"/dotgoto?room=Contacts\" "
142 "TITLE=\"Go to your personal address book\" "
145 if (ib_displayas != IB_TEXTONLY) {
146 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
147 "SRC=\"/static/vcard.gif\"><br />");
149 if (ib_displayas != IB_PICONLY) {
150 wprintf("Contacts<br />");
152 wprintf("</A></P></SPAN>\n");
156 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
157 "<A HREF=\"/dotgoto?room=Notes\" "
158 "TITLE=\"Go to your personal notes\" "
161 if (ib_displayas != IB_TEXTONLY) {
162 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
163 "SRC=\"/static/note.gif\"><br />");
165 if (ib_displayas != IB_PICONLY) {
166 wprintf("Notes<br />");
168 wprintf("</A></P></SPAN>\n");
172 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
173 "<A HREF=\"/dotgoto?room=Tasks\" "
174 "TITLE=\"Go to your personal task list\" "
177 if (ib_displayas != IB_TEXTONLY) {
178 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
179 "SRC=\"/static/vcalendar.gif\"><br />");
181 if (ib_displayas != IB_PICONLY) {
182 wprintf("Tasks<br />");
184 wprintf("</A></P></SPAN>\n");
188 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
189 "<A HREF=\"/knrooms\" TITLE=\"List all of your "
190 "accessible rooms\" >"
192 if (ib_displayas != IB_TEXTONLY) {
193 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
194 "SRC=\"/static/rooms-icon.gif\"><br />");
196 if (ib_displayas != IB_PICONLY) {
197 wprintf("Rooms<br />");
199 wprintf("</A></P></SPAN>\n");
203 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
204 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
207 if (ib_displayas != IB_TEXTONLY) {
208 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
209 "SRC=\"/static/users-icon.gif\"><br />");
211 if (ib_displayas != IB_PICONLY) {
212 wprintf("Users<br />");
214 wprintf("</A></P></SPAN>\n");
218 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
219 "<A HREF=\"#\" onClick=\"window.open('/chat', "
220 "'ctdl_chat_window', "
221 "'toolbar=no,location=no,directories=no,copyhistory=no,"
222 "status=no,scrollbars=yes,resizable=yes');\""
225 if (ib_displayas != IB_TEXTONLY) {
226 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
227 "SRC=\"/static/chat-icon.gif\"><br />");
229 if (ib_displayas != IB_PICONLY) {
230 wprintf("Chat<br />");
232 wprintf("</A></P></SPAN>\n");
236 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
237 "<A HREF=\"/display_main_menu\" "
238 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
239 "Account Info, and Chat\" "
242 if (ib_displayas != IB_TEXTONLY) {
243 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
244 "SRC=\"/static/advanced-icon.gif\"><br />");
246 if (ib_displayas != IB_PICONLY) {
247 wprintf("Advanced options<br />");
249 wprintf("</A></P></SPAN>\n");
253 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
254 "<A HREF=\"/termquit\" TITLE=\"Log off\" "
255 "onClick=\"return confirm('Log off now?');\">"
257 if (ib_displayas != IB_TEXTONLY) {
258 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
259 "SRC=\"/static/exit-icon.gif\"><br />");
261 if (ib_displayas != IB_PICONLY) {
262 wprintf("Log off<br />");
264 wprintf("</A></P></SPAN>\n");
268 "<SPAN CLASS=\"customize\"><P>"
269 "<A HREF=\"/display_customize_iconbar\" "
270 "TITLE=\"Customize this menu\" "
271 ">customize this menu</A>"
275 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
276 "<SPAN CLASS=\"powered_by\"><P>"
277 "<A HREF=\"http://www.citadel.org\" "
278 "title=\"Find out more about Citadel\" target=\"aboutcit\" "
279 "onMouseOver=\"window.status='Find out more about "
280 "Citadel'; return true;\">powered by<br /><IMG "
281 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
282 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\">"
287 wprintf("</CENTER>\n");
288 do_template("endbox");
293 void display_customize_iconbar(void) {
296 char key[SIZ], value[SIZ];
299 /* The initialized values of these variables also happen to
300 * specify the default values for users who haven't customized
301 * their iconbars. These should probably be set in a master
302 * configuration somewhere.
304 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
305 int ib_logo = 0; /* Site logo */
306 int ib_summary = 0; /* Summary page icon */
307 int ib_inbox = 0; /* Inbox icon */
308 int ib_calendar = 0; /* Calendar icon */
309 int ib_contacts = 0; /* Contacts icon */
310 int ib_notes = 0; /* Notes icon */
311 int ib_tasks = 0; /* Tasks icon */
312 int ib_rooms = 1; /* Rooms icon */
313 int ib_users = 1; /* Users icon */
314 int ib_chat = 0; /* Chat icon */
315 int ib_advanced = 1; /* Advanced Options icon */
316 int ib_logoff = 1; /* Logoff button */
317 int ib_citadel = 1; /* 'Powered by Citadel' logo */
321 get_preference("iconbar", iconbar);
322 for (i=0; i<num_tokens(iconbar, ','); ++i) {
323 extract_token(buf, iconbar, i, ',');
324 extract_token(key, buf, 0, '=');
325 extract_token(value, buf, 1, '=');
327 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
328 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
329 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
330 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
331 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
332 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
333 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
334 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
335 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
336 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
337 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
338 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
339 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
340 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
343 output_headers(1, 1, 0, 0, 0, 0, 0);
344 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
345 do_template("beginbox");
347 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
350 "Display icons as: ");
351 for (i=0; i<=2; ++i) {
352 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
353 if (ib_displayas == i) wprintf(" CHECKED");
355 if (i == IB_PICTEXT) wprintf("pictures and text");
356 if (i == IB_PICONLY) wprintf("pictures only");
357 if (i == IB_TEXTONLY) wprintf("text only");
360 wprintf("<br /><br />\n");
362 wprintf("Select the icons you would like to see displayed "
363 "in the "icon bar" menu on the left side of the "
364 "screen.</CENTER><br />\n"
367 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
369 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
370 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
372 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
373 "SRC=\"/image&name=hello\" ALT=\" \">"
375 "<B>Site logo</B><br />"
376 "A graphic describing this site"
378 (ib_logo ? "CHECKED" : "")
382 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
384 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
385 "SRC=\"/static/summary.gif\" ALT=\" \">"
387 "<B>Summary</B><br />"
390 (ib_summary ? "CHECKED" : "")
393 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
394 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
396 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
397 "SRC=\"/static/mail.gif\" ALT=\" \">"
399 "<B>Mail (inbox)</B><br />"
400 "A shortcut to your e-mail Inbox."
402 (ib_inbox ? "CHECKED" : "")
406 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
409 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
410 "SRC=\"/static/vcard.gif\" ALT=\" \">"
412 "<B>Contacts</B><br />"
413 "Your personal address book."
415 (ib_contacts ? "CHECKED" : "")
418 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
419 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
422 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
423 "SRC=\"/static/note.gif\" ALT=\" \">"
426 "Your personal notes."
428 (ib_notes ? "CHECKED" : "")
431 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
433 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
436 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
437 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
439 "<B>Calendar</B><br />"
440 "A shortcut to your personal calendar."
442 (ib_calendar ? "CHECKED" : "")
445 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
446 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
448 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
449 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
452 "A shortcut to your personal task list."
454 (ib_tasks ? "CHECKED" : "")
456 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
459 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
461 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
462 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
465 "Clicking this icon displays a list of all accesible "
466 "rooms (or folders) available."
468 (ib_rooms ? "CHECKED" : "")
471 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
472 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
474 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
475 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
478 "Clicking this icon displays a list of all users "
479 "currently logged in."
481 (ib_users ? "CHECKED" : "")
485 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
487 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
488 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
491 "Clicking this icon enters real-time chat mode "
492 "with other users in the same room."
494 (ib_chat ? "CHECKED" : "")
497 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
498 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
501 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
502 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
504 "<B>Advanced options</B><br />"
505 "Access to the complete menu of Citadel functions."
507 (ib_advanced ? "CHECKED" : "")
511 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
514 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
515 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
517 "<B>Log off</B><br />"
518 "Exit from the Citadel system. If you remove this icon "
519 "then you will have no way out!"
521 (ib_logoff ? "CHECKED" : "")
523 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
524 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
527 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
528 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
530 "<B>Citadel logo</B><br />"
531 "Displays the "Powered by Citadel" graphic"
533 (ib_citadel ? "CHECKED" : "")
536 wprintf("</TABLE><br />\n"
538 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
540 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
544 do_template("endbox");
549 void commit_iconbar(void) {
569 if (strcmp(bstr("sc"), "OK")) {
574 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
576 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
577 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
578 if (!strcasecmp(bstr(boxen[i]), "yes")) {
579 sprintf(&iconbar[strlen(iconbar)], "1");
582 sprintf(&iconbar[strlen(iconbar)], "0");
586 set_preference("iconbar", iconbar);
588 output_headers(1, 1, 0, 0, 0, 0, 0);
589 do_template("beginbox_nt");
591 "<IMG SRC=\"/static/advanced-icon.gif\">"
593 "Your icon bar has been updated. Please select any of its "
594 "choices to continue.\n"
596 do_template("endbox");