11 #include <sys/socket.h>
14 #include <netinet/in.h>
26 void do_iconbar(void) {
29 char key[SIZ], value[SIZ];
32 /* The initialized values of these variables also happen to
33 * specify the default values for users who haven't customized
34 * their iconbars. These should probably be set in a master
35 * configuration somewhere.
37 int ib_logo = 1; /* Site logo */
38 int ib_inbox = 0; /* Inbox icon */
39 int ib_calendar = 0; /* Calendar icon */
40 int ib_tasks = 0; /* Tasks icon */
41 int ib_rooms = 1; /* Rooms icon */
42 int ib_users = 1; /* Users icon */
43 int ib_advanced = 1; /* Advanced Options icon */
44 int ib_logoff = 1; /* Logoff button */
45 int ib_citadel = 1; /* 'Powered by Citadel' logo */
49 get_preference("iconbar", iconbar);
50 for (i=0; i<num_tokens(iconbar, ','); ++i) {
51 extract_token(buf, iconbar, i, ',');
52 extract_token(key, buf, 0, '=');
53 extract_token(value, buf, 1, '=');
55 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
56 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
57 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
58 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
59 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
60 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
61 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
62 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
63 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
69 do_template("beginbox_nt");
71 wprintf("<center>\n");
73 if (ib_logo) wprintf("\"<IMG BORDER=\"0\" WIDTH=\"48\" "
74 "HEIGHT=\"48\" SRC=\"/image&name=hello\" ALT=\" \">"
78 if (ib_inbox) wprintf(
79 "<SPAN CLASS=\"iconbar_link\">"
80 "<A HREF=\"/dotgoto?room=_MAIL_\" "
81 "TITLE=\"Go to your e-mail inbox\" "
82 "TARGET=\"workspace\">"
83 "<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
84 "SRC=\"/static/mail.gif\">"
85 "<BR>Mail</A></SPAN><BR>\n"
88 if (ib_calendar) wprintf(
89 "<SPAN CLASS=\"iconbar_link\">"
90 "<A HREF=\"/dotgoto?room=Calendar\" "
91 "TITLE=\"Go to your personal calendar\" "
92 "TARGET=\"workspace\">"
93 "<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
94 "SRC=\"/static/vcalendar.gif\">"
95 "<BR>Calendar</A></SPAN><BR>\n"
98 if (ib_tasks) wprintf(
99 "<SPAN CLASS=\"iconbar_link\">"
100 "<A HREF=\"/dotgoto?room=Tasks\" "
101 "TITLE=\"Go to your personal task list\" "
102 "TARGET=\"workspace\">"
103 "<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
104 "SRC=\"/static/vcalendar.gif\">"
105 "<BR>Tasks</A></SPAN><BR>\n"
108 if (ib_rooms) wprintf(
109 "<SPAN CLASS=\"iconbar_link\">"
110 "<A HREF=\"/knrooms\" TITLE=\"Shows a list of all "
111 "Rooms that you have access to\" TARGET=\"workspace\">"
112 "<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
113 "SRC=\"/static/rooms-icon.gif\">"
114 "<BR>Rooms</A></SPAN><BR>\n"
117 if (ib_users) wprintf(
118 "<SPAN CLASS=\"iconbar_link\">"
119 "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
120 "TARGET=\"workspace\">"
121 "<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
122 "SRC=\"/static/users-icon.gif\">"
123 "<BR>Users</A></SPAN><BR>\n"
126 if (ib_advanced) wprintf(
127 "<SPAN CLASS=\"iconbar_link\">"
128 "<A HREF=\"/display_main_menu\" "
129 "TITLE=\"Advanced Options Menu: Advanced Room commands, "
130 "Account Info, and Chat\" "
131 "TARGET=\"workspace\">"
132 "<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
133 "SRC=\"/static/advanced-icon.gif\">"
134 "<BR>Advanced options</A></SPAN><BR>\n"
137 if (ib_logoff) wprintf(
138 "<SPAN CLASS=\"iconbar_link\">"
139 "<A HREF=\"/termquit\" TITLE=\"Log off\" TARGET=\"_top\" "
140 "onClick=\"return confirm('Log off now?');\">"
141 "<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
142 "SRC=\"/static/exit-icon.gif\">"
143 "<BR>Log off</A></SPAN><BR>\n"
147 "<SPAN CLASS=\"customize\">"
148 "<A HREF=\"/display_customize_iconbar\" "
149 "TITLE=\"Customize this menu\" "
150 "TARGET=\"workspace\">customize this menu</A>"
154 if (ib_citadel) wprintf(
155 "<SPAN CLASS=\"powered_by\">"
156 "<A HREF=\"http://uncensored.citadel.org/citadel\" "
157 "TITLE=\"Find out more about Citadel/UX\" TARGET=\"aboutcit\" "
158 "onMouseOver=\"window.status='Find out more about "
159 "Citadel/UX'; return true;\">powered by<BR><IMG "
160 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
161 "SRC=\"/static/citadel-logo.jpg\" ALT=\"CITADEL/UX\"></A>"
165 wprintf("</CENTER>\n");
166 do_template("endbox");
172 void display_customize_iconbar(void) {
175 char key[SIZ], value[SIZ];
178 /* The initialized values of these variables also happen to
179 * specify the default values for users who haven't customized
180 * their iconbars. These should probably be set in a master
181 * configuration somewhere.
183 int ib_logo = 1; /* Site logo */
184 int ib_inbox = 0; /* Inbox icon */
185 int ib_calendar = 0; /* Calendar icon */
186 int ib_tasks = 0; /* Tasks icon */
187 int ib_rooms = 1; /* Rooms icon */
188 int ib_users = 1; /* Users icon */
189 int ib_advanced = 1; /* Advanced Options icon */
190 int ib_logoff = 1; /* Logoff button */
191 int ib_citadel = 1; /* 'Powered by Citadel' logo */
195 get_preference("iconbar", iconbar);
196 for (i=0; i<num_tokens(iconbar, ','); ++i) {
197 extract_token(buf, iconbar, i, ',');
198 extract_token(key, buf, 0, '=');
199 extract_token(value, buf, 1, '=');
201 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
202 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
203 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
204 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
205 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
206 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
207 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
208 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
209 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
214 svprintf("BOXTITLE", WCS_STRING, "Customize the icon bar");
215 do_template("beginbox");
217 wprintf("<CENTER>Select the icons you would like to see displayed "
218 "in the "icon bar" menu on the left side of the "
219 "screen.</CENTER><BR>\n"
222 wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
223 wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
225 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
226 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
228 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
229 "SRC=\"/image&name=hello\" ALT=\" \">"
231 "<B>Site logo</B><BR>"
232 "A graphic describing this site"
234 (ib_logo ? "CHECKED" : "")
238 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
240 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
241 "SRC=\"/static/mail.gif\" ALT=\" \">"
243 "<B>Mail (inbox)</B><BR>"
244 "A shortcut to your e-mail Inbox."
246 (ib_inbox ? "CHECKED" : "")
249 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
250 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
251 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
254 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
255 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
257 "<B>Calendar</B><BR>"
258 "A shortcut to your personal calendar."
260 (ib_calendar ? "CHECKED" : "")
264 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
266 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
267 "SRC=\"/static/vcalendar.gif\" ALT=\" \">"
270 "A shortcut to your personal task list."
272 (ib_tasks ? "CHECKED" : "")
274 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
276 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
277 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
279 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
280 "SRC=\"/static/rooms-icon.gif\" ALT=\" \">"
283 "Clicking this icon displays a list of all accesible "
284 "rooms (or folders) available."
286 (ib_rooms ? "CHECKED" : "")
290 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
292 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
293 "SRC=\"/static/users-icon.gif\" ALT=\" \">"
296 "Clicking this icon displays a list of all users "
297 "currently logged in."
299 (ib_users ? "CHECKED" : "")
302 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
303 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
306 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
307 "SRC=\"/static/advanced-icon.gif\" ALT=\" \">"
309 "<B>Advanced options</B><BR>"
310 "Access to the complete menu of Citadel functions."
312 (ib_advanced ? "CHECKED" : "")
316 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
319 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
320 "SRC=\"/static/exit-icon.gif\" ALT=\" \">"
323 "Exit from the Citadel system. If you remove this icon "
324 "then you will have no way out!"
326 (ib_logoff ? "CHECKED" : "")
328 wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
329 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
332 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
333 "SRC=\"/static/citadel-logo.jpg\" ALT=\" \">"
335 "<B>Citadel logo</B><BR>"
336 "Displays the "Powered by Citadel" graphic"
338 (ib_citadel ? "CHECKED" : "")
341 wprintf("</TABLE><BR>\n"
343 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
345 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
349 do_template("endbox");
354 void commit_iconbar(void) {
370 if (strcmp(bstr("sc"), "OK")) {
377 for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
379 sprintf(&iconbar[strlen(iconbar)], ",");
381 sprintf(&iconbar[strlen(iconbar)], "%s=", boxen[i]);
382 if (!strcasecmp(bstr(boxen[i]), "yes")) {
383 sprintf(&iconbar[strlen(iconbar)], "1");
386 sprintf(&iconbar[strlen(iconbar)], "0");
390 set_preference("iconbar", iconbar);
393 do_template("beginbox_nt");
395 "<IMG SRC=\"/static/advanced-icon.gif\" "
396 "onLoad=\"javascript:top['iconbarframe'].location.reload();\">"
398 "Your icon bar has been updated. Please select any of its "
399 "choices to continue.\n"
401 do_template("endbox");