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 = 1; /* 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_tasks = 0; /* Tasks icon */
49 int ib_rooms = 1; /* Rooms icon */
50 int ib_users = 1; /* Users icon */
51 int ib_chat = 0; /* Chat icon */
52 int ib_advanced = 1; /* Advanced Options icon */
53 int ib_logoff = 1; /* Logoff button */
54 int ib_citadel = 1; /* 'Powered by Citadel' logo */
58 get_preference("iconbar", iconbar);
59 for (i=0; i<num_tokens(iconbar, ','); ++i) {
60 extract_token(buf, iconbar, i, ',');
61 extract_token(key, buf, 0, '=');
62 extract_token(value, buf, 1, '=');
64 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
65 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
66 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
67 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
68 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
69 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
70 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
71 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
72 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
73 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
74 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
75 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
76 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
80 do_template("beginbox_nt");
82 wprintf("<center>\n");
84 if (ib_logo) if (ib_displayas != IB_TEXTONLY) wprintf(
85 "<IMG BORDER=\"0\" WIDTH=\"48\" "
86 "HEIGHT=\"48\" SRC=\"/image&name=hello\" ALT=\" \">"
91 wprintf("<SPAN CLASS=\"iconbar_link\">"
92 "<A HREF=\"/summary\" "
93 "TITLE=\"Your summary page\" "
94 "TARGET=\"workspace\">"
96 if (ib_displayas != IB_TEXTONLY) {
97 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
98 "SRC=\"/static/summary.gif\"><BR>");
100 if (ib_displayas != IB_PICONLY) {
101 wprintf("Summary<BR>");
103 wprintf("</A></SPAN>\n");
107 wprintf("<SPAN CLASS=\"iconbar_link\">"
108 "<A HREF=\"/dotgoto?room=_MAIL_\" "
109 "TITLE=\"Go to your e-mail inbox\" "
110 "TARGET=\"workspace\">"
112 if (ib_displayas != IB_TEXTONLY) {
113 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
114 "SRC=\"/static/mail.gif\"><BR>");
116 if (ib_displayas != IB_PICONLY) {
119 wprintf("</A></SPAN>\n");
123 wprintf("<SPAN CLASS=\"iconbar_link\">"
124 "<A HREF=\"/dotgoto?room=Calendar\" "
125 "TITLE=\"Go to your personal calendar\" "
126 "TARGET=\"workspace\">"
128 if (ib_displayas != IB_TEXTONLY) {
129 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
130 "SRC=\"/static/vcalendar.gif\"><BR>");
132 if (ib_displayas != IB_PICONLY) {
133 wprintf("Calendar<BR>");
135 wprintf("</A></SPAN>\n");
139 wprintf("<SPAN CLASS=\"iconbar_link\">"
140 "<A HREF=\"/dotgoto?room=Contacts\" "
141 "TITLE=\"Go to your personal address book\" "
142 "TARGET=\"workspace\">"
144 if (ib_displayas != IB_TEXTONLY) {
145 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
146 "SRC=\"/static/vcard.gif\"><BR>");
148 if (ib_displayas != IB_PICONLY) {
149 wprintf("Contacts<BR>");
151 wprintf("</A></SPAN>\n");
155 wprintf("<SPAN CLASS=\"iconbar_link\">"
156 "<A HREF=\"/dotgoto?room=Tasks\" "
157 "TITLE=\"Go to your personal task list\" "
158 "TARGET=\"workspace\">"
160 if (ib_displayas != IB_TEXTONLY) {
161 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
162 "SRC=\"/static/vcalendar.gif\"><BR>");
164 if (ib_displayas != IB_PICONLY) {
165 wprintf("Tasks<BR>");
167 wprintf("</A></SPAN>\n");
171 wprintf("<SPAN CLASS=\"iconbar_link\">"
172 "<A HREF=\"/knrooms\" TITLE=\"Shows a list of all "
173 "Rooms that you have access to\" TARGET=\"workspace\">"
175 if (ib_displayas != IB_TEXTONLY) {
176 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
177 "SRC=\"/static/rooms-icon.gif\"><BR>");
179 if (ib_displayas != IB_PICONLY) {
180 wprintf("Rooms<BR>");
182 wprintf("</A></SPAN>\n");
186 wprintf("<SPAN CLASS=\"iconbar_link\">"
187 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
188 "TARGET=\"workspace\">"
190 if (ib_displayas != IB_TEXTONLY) {
191 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
192 "SRC=\"/static/users-icon.gif\"><BR>");
194 if (ib_displayas != IB_PICONLY) {
195 wprintf("Users<BR>");
197 wprintf("</A></SPAN>\n");
201 wprintf("<SPAN CLASS=\"iconbar_link\">"
202 "<A HREF=\"#\" onClick=\"window.open('/chat', "
203 "'ctdl_chat_window', "
204 "'toolbar=no,location=no,directories=no,copyhistory=no,"
205 "status=yes,scrollbars=yes,resizable=yes');\""
208 if (ib_displayas != IB_TEXTONLY) {
209 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
210 "SRC=\"/static/chat-icon.gif\"><BR>");
212 if (ib_displayas != IB_PICONLY) {
215 wprintf("</A></SPAN>\n");
219 wprintf("<SPAN CLASS=\"iconbar_link\">"
220 "<A HREF=\"/display_main_menu\" "
221 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
222 "Account Info, and Chat\" "
223 "TARGET=\"workspace\">"
225 if (ib_displayas != IB_TEXTONLY) {
226 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
227 "SRC=\"/static/advanced-icon.gif\"><BR>");
229 if (ib_displayas != IB_PICONLY) {
230 wprintf("Advanced options<BR>");
232 wprintf("</A></SPAN>\n");
236 wprintf("<SPAN CLASS=\"iconbar_link\">"
237 "<A HREF=\"/termquit\" TITLE=\"Log off\" TARGET=\"_top\" "
238 "onClick=\"return confirm('Log off now?');\">"
240 if (ib_displayas != IB_TEXTONLY) {
241 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
242 "SRC=\"/static/exit-icon.gif\"><BR>");
244 if (ib_displayas != IB_PICONLY) {
245 wprintf("Log off<BR>");
247 wprintf("</A></SPAN>\n");
251 "<SPAN CLASS=\"customize\">"
252 "<A HREF=\"/display_customize_iconbar\" "
253 "TITLE=\"Customize this menu\" "
254 "TARGET=\"workspace\">customize this menu</A>"
258 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
259 "<SPAN CLASS=\"powered_by\">"
260 "<A HREF=\"http://uncensored.citadel.org/citadel\" "
261 "TITLE=\"Find out more about Citadel/UX\" TARGET=\"aboutcit\" "
262 "onMouseOver=\"window.status='Find out more about "
263 "Citadel/UX'; return true;\">powered by<BR><IMG "
264 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
265 "SRC=\"/static/citadel-logo.jpg\" ALT=\"CITADEL/UX\"></A>"
269 wprintf("</CENTER>\n");
270 do_template("endbox");
276 void display_customize_iconbar(void) {
279 char key[SIZ], value[SIZ];
282 /* The initialized values of these variables also happen to
283 * specify the default values for users who haven't customized
284 * their iconbars. These should probably be set in a master
285 * configuration somewhere.
287 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
288 int ib_logo = 1; /* Site logo */
289 int ib_summary = 0; /* Summary page icon */
290 int ib_inbox = 0; /* Inbox icon */
291 int ib_calendar = 0; /* Calendar icon */
292 int ib_contacts = 0; /* Contacts icon */
293 int ib_tasks = 0; /* Tasks icon */
294 int ib_rooms = 1; /* Rooms icon */
295 int ib_users = 1; /* Users icon */
296 int ib_chat = 0; /* Chat icon */
297 int ib_advanced = 1; /* Advanced Options icon */
298 int ib_logoff = 1; /* Logoff button */
299 int ib_citadel = 1; /* 'Powered by Citadel' logo */
303 get_preference("iconbar", iconbar);
304 for (i=0; i<num_tokens(iconbar, ','); ++i) {
305 extract_token(buf, iconbar, i, ',');
306 extract_token(key, buf, 0, '=');
307 extract_token(value, buf, 1, '=');
309 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
310 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
311 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
312 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
313 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
314 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
315 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
316 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
317 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
318 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
319 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
320 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
321 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
325 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
326 do_template("beginbox");
328 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
331 "Display icons as: ");
332 for (i=0; i<=2; ++i) {
333 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
334 if (ib_displayas == i) wprintf(" CHECKED");
336 if (i == IB_PICTEXT) wprintf("pictures and text");
337 if (i == IB_PICONLY) wprintf("pictures only");
338 if (i == IB_TEXTONLY) wprintf("text only");
341 wprintf("<BR><BR>\n");
343 wprintf("Select the icons you would like to see displayed "
344 "in the "icon bar" menu on the left side of the "
345 "screen.</CENTER><BR>\n"
348 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
350 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
351 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
353 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
354 "SRC=\"/image&name=hello\" ALT=\" \">"
356 "<B>Site logo</B><BR>"
357 "A graphic describing this site"
359 (ib_logo ? "CHECKED" : "")
363 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
365 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
366 "SRC=\"/static/summary.gif\" ALT=\" \">"
371 (ib_summary ? "CHECKED" : "")
374 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
375 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
377 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
378 "SRC=\"/static/mail.gif\" ALT=\" \">"
380 "<B>Mail (inbox)</B><BR>"
381 "A shortcut to your e-mail Inbox."
383 (ib_inbox ? "CHECKED" : "")
387 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
390 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
391 "SRC=\"/static/vcard.gif\" ALT=\" \">"
393 "<B>Contacts</B><BR>"
394 "Your personal address book."
396 (ib_contacts ? "CHECKED" : "")
399 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
400 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
401 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
404 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
405 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
407 "<B>Calendar</B><BR>"
408 "A shortcut to your personal calendar."
410 (ib_calendar ? "CHECKED" : "")
414 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
416 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
417 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
420 "A shortcut to your personal task list."
422 (ib_tasks ? "CHECKED" : "")
424 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
426 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
427 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
429 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
430 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
433 "Clicking this icon displays a list of all accesible "
434 "rooms (or folders) available."
436 (ib_rooms ? "CHECKED" : "")
440 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
442 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
443 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
446 "Clicking this icon displays a list of all users "
447 "currently logged in."
449 (ib_users ? "CHECKED" : "")
452 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
453 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
455 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
456 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
459 "Clicking this icon enters real-time chat mode "
460 "with other users in the same room."
462 (ib_chat ? "CHECKED" : "")
466 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
469 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
470 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
472 "<B>Advanced options</B><BR>"
473 "Access to the complete menu of Citadel functions."
475 (ib_advanced ? "CHECKED" : "")
478 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
479 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
482 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
483 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
486 "Exit from the Citadel system. If you remove this icon "
487 "then you will have no way out!"
489 (ib_logoff ? "CHECKED" : "")
492 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
495 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
496 "SRC=\"/static/citadel-logo.jpg\" ALT=\" \">"
498 "<B>Citadel logo</B><BR>"
499 "Displays the "Powered by Citadel" graphic"
501 (ib_citadel ? "CHECKED" : "")
504 wprintf("</TABLE><BR>\n"
506 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
508 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
512 do_template("endbox");
517 void commit_iconbar(void) {
536 if (strcmp(bstr("sc"), "OK")) {
541 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
543 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
544 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
545 if (!strcasecmp(bstr(boxen[i]), "yes")) {
546 sprintf(&iconbar[strlen(iconbar)], "1");
549 sprintf(&iconbar[strlen(iconbar)], "0");
553 set_preference("iconbar", iconbar);
556 do_template("beginbox_nt");
558 "<IMG SRC=\"/static/advanced-icon.gif\" "
559 "onLoad=\"javascript:top['iconbarframe'].location.reload();\">"
561 "Your icon bar has been updated. Please select any of its "
562 "choices to continue.\n"
564 do_template("endbox");