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_advanced = 1; /* Advanced Options icon */
52 int ib_logoff = 1; /* Logoff button */
53 int ib_citadel = 1; /* 'Powered by Citadel' logo */
57 get_preference("iconbar", iconbar);
58 for (i=0; i<num_tokens(iconbar, ','); ++i) {
59 extract_token(buf, iconbar, i, ',');
60 extract_token(key, buf, 0, '=');
61 extract_token(value, buf, 1, '=');
63 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
64 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
65 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
66 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
67 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
68 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
69 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
70 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
71 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
72 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
73 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
74 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=\"/display_main_menu\" "
203 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
204 "Account Info, and Chat\" "
205 "TARGET=\"workspace\">"
207 if (ib_displayas != IB_TEXTONLY) {
208 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
209 "SRC=\"/static/advanced-icon.gif\"><BR>");
211 if (ib_displayas != IB_PICONLY) {
212 wprintf("Advanced options<BR>");
214 wprintf("</A></SPAN>\n");
218 wprintf("<SPAN CLASS=\"iconbar_link\">"
219 "<A HREF=\"/termquit\" TITLE=\"Log off\" TARGET=\"_top\" "
220 "onClick=\"return confirm('Log off now?');\">"
222 if (ib_displayas != IB_TEXTONLY) {
223 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
224 "SRC=\"/static/exit-icon.gif\"><BR>");
226 if (ib_displayas != IB_PICONLY) {
227 wprintf("Log off<BR>");
229 wprintf("</A></SPAN>\n");
233 "<SPAN CLASS=\"customize\">"
234 "<A HREF=\"/display_customize_iconbar\" "
235 "TITLE=\"Customize this menu\" "
236 "TARGET=\"workspace\">customize this menu</A>"
240 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
241 "<SPAN CLASS=\"powered_by\">"
242 "<A HREF=\"http://uncensored.citadel.org/citadel\" "
243 "TITLE=\"Find out more about Citadel/UX\" TARGET=\"aboutcit\" "
244 "onMouseOver=\"window.status='Find out more about "
245 "Citadel/UX'; return true;\">powered by<BR><IMG "
246 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
247 "SRC=\"/static/citadel-logo.jpg\" ALT=\"CITADEL/UX\"></A>"
251 wprintf("</CENTER>\n");
252 do_template("endbox");
258 void display_customize_iconbar(void) {
261 char key[SIZ], value[SIZ];
264 /* The initialized values of these variables also happen to
265 * specify the default values for users who haven't customized
266 * their iconbars. These should probably be set in a master
267 * configuration somewhere.
269 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
270 int ib_logo = 1; /* Site logo */
271 int ib_summary = 0; /* Summary page icon */
272 int ib_inbox = 0; /* Inbox icon */
273 int ib_calendar = 0; /* Calendar icon */
274 int ib_contacts = 0; /* Contacts icon */
275 int ib_tasks = 0; /* Tasks icon */
276 int ib_rooms = 1; /* Rooms icon */
277 int ib_users = 1; /* Users icon */
278 int ib_advanced = 1; /* Advanced Options icon */
279 int ib_logoff = 1; /* Logoff button */
280 int ib_citadel = 1; /* 'Powered by Citadel' logo */
284 get_preference("iconbar", iconbar);
285 for (i=0; i<num_tokens(iconbar, ','); ++i) {
286 extract_token(buf, iconbar, i, ',');
287 extract_token(key, buf, 0, '=');
288 extract_token(value, buf, 1, '=');
290 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
291 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
292 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
293 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
294 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
295 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
296 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
297 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
298 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
299 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
300 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
301 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
306 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
307 do_template("beginbox");
309 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
312 "Display icons as: ");
313 for (i=0; i<=2; ++i) {
314 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
315 if (ib_displayas == i) wprintf(" CHECKED");
317 if (i == IB_PICTEXT) wprintf("pictures and text");
318 if (i == IB_PICONLY) wprintf("pictures only");
319 if (i == IB_TEXTONLY) wprintf("text only");
322 wprintf("<BR><BR>\n");
324 wprintf("Select the icons you would like to see displayed "
325 "in the "icon bar" menu on the left side of the "
326 "screen.</CENTER><BR>\n"
329 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
331 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
332 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
334 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
335 "SRC=\"/image&name=hello\" ALT=\" \">"
337 "<B>Site logo</B><BR>"
338 "A graphic describing this site"
340 (ib_logo ? "CHECKED" : "")
344 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
346 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
347 "SRC=\"/static/summary.gif\" ALT=\" \">"
352 (ib_summary ? "CHECKED" : "")
355 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
356 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
358 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
359 "SRC=\"/static/mail.gif\" ALT=\" \">"
361 "<B>Mail (inbox)</B><BR>"
362 "A shortcut to your e-mail Inbox."
364 (ib_inbox ? "CHECKED" : "")
368 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
371 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
372 "SRC=\"/static/vcard.gif\" ALT=\" \">"
374 "<B>Contacts</B><BR>"
375 "Your personal address book."
377 (ib_contacts ? "CHECKED" : "")
380 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
381 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
382 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
385 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
386 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
388 "<B>Calendar</B><BR>"
389 "A shortcut to your personal calendar."
391 (ib_calendar ? "CHECKED" : "")
395 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
397 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
398 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
401 "A shortcut to your personal task list."
403 (ib_tasks ? "CHECKED" : "")
405 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
407 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
408 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
410 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
411 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
414 "Clicking this icon displays a list of all accesible "
415 "rooms (or folders) available."
417 (ib_rooms ? "CHECKED" : "")
421 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
423 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
424 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
427 "Clicking this icon displays a list of all users "
428 "currently logged in."
430 (ib_users ? "CHECKED" : "")
433 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
434 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
437 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
438 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
440 "<B>Advanced options</B><BR>"
441 "Access to the complete menu of Citadel functions."
443 (ib_advanced ? "CHECKED" : "")
447 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
450 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
451 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
454 "Exit from the Citadel system. If you remove this icon "
455 "then you will have no way out!"
457 (ib_logoff ? "CHECKED" : "")
459 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
460 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
463 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
464 "SRC=\"/static/citadel-logo.jpg\" ALT=\" \">"
466 "<B>Citadel logo</B><BR>"
467 "Displays the "Powered by Citadel" graphic"
469 (ib_citadel ? "CHECKED" : "")
472 wprintf("</TABLE><BR>\n"
474 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
476 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
480 do_template("endbox");
485 void commit_iconbar(void) {
503 if (strcmp(bstr("sc"), "OK")) {
508 sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
510 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
511 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
512 if (!strcasecmp(bstr(boxen[i]), "yes")) {
513 sprintf(&iconbar[strlen(iconbar)], "1");
516 sprintf(&iconbar[strlen(iconbar)], "0");
520 set_preference("iconbar", iconbar);
523 do_template("beginbox_nt");
525 "<IMG SRC=\"/static/advanced-icon.gif\" "
526 "onLoad=\"javascript:top['iconbarframe'].location.reload();\">"
528 "Your icon bar has been updated. Please select any of its "
529 "choices to continue.\n"
531 do_template("endbox");