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);
82 do_template("beginbox_nt");
84 wprintf("<center>\n");
86 if (ib_logo) if (ib_displayas != IB_TEXTONLY) wprintf(
87 "<IMG BORDER=\"0\" WIDTH=\"48\" "
88 "HEIGHT=\"48\" SRC=\"/image&name=hello\" ALT=\" \">"
93 wprintf("<SPAN CLASS=\"iconbar_link\">"
94 "<A HREF=\"/summary\" "
95 "TITLE=\"Your summary page\" "
96 "TARGET=\"workspace\"><P>"
98 if (ib_displayas != IB_TEXTONLY) {
99 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
100 "SRC=\"/static/summary.gif\"><BR>");
102 if (ib_displayas != IB_PICONLY) {
103 wprintf("Summary<BR>");
105 wprintf("</A></P></SPAN>\n");
109 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
110 "<A HREF=\"/dotgoto?room=_MAIL_\" "
111 "TITLE=\"Go to your e-mail inbox\" "
112 "TARGET=\"workspace\">"
114 if (ib_displayas != IB_TEXTONLY) {
115 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
116 "SRC=\"/static/mail.gif\"><BR>");
118 if (ib_displayas != IB_PICONLY) {
121 wprintf("</A></P></SPAN>\n");
125 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
126 "<A HREF=\"/dotgoto?room=Calendar\" "
127 "TITLE=\"Go to your personal calendar\" "
128 "TARGET=\"workspace\">"
130 if (ib_displayas != IB_TEXTONLY) {
131 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
132 "SRC=\"/static/vcalendar.gif\"><BR>");
134 if (ib_displayas != IB_PICONLY) {
135 wprintf("Calendar<BR>");
137 wprintf("</A></P></SPAN>\n");
141 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
142 "<A HREF=\"/dotgoto?room=Contacts\" "
143 "TITLE=\"Go to your personal address book\" "
144 "TARGET=\"workspace\">"
146 if (ib_displayas != IB_TEXTONLY) {
147 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
148 "SRC=\"/static/vcard.gif\"><BR>");
150 if (ib_displayas != IB_PICONLY) {
151 wprintf("Contacts<BR>");
153 wprintf("</A></P></SPAN>\n");
157 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
158 "<A HREF=\"/dotgoto?room=Notes\" "
159 "TITLE=\"Go to your personal notes\" "
160 "TARGET=\"workspace\">"
162 if (ib_displayas != IB_TEXTONLY) {
163 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
164 "SRC=\"/static/note.gif\"><BR>");
166 if (ib_displayas != IB_PICONLY) {
167 wprintf("Notes<BR>");
169 wprintf("</A></P></SPAN>\n");
173 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
174 "<A HREF=\"/dotgoto?room=Tasks\" "
175 "TITLE=\"Go to your personal task list\" "
176 "TARGET=\"workspace\">"
178 if (ib_displayas != IB_TEXTONLY) {
179 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
180 "SRC=\"/static/vcalendar.gif\"><BR>");
182 if (ib_displayas != IB_PICONLY) {
183 wprintf("Tasks<BR>");
185 wprintf("</A></P></SPAN>\n");
189 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
190 "<A HREF=\"/knrooms\" TITLE=\"Shows a list of all "
191 "Rooms that you have access to\" TARGET=\"workspace\">"
193 if (ib_displayas != IB_TEXTONLY) {
194 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
195 "SRC=\"/static/rooms-icon.gif\"><BR>");
197 if (ib_displayas != IB_PICONLY) {
198 wprintf("Rooms<BR>");
200 wprintf("</A></P></SPAN>\n");
204 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
205 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
206 "TARGET=\"workspace\">"
208 if (ib_displayas != IB_TEXTONLY) {
209 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
210 "SRC=\"/static/users-icon.gif\"><BR>");
212 if (ib_displayas != IB_PICONLY) {
213 wprintf("Users<BR>");
215 wprintf("</A></P></SPAN>\n");
219 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
220 "<A HREF=\"#\" onClick=\"window.open('/chat', "
221 "'ctdl_chat_window', "
222 "'toolbar=no,location=no,directories=no,copyhistory=no,"
223 "status=no,scrollbars=yes,resizable=yes');\""
226 if (ib_displayas != IB_TEXTONLY) {
227 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
228 "SRC=\"/static/chat-icon.gif\"><BR>");
230 if (ib_displayas != IB_PICONLY) {
233 wprintf("</A></P></SPAN>\n");
237 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
238 "<A HREF=\"/display_main_menu\" "
239 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
240 "Account Info, and Chat\" "
241 "TARGET=\"workspace\">"
243 if (ib_displayas != IB_TEXTONLY) {
244 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
245 "SRC=\"/static/advanced-icon.gif\"><BR>");
247 if (ib_displayas != IB_PICONLY) {
248 wprintf("Advanced options<BR>");
250 wprintf("</A></P></SPAN>\n");
254 wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
255 "<A HREF=\"/termquit\" TITLE=\"Log off\" TARGET=\"_top\" "
256 "onClick=\"return confirm('Log off now?');\">"
258 if (ib_displayas != IB_TEXTONLY) {
259 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
260 "SRC=\"/static/exit-icon.gif\"><BR>");
262 if (ib_displayas != IB_PICONLY) {
263 wprintf("Log off<BR>");
265 wprintf("</A></P></SPAN>\n");
269 "<SPAN CLASS=\"customize\"><P>"
270 "<A HREF=\"/display_customize_iconbar\" "
271 "TITLE=\"Customize this menu\" "
272 "TARGET=\"workspace\">customize this menu</A>"
276 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
277 "<SPAN CLASS=\"powered_by\"><P>"
278 "<A HREF=\"http://uncensored.citadel.org/citadel\" "
279 "TITLE=\"Find out more about Citadel\" TARGET=\"aboutcit\" "
280 "onMouseOver=\"window.status='Find out more about "
281 "Citadel'; return true;\">powered by<BR><IMG "
282 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
283 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\">"
288 wprintf("</CENTER>\n");
289 do_template("endbox");
295 void display_customize_iconbar(void) {
298 char key[SIZ], value[SIZ];
301 /* The initialized values of these variables also happen to
302 * specify the default values for users who haven't customized
303 * their iconbars. These should probably be set in a master
304 * configuration somewhere.
306 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
307 int ib_logo = 0; /* Site logo */
308 int ib_summary = 0; /* Summary page icon */
309 int ib_inbox = 0; /* Inbox icon */
310 int ib_calendar = 0; /* Calendar icon */
311 int ib_contacts = 0; /* Contacts icon */
312 int ib_notes = 0; /* Notes icon */
313 int ib_tasks = 0; /* Tasks icon */
314 int ib_rooms = 1; /* Rooms icon */
315 int ib_users = 1; /* Users icon */
316 int ib_chat = 0; /* Chat icon */
317 int ib_advanced = 1; /* Advanced Options icon */
318 int ib_logoff = 1; /* Logoff button */
319 int ib_citadel = 1; /* 'Powered by Citadel' logo */
323 get_preference("iconbar", iconbar);
324 for (i=0; i<num_tokens(iconbar, ','); ++i) {
325 extract_token(buf, iconbar, i, ',');
326 extract_token(key, buf, 0, '=');
327 extract_token(value, buf, 1, '=');
329 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
330 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
331 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
332 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
333 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
334 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
335 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
336 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
337 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
338 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
339 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
340 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
341 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
342 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
346 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
347 do_template("beginbox");
349 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
352 "Display icons as: ");
353 for (i=0; i<=2; ++i) {
354 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
355 if (ib_displayas == i) wprintf(" CHECKED");
357 if (i == IB_PICTEXT) wprintf("pictures and text");
358 if (i == IB_PICONLY) wprintf("pictures only");
359 if (i == IB_TEXTONLY) wprintf("text only");
362 wprintf("<BR><BR>\n");
364 wprintf("Select the icons you would like to see displayed "
365 "in the "icon bar" menu on the left side of the "
366 "screen.</CENTER><BR>\n"
369 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
371 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
372 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
374 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
375 "SRC=\"/image&name=hello\" ALT=\" \">"
377 "<B>Site logo</B><BR>"
378 "A graphic describing this site"
380 (ib_logo ? "CHECKED" : "")
384 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
386 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
387 "SRC=\"/static/summary.gif\" ALT=\" \">"
392 (ib_summary ? "CHECKED" : "")
395 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
396 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
398 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
399 "SRC=\"/static/mail.gif\" ALT=\" \">"
401 "<B>Mail (inbox)</B><BR>"
402 "A shortcut to your e-mail Inbox."
404 (ib_inbox ? "CHECKED" : "")
408 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
411 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
412 "SRC=\"/static/vcard.gif\" ALT=\" \">"
414 "<B>Contacts</B><BR>"
415 "Your personal address book."
417 (ib_contacts ? "CHECKED" : "")
420 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
421 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
424 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
425 "SRC=\"/static/note.gif\" ALT=\" \">"
428 "Your personal notes."
430 (ib_notes ? "CHECKED" : "")
433 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
435 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
438 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
439 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
441 "<B>Calendar</B><BR>"
442 "A shortcut to your personal calendar."
444 (ib_calendar ? "CHECKED" : "")
447 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
448 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
450 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
451 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
454 "A shortcut to your personal task list."
456 (ib_tasks ? "CHECKED" : "")
458 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
461 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
463 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
464 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
467 "Clicking this icon displays a list of all accesible "
468 "rooms (or folders) available."
470 (ib_rooms ? "CHECKED" : "")
473 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
474 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
476 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
477 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
480 "Clicking this icon displays a list of all users "
481 "currently logged in."
483 (ib_users ? "CHECKED" : "")
487 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
489 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
490 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
493 "Clicking this icon enters real-time chat mode "
494 "with other users in the same room."
496 (ib_chat ? "CHECKED" : "")
499 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
500 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
503 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
504 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
506 "<B>Advanced options</B><BR>"
507 "Access to the complete menu of Citadel functions."
509 (ib_advanced ? "CHECKED" : "")
513 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
516 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
517 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
520 "Exit from the Citadel system. If you remove this icon "
521 "then you will have no way out!"
523 (ib_logoff ? "CHECKED" : "")
525 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
526 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
529 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
530 "SRC=\"/static/citadel-logo.gif\" ALT=\" \">"
532 "<B>Citadel logo</B><BR>"
533 "Displays the "Powered by Citadel" graphic"
535 (ib_citadel ? "CHECKED" : "")
538 wprintf("</TABLE><BR>\n"
540 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
542 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
546 do_template("endbox");
551 void commit_iconbar(void) {
571 if (strcmp(bstr("sc"), "OK")) {
576 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
578 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
579 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
580 if (!strcasecmp(bstr(boxen[i]), "yes")) {
581 sprintf(&iconbar[strlen(iconbar)], "1");
584 sprintf(&iconbar[strlen(iconbar)], "0");
588 set_preference("iconbar", iconbar);
591 do_template("beginbox_nt");
593 "<IMG SRC=\"/static/advanced-icon.gif\" "
594 "onLoad=\"javascript:top['iconbarframe'].location.reload();\">"
596 "Your icon bar has been updated. Please select any of its "
597 "choices to continue.\n"
599 do_template("endbox");