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_inbox = 0; /* Inbox icon */
45 int ib_calendar = 0; /* Calendar icon */
46 int ib_tasks = 0; /* Tasks icon */
47 int ib_rooms = 1; /* Rooms icon */
48 int ib_users = 1; /* Users icon */
49 int ib_advanced = 1; /* Advanced Options icon */
50 int ib_logoff = 1; /* Logoff button */
51 int ib_citadel = 1; /* 'Powered by Citadel' logo */
55 get_preference("iconbar", iconbar);
56 for (i=0; i<num_tokens(iconbar, ','); ++i) {
57 extract_token(buf, iconbar, i, ',');
58 extract_token(key, buf, 0, '=');
59 extract_token(value, buf, 1, '=');
61 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
62 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
63 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
64 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
65 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
66 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
67 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
68 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
69 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
70 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
76 do_template("beginbox_nt");
78 wprintf("<center>\n");
80 if (ib_logo) if (ib_displayas != IB_TEXTONLY) wprintf(
81 "\"<IMG BORDER=\"0\" WIDTH=\"48\" "
82 "HEIGHT=\"48\" SRC=\"/image&name=hello\" ALT=\" \">"
87 wprintf("<SPAN CLASS=\"iconbar_link\">"
88 "<A HREF=\"/dotgoto?room=_MAIL_\" "
89 "TITLE=\"Go to your e-mail inbox\" "
90 "TARGET=\"workspace\">"
92 if (ib_displayas != IB_TEXTONLY) {
93 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
94 "SRC=\"/static/mail.gif\"><BR>");
96 if (ib_displayas != IB_PICONLY) {
99 wprintf("</A></SPAN>\n");
103 wprintf("<SPAN CLASS=\"iconbar_link\">"
104 "<A HREF=\"/dotgoto?room=Calendar\" "
105 "TITLE=\"Go to your personal calendar\" "
106 "TARGET=\"workspace\">"
108 if (ib_displayas != IB_TEXTONLY) {
109 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
110 "SRC=\"/static/vcalendar.gif\"><BR>");
112 if (ib_displayas != IB_PICONLY) {
113 wprintf("Calendar<BR>");
115 wprintf("</A></SPAN>\n");
119 wprintf("<SPAN CLASS=\"iconbar_link\">"
120 "<A HREF=\"/dotgoto?room=Tasks\" "
121 "TITLE=\"Go to your personal task list\" "
122 "TARGET=\"workspace\">"
124 if (ib_displayas != IB_TEXTONLY) {
125 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
126 "SRC=\"/static/vcalendar.gif\"><BR>");
128 if (ib_displayas != IB_PICONLY) {
129 wprintf("Tasks<BR>");
131 wprintf("</A></SPAN>\n");
135 wprintf("<SPAN CLASS=\"iconbar_link\">"
136 "<A HREF=\"/knrooms\" TITLE=\"Shows a list of all "
137 "Rooms that you have access to\" TARGET=\"workspace\">"
139 if (ib_displayas != IB_TEXTONLY) {
140 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
141 "SRC=\"/static/rooms-icon.gif\"><BR>");
143 if (ib_displayas != IB_PICONLY) {
144 wprintf("Rooms<BR>");
146 wprintf("</A></SPAN>\n");
150 wprintf("<SPAN CLASS=\"iconbar_link\">"
151 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
152 "TARGET=\"workspace\">"
154 if (ib_displayas != IB_TEXTONLY) {
155 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
156 "SRC=\"/static/users-icon.gif\"><BR>");
158 if (ib_displayas != IB_PICONLY) {
159 wprintf("Users<BR>");
161 wprintf("</A></SPAN>\n");
165 wprintf("<SPAN CLASS=\"iconbar_link\">"
166 "<A HREF=\"/display_main_menu\" "
167 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
168 "Account Info, and Chat\" "
169 "TARGET=\"workspace\">"
171 if (ib_displayas != IB_TEXTONLY) {
172 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
173 "SRC=\"/static/advanced-icon.gif\"><BR>");
175 if (ib_displayas != IB_PICONLY) {
176 wprintf("Advanced options<BR>");
178 wprintf("</A></SPAN>\n");
182 wprintf("<SPAN CLASS=\"iconbar_link\">"
183 "<A HREF=\"/termquit\" TITLE=\"Log off\" TARGET=\"_top\" "
184 "onClick=\"return confirm('Log off now?');\">"
186 if (ib_displayas != IB_TEXTONLY) {
187 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
188 "SRC=\"/static/exit-icon.gif\"><BR>");
190 if (ib_displayas != IB_PICONLY) {
191 wprintf("Log off<BR>");
193 wprintf("</A></SPAN>\n");
197 "<SPAN CLASS=\"customize\">"
198 "<A HREF=\"/display_customize_iconbar\" "
199 "TITLE=\"Customize this menu\" "
200 "TARGET=\"workspace\">customize this menu</A>"
204 if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
205 "<SPAN CLASS=\"powered_by\">"
206 "<A HREF=\"http://uncensored.citadel.org/citadel\" "
207 "TITLE=\"Find out more about Citadel/UX\" TARGET=\"aboutcit\" "
208 "onMouseOver=\"window.status='Find out more about "
209 "Citadel/UX'; return true;\">powered by<BR><IMG "
210 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
211 "SRC=\"/static/citadel-logo.jpg\" ALT=\"CITADEL/UX\"></A>"
215 wprintf("</CENTER>\n");
216 do_template("endbox");
222 void display_customize_iconbar(void) {
225 char key[SIZ], value[SIZ];
228 /* The initialized values of these variables also happen to
229 * specify the default values for users who haven't customized
230 * their iconbars. These should probably be set in a master
231 * configuration somewhere.
233 int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */
234 int ib_logo = 1; /* Site logo */
235 int ib_inbox = 0; /* Inbox icon */
236 int ib_calendar = 0; /* Calendar icon */
237 int ib_tasks = 0; /* Tasks icon */
238 int ib_rooms = 1; /* Rooms icon */
239 int ib_users = 1; /* Users icon */
240 int ib_advanced = 1; /* Advanced Options icon */
241 int ib_logoff = 1; /* Logoff button */
242 int ib_citadel = 1; /* 'Powered by Citadel' logo */
246 get_preference("iconbar", iconbar);
247 for (i=0; i<num_tokens(iconbar, ','); ++i) {
248 extract_token(buf, iconbar, i, ',');
249 extract_token(key, buf, 0, '=');
250 extract_token(value, buf, 1, '=');
252 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
253 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
254 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
255 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
256 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
257 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
258 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
259 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
260 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
261 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
266 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
267 do_template("beginbox");
269 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
272 "Display icons as: ");
273 for (i=0; i<=2; ++i) {
274 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
275 if (ib_displayas == i) wprintf(" CHECKED");
277 if (i == IB_PICTEXT) wprintf("pictures and text");
278 if (i == IB_PICONLY) wprintf("pictures only");
279 if (i == IB_TEXTONLY) wprintf("text only");
282 wprintf("<BR><BR>\n");
284 wprintf("Select the icons you would like to see displayed "
285 "in the "icon bar" menu on the left side of the "
286 "screen.</CENTER><BR>\n"
289 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
291 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
292 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
294 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
295 "SRC=\"/image&name=hello\" ALT=\" \">"
297 "<B>Site logo</B><BR>"
298 "A graphic describing this site"
300 (ib_logo ? "CHECKED" : "")
304 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
306 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
307 "SRC=\"/static/mail.gif\" ALT=\" \">"
309 "<B>Mail (inbox)</B><BR>"
310 "A shortcut to your e-mail Inbox."
312 (ib_inbox ? "CHECKED" : "")
315 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
316 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
317 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
320 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
321 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
323 "<B>Calendar</B><BR>"
324 "A shortcut to your personal calendar."
326 (ib_calendar ? "CHECKED" : "")
330 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
332 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
333 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
336 "A shortcut to your personal task list."
338 (ib_tasks ? "CHECKED" : "")
340 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
342 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
343 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
345 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
346 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
349 "Clicking this icon displays a list of all accesible "
350 "rooms (or folders) available."
352 (ib_rooms ? "CHECKED" : "")
356 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
358 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
359 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
362 "Clicking this icon displays a list of all users "
363 "currently logged in."
365 (ib_users ? "CHECKED" : "")
368 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
369 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
372 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
373 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
375 "<B>Advanced options</B><BR>"
376 "Access to the complete menu of Citadel functions."
378 (ib_advanced ? "CHECKED" : "")
382 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
385 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
386 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
389 "Exit from the Citadel system. If you remove this icon "
390 "then you will have no way out!"
392 (ib_logoff ? "CHECKED" : "")
394 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
395 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
398 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
399 "SRC=\"/static/citadel-logo.jpg\" ALT=\" \">"
401 "<B>Citadel logo</B><BR>"
402 "Displays the "Powered by Citadel" graphic"
404 (ib_citadel ? "CHECKED" : "")
407 wprintf("</TABLE><BR>\n"
409 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
411 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
415 do_template("endbox");
420 void commit_iconbar(void) {
436 if (strcmp(bstr("sc"), "OK")) {
441 sprintf(iconbar, "ib_displayas=%d,", atoi(bstr("ib_displayas")));
443 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
444 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
445 if (!strcasecmp(bstr(boxen[i]), "yes")) {
446 sprintf(&iconbar[strlen(iconbar)], "1");
449 sprintf(&iconbar[strlen(iconbar)], "0");
453 set_preference("iconbar", iconbar);
456 do_template("beginbox_nt");
458 "<IMG SRC=\"/static/advanced-icon.gif\" "
459 "onLoad=\"javascript:top['iconbarframe'].location.reload();\">"
461 "Your icon bar has been updated. Please select any of its "
462 "choices to continue.\n"
464 do_template("endbox");