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=\"/chat\" TITLE=\"Chat with other users in this room\" "
203 "TARGET=\"workspace\">"
205 if (ib_displayas != IB_TEXTONLY) {
206 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
207 "SRC=\"/static/chat-icon.gif\"><BR>");
209 if (ib_displayas != IB_PICONLY) {
212 wprintf("</A></SPAN>\n");
216 wprintf("<SPAN CLASS=\"iconbar_link\">"
217 "<A HREF=\"/display_main_menu\" "
218 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
219 "Account Info, and Chat\" "
220 "TARGET=\"workspace\">"
222 if (ib_displayas != IB_TEXTONLY) {
223 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
224 "SRC=\"/static/advanced-icon.gif\"><BR>");
226 if (ib_displayas != IB_PICONLY) {
227 wprintf("Advanced options<BR>");
229 wprintf("</A></SPAN>\n");
233 wprintf("<SPAN CLASS=\"iconbar_link\">"
234 "<A HREF=\"/termquit\" TITLE=\"Log off\" TARGET=\"_top\" "
235 "onClick=\"return confirm('Log off now?');\">"
237 if (ib_displayas != IB_TEXTONLY) {
238 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
239 "SRC=\"/static/exit-icon.gif\"><BR>");
241 if (ib_displayas != IB_PICONLY) {
242 wprintf("Log off<BR>");
244 wprintf("</A></SPAN>\n");
248 "<SPAN CLASS=\"customize\">"
249 "<A HREF=\"/display_customize_iconbar\" "
250 "TITLE=\"Customize this menu\" "
251 "TARGET=\"workspace\">customize this menu</A>"
255 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
256 "<SPAN CLASS=\"powered_by\">"
257 "<A HREF=\"http://uncensored.citadel.org/citadel\" "
258 "TITLE=\"Find out more about Citadel/UX\" TARGET=\"aboutcit\" "
259 "onMouseOver=\"window.status='Find out more about "
260 "Citadel/UX'; return true;\">powered by<BR><IMG "
261 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
262 "SRC=\"/static/citadel-logo.jpg\" ALT=\"CITADEL/UX\"></A>"
266 wprintf("</CENTER>\n");
267 do_template("endbox");
273 void display_customize_iconbar(void) {
276 char key[SIZ], value[SIZ];
279 /* The initialized values of these variables also happen to
280 * specify the default values for users who haven't customized
281 * their iconbars. These should probably be set in a master
282 * configuration somewhere.
284 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
285 int ib_logo = 1; /* Site logo */
286 int ib_summary = 0; /* Summary page icon */
287 int ib_inbox = 0; /* Inbox icon */
288 int ib_calendar = 0; /* Calendar icon */
289 int ib_contacts = 0; /* Contacts icon */
290 int ib_tasks = 0; /* Tasks icon */
291 int ib_rooms = 1; /* Rooms icon */
292 int ib_users = 1; /* Users icon */
293 int ib_chat = 0; /* Chat icon */
294 int ib_advanced = 1; /* Advanced Options icon */
295 int ib_logoff = 1; /* Logoff button */
296 int ib_citadel = 1; /* 'Powered by Citadel' logo */
300 get_preference("iconbar", iconbar);
301 for (i=0; i<num_tokens(iconbar, ','); ++i) {
302 extract_token(buf, iconbar, i, ',');
303 extract_token(key, buf, 0, '=');
304 extract_token(value, buf, 1, '=');
306 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
307 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
308 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
309 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
310 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
311 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
312 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
313 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
314 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
315 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
316 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
317 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
318 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
322 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
323 do_template("beginbox");
325 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
328 "Display icons as: ");
329 for (i=0; i<=2; ++i) {
330 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
331 if (ib_displayas == i) wprintf(" CHECKED");
333 if (i == IB_PICTEXT) wprintf("pictures and text");
334 if (i == IB_PICONLY) wprintf("pictures only");
335 if (i == IB_TEXTONLY) wprintf("text only");
338 wprintf("<BR><BR>\n");
340 wprintf("Select the icons you would like to see displayed "
341 "in the "icon bar" menu on the left side of the "
342 "screen.</CENTER><BR>\n"
345 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
347 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
348 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
350 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
351 "SRC=\"/image&name=hello\" ALT=\" \">"
353 "<B>Site logo</B><BR>"
354 "A graphic describing this site"
356 (ib_logo ? "CHECKED" : "")
360 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
362 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
363 "SRC=\"/static/summary.gif\" ALT=\" \">"
368 (ib_summary ? "CHECKED" : "")
371 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
372 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
374 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
375 "SRC=\"/static/mail.gif\" ALT=\" \">"
377 "<B>Mail (inbox)</B><BR>"
378 "A shortcut to your e-mail Inbox."
380 (ib_inbox ? "CHECKED" : "")
384 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
387 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
388 "SRC=\"/static/vcard.gif\" ALT=\" \">"
390 "<B>Contacts</B><BR>"
391 "Your personal address book."
393 (ib_contacts ? "CHECKED" : "")
396 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
397 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
398 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
401 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
402 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
404 "<B>Calendar</B><BR>"
405 "A shortcut to your personal calendar."
407 (ib_calendar ? "CHECKED" : "")
411 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
413 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
414 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
417 "A shortcut to your personal task list."
419 (ib_tasks ? "CHECKED" : "")
421 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
423 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
424 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
426 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
427 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
430 "Clicking this icon displays a list of all accesible "
431 "rooms (or folders) available."
433 (ib_rooms ? "CHECKED" : "")
437 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
439 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
440 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
443 "Clicking this icon displays a list of all users "
444 "currently logged in."
446 (ib_users ? "CHECKED" : "")
449 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
450 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
452 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
453 "SRC=\"/static/chat-icon.gif\" ALT=\" \">"
456 "Clicking this icon enters real-time chat mode "
457 "with other users in the same room."
459 (ib_chat ? "CHECKED" : "")
463 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
466 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
467 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
469 "<B>Advanced options</B><BR>"
470 "Access to the complete menu of Citadel functions."
472 (ib_advanced ? "CHECKED" : "")
475 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
476 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
479 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
480 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
483 "Exit from the Citadel system. If you remove this icon "
484 "then you will have no way out!"
486 (ib_logoff ? "CHECKED" : "")
489 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
492 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
493 "SRC=\"/static/citadel-logo.jpg\" ALT=\" \">"
495 "<B>Citadel logo</B><BR>"
496 "Displays the "Powered by Citadel" graphic"
498 (ib_citadel ? "CHECKED" : "")
501 wprintf("</TABLE><BR>\n"
503 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
505 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
509 do_template("endbox");
514 void commit_iconbar(void) {
533 if (strcmp(bstr("sc"), "OK")) {
538 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
540 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
541 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
542 if (!strcasecmp(bstr(boxen[i]), "yes")) {
543 sprintf(&iconbar[strlen(iconbar)], "1");
546 sprintf(&iconbar[strlen(iconbar)], "0");
550 set_preference("iconbar", iconbar);
553 do_template("beginbox_nt");
555 "<IMG SRC=\"/static/advanced-icon.gif\" "
556 "onLoad=\"javascript:top['iconbarframe'].location.reload();\">"
558 "Your icon bar has been updated. Please select any of its "
559 "choices to continue.\n"
561 do_template("endbox");