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_tasks = 0; /* Tasks icon */
48 int ib_rooms = 1; /* Rooms icon */
49 int ib_users = 1; /* Users icon */
50 int ib_advanced = 1; /* Advanced Options icon */
51 int ib_logoff = 1; /* Logoff button */
52 int ib_citadel = 1; /* 'Powered by Citadel' logo */
56 get_preference("iconbar", iconbar);
57 for (i=0; i<num_tokens(iconbar, ','); ++i) {
58 extract_token(buf, iconbar, i, ',');
59 extract_token(key, buf, 0, '=');
60 extract_token(value, buf, 1, '=');
62 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
63 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
64 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
65 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
66 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
67 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
68 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
69 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
70 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
71 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
72 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
78 do_template("beginbox_nt");
80 wprintf("<center>\n");
82 if (ib_logo) if (ib_displayas != IB_TEXTONLY) wprintf(
83 "\"<IMG BORDER=\"0\" WIDTH=\"48\" "
84 "HEIGHT=\"48\" SRC=\"/image&name=hello\" ALT=\" \">"
89 wprintf("<SPAN CLASS=\"iconbar_link\">"
90 "<A HREF=\"/summary\" "
91 "TITLE=\"Your summary page\" "
92 "TARGET=\"workspace\">"
94 if (ib_displayas != IB_TEXTONLY) {
95 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
96 "SRC=\"/static/summary.gif\"><BR>");
98 if (ib_displayas != IB_PICONLY) {
99 wprintf("Summary<BR>");
101 wprintf("</A></SPAN>\n");
105 wprintf("<SPAN CLASS=\"iconbar_link\">"
106 "<A HREF=\"/dotgoto?room=_MAIL_\" "
107 "TITLE=\"Go to your e-mail inbox\" "
108 "TARGET=\"workspace\">"
110 if (ib_displayas != IB_TEXTONLY) {
111 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
112 "SRC=\"/static/mail.gif\"><BR>");
114 if (ib_displayas != IB_PICONLY) {
117 wprintf("</A></SPAN>\n");
121 wprintf("<SPAN CLASS=\"iconbar_link\">"
122 "<A HREF=\"/dotgoto?room=Calendar\" "
123 "TITLE=\"Go to your personal calendar\" "
124 "TARGET=\"workspace\">"
126 if (ib_displayas != IB_TEXTONLY) {
127 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
128 "SRC=\"/static/vcalendar.gif\"><BR>");
130 if (ib_displayas != IB_PICONLY) {
131 wprintf("Calendar<BR>");
133 wprintf("</A></SPAN>\n");
137 wprintf("<SPAN CLASS=\"iconbar_link\">"
138 "<A HREF=\"/dotgoto?room=Tasks\" "
139 "TITLE=\"Go to your personal task list\" "
140 "TARGET=\"workspace\">"
142 if (ib_displayas != IB_TEXTONLY) {
143 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
144 "SRC=\"/static/vcalendar.gif\"><BR>");
146 if (ib_displayas != IB_PICONLY) {
147 wprintf("Tasks<BR>");
149 wprintf("</A></SPAN>\n");
153 wprintf("<SPAN CLASS=\"iconbar_link\">"
154 "<A HREF=\"/knrooms\" TITLE=\"Shows a list of all "
155 "Rooms that you have access to\" TARGET=\"workspace\">"
157 if (ib_displayas != IB_TEXTONLY) {
158 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
159 "SRC=\"/static/rooms-icon.gif\"><BR>");
161 if (ib_displayas != IB_PICONLY) {
162 wprintf("Rooms<BR>");
164 wprintf("</A></SPAN>\n");
168 wprintf("<SPAN CLASS=\"iconbar_link\">"
169 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
170 "TARGET=\"workspace\">"
172 if (ib_displayas != IB_TEXTONLY) {
173 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
174 "SRC=\"/static/users-icon.gif\"><BR>");
176 if (ib_displayas != IB_PICONLY) {
177 wprintf("Users<BR>");
179 wprintf("</A></SPAN>\n");
183 wprintf("<SPAN CLASS=\"iconbar_link\">"
184 "<A HREF=\"/display_main_menu\" "
185 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
186 "Account Info, and Chat\" "
187 "TARGET=\"workspace\">"
189 if (ib_displayas != IB_TEXTONLY) {
190 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
191 "SRC=\"/static/advanced-icon.gif\"><BR>");
193 if (ib_displayas != IB_PICONLY) {
194 wprintf("Advanced options<BR>");
196 wprintf("</A></SPAN>\n");
200 wprintf("<SPAN CLASS=\"iconbar_link\">"
201 "<A HREF=\"/termquit\" TITLE=\"Log off\" TARGET=\"_top\" "
202 "onClick=\"return confirm('Log off now?');\">"
204 if (ib_displayas != IB_TEXTONLY) {
205 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
206 "SRC=\"/static/exit-icon.gif\"><BR>");
208 if (ib_displayas != IB_PICONLY) {
209 wprintf("Log off<BR>");
211 wprintf("</A></SPAN>\n");
215 "<SPAN CLASS=\"customize\">"
216 "<A HREF=\"/display_customize_iconbar\" "
217 "TITLE=\"Customize this menu\" "
218 "TARGET=\"workspace\">customize this menu</A>"
222 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
223 "<SPAN CLASS=\"powered_by\">"
224 "<A HREF=\"http://uncensored.citadel.org/citadel\" "
225 "TITLE=\"Find out more about Citadel/UX\" TARGET=\"aboutcit\" "
226 "onMouseOver=\"window.status='Find out more about "
227 "Citadel/UX'; return true;\">powered by<BR><IMG "
228 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
229 "SRC=\"/static/citadel-logo.jpg\" ALT=\"CITADEL/UX\"></A>"
233 wprintf("</CENTER>\n");
234 do_template("endbox");
240 void display_customize_iconbar(void) {
243 char key[SIZ], value[SIZ];
246 /* The initialized values of these variables also happen to
247 * specify the default values for users who haven't customized
248 * their iconbars. These should probably be set in a master
249 * configuration somewhere.
251 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
252 int ib_logo = 1; /* Site logo */
253 int ib_summary = 0; /* Summary page icon */
254 int ib_inbox = 0; /* Inbox icon */
255 int ib_calendar = 0; /* Calendar icon */
256 int ib_tasks = 0; /* Tasks icon */
257 int ib_rooms = 1; /* Rooms icon */
258 int ib_users = 1; /* Users icon */
259 int ib_advanced = 1; /* Advanced Options icon */
260 int ib_logoff = 1; /* Logoff button */
261 int ib_citadel = 1; /* 'Powered by Citadel' logo */
265 get_preference("iconbar", iconbar);
266 for (i=0; i<num_tokens(iconbar, ','); ++i) {
267 extract_token(buf, iconbar, i, ',');
268 extract_token(key, buf, 0, '=');
269 extract_token(value, buf, 1, '=');
271 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
272 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
273 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
274 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
275 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
276 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
277 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
278 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
279 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
280 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
281 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
286 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
287 do_template("beginbox");
289 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
292 "Display icons as: ");
293 for (i=0; i<=2; ++i) {
294 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
295 if (ib_displayas == i) wprintf(" CHECKED");
297 if (i == IB_PICTEXT) wprintf("pictures and text");
298 if (i == IB_PICONLY) wprintf("pictures only");
299 if (i == IB_TEXTONLY) wprintf("text only");
302 wprintf("<BR><BR>\n");
304 wprintf("Select the icons you would like to see displayed "
305 "in the "icon bar" menu on the left side of the "
306 "screen.</CENTER><BR>\n"
309 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
311 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
312 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
314 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
315 "SRC=\"/image&name=hello\" ALT=\" \">"
317 "<B>Site logo</B><BR>"
318 "A graphic describing this site"
320 (ib_logo ? "CHECKED" : "")
324 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
326 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
327 "SRC=\"/static/summary.gif\" ALT=\" \">"
332 (ib_summary ? "CHECKED" : "")
335 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
336 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
338 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
339 "SRC=\"/static/mail.gif\" ALT=\" \">"
341 "<B>Mail (inbox)</B><BR>"
342 "A shortcut to your e-mail Inbox."
344 (ib_inbox ? "CHECKED" : "")
347 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
349 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
352 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
353 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
355 "<B>Calendar</B><BR>"
356 "A shortcut to your personal calendar."
358 (ib_calendar ? "CHECKED" : "")
361 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
362 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
364 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
365 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
368 "A shortcut to your personal task list."
370 (ib_tasks ? "CHECKED" : "")
372 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
375 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
377 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
378 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
381 "Clicking this icon displays a list of all accesible "
382 "rooms (or folders) available."
384 (ib_rooms ? "CHECKED" : "")
387 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
388 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
390 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
391 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
394 "Clicking this icon displays a list of all users "
395 "currently logged in."
397 (ib_users ? "CHECKED" : "")
401 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
404 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
405 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
407 "<B>Advanced options</B><BR>"
408 "Access to the complete menu of Citadel functions."
410 (ib_advanced ? "CHECKED" : "")
413 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
414 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
417 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
418 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
421 "Exit from the Citadel system. If you remove this icon "
422 "then you will have no way out!"
424 (ib_logoff ? "CHECKED" : "")
427 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
430 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
431 "SRC=\"/static/citadel-logo.jpg\" ALT=\" \">"
433 "<B>Citadel logo</B><BR>"
434 "Displays the "Powered by Citadel" graphic"
436 (ib_citadel ? "CHECKED" : "")
439 wprintf("</TABLE><BR>\n"
441 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
443 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
447 do_template("endbox");
452 void commit_iconbar(void) {
469 if (strcmp(bstr("sc"), "OK")) {
474 sprintf(iconbar, "ib_displayas=%d,", atoi(bstr("ib_displayas")));
476 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
477 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
478 if (!strcasecmp(bstr(boxen[i]), "yes")) {
479 sprintf(&iconbar[strlen(iconbar)], "1");
482 sprintf(&iconbar[strlen(iconbar)], "0");
486 set_preference("iconbar", iconbar);
489 do_template("beginbox_nt");
491 "<IMG SRC=\"/static/advanced-icon.gif\" "
492 "onLoad=\"javascript:top['iconbarframe'].location.reload();\">"
494 "Your icon bar has been updated. Please select any of its "
495 "choices to continue.\n"
497 do_template("endbox");