* Fixed an HTTP output error for static data which was causing images
[citadel.git] / webcit / iconbar.c
1 /*
2  * $Id$
3  *
4  * Displays and customizes the iconbar.
5  */
6
7 #include <ctype.h>
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <stdio.h>
11 #include <fcntl.h>
12 #include <signal.h>
13 #include <sys/types.h>
14 #include <sys/wait.h>
15 #include <sys/socket.h>
16 #include <sys/time.h>
17 #include <limits.h>
18 #include <netinet/in.h>
19 #include <netdb.h>
20 #include <string.h>
21 #include <time.h>
22 #include <pwd.h>
23 #include <errno.h>
24 #include <stdarg.h>
25 #include <pthread.h>
26 #include <signal.h>
27 #include "webcit.h"
28
29
30 /* Values for ib_displayas */
31 #define IB_PICTEXT      0
32 #define IB_PICONLY      1
33 #define IB_TEXTONLY     2
34
35 void do_iconbar(void) {
36         char iconbar[SIZ];
37         char buf[SIZ];
38         char key[SIZ], value[SIZ];
39         int i;
40
41         /* The initialized values of these variables also happen to
42          * specify the default values for users who haven't customized
43          * their iconbars.  These should probably be set in a master
44          * configuration somewhere.
45          */
46         int ib_displayas = 0;   /* pictures and text, pictures, text */
47         int ib_logo = 0;        /* Site logo */
48         int ib_summary = 1;     /* Summary page icon */
49         int ib_inbox = 1;       /* Inbox icon */
50         int ib_calendar = 1;    /* Calendar icon */
51         int ib_contacts = 1;    /* Contacts icon */
52         int ib_notes = 1;       /* Notes icon */
53         int ib_tasks = 1;       /* Tasks icon */
54         int ib_rooms = 1;       /* Rooms icon */
55         int ib_users = 1;       /* Users icon */
56         int ib_chat = 1;        /* Chat icon */
57         int ib_advanced = 1;    /* Advanced Options icon */
58         int ib_logoff = 1;      /* Logoff button */
59         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
60         /*
61          */
62
63         get_preference("iconbar", iconbar);
64         for (i=0; i<num_tokens(iconbar, ','); ++i) {
65                 extract_token(buf, iconbar, i, ',');
66                 extract_token(key, buf, 0, '=');
67                 extract_token(value, buf, 1, '=');
68
69                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
70                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
71                 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
72                 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
73                 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
74                 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
75                 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
76                 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
77                 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
78                 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
79                 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
80                 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
81                 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
82                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
83         }
84
85         wprintf("<div id=\"button\">\n"
86                 "<ul>\n"
87         );
88
89         if (ib_logo) {
90                 wprintf("<li>");
91                 if (ib_displayas != IB_TEXTONLY) {
92                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
93                                 "HEIGHT=\"32\" SRC=\"/image&name=hello\" ALT=\"&nbsp;\">\n"
94                         );
95                 }
96                 wprintf("</li>\n");
97         }
98
99         if (ib_summary) {
100                 wprintf("<li><A HREF=\"/summary\" "
101                         "TITLE=\"Your summary page\" "
102                         ">"
103                 );
104                 if (ib_displayas != IB_TEXTONLY) {
105                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
106                                 "SRC=\"/static/summary.gif\">");
107                 }
108                 if (ib_displayas != IB_PICONLY) {
109                         wprintf("Summary");
110                 }
111                 wprintf("</A></li>\n");
112         }
113
114         if (ib_inbox) {
115                 wprintf("<li>"
116                         "<A HREF=\"/dotgoto?room=_MAIL_\" "
117                         "TITLE=\"Go to your e-mail inbox\" "
118                         ">"
119                 );
120                 if (ib_displayas != IB_TEXTONLY) {
121                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
122                                 "SRC=\"/static/mail.gif\">");
123                 }
124                 if (ib_displayas != IB_PICONLY) {
125                         wprintf("Mail");
126                 }
127                 wprintf("</A></li>\n");
128         }
129
130         if (ib_calendar) {
131                 wprintf("<li>"
132                         "<A HREF=\"/dotgoto?room=Calendar\" "
133                         "TITLE=\"Go to your personal calendar\" "
134                         ">"
135                 );
136                 if (ib_displayas != IB_TEXTONLY) {
137                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
138                         "SRC=\"/static/vcalendar.gif\">");
139                 }
140                 if (ib_displayas != IB_PICONLY) {
141                         wprintf("Calendar");
142                 }
143                 wprintf("</A></li>\n");
144         }
145
146         if (ib_contacts) {
147                 wprintf("<li>"
148                         "<A HREF=\"/dotgoto?room=Contacts\" "
149                         "TITLE=\"Go to your personal address book\" "
150                         ">"
151                 );
152                 if (ib_displayas != IB_TEXTONLY) {
153                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
154                         "SRC=\"/static/vcard.gif\">");
155                 }
156                 if (ib_displayas != IB_PICONLY) {
157                         wprintf("Contacts");
158                 }
159                 wprintf("</A></li>\n");
160         }
161
162         if (ib_notes) {
163                 wprintf("<li>"
164                         "<A HREF=\"/dotgoto?room=Notes\" "
165                         "TITLE=\"Go to your personal notes\" "
166                         ">"
167                 );
168                 if (ib_displayas != IB_TEXTONLY) {
169                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
170                         "SRC=\"/static/note.gif\">");
171                 }
172                 if (ib_displayas != IB_PICONLY) {
173                         wprintf("Notes");
174                 }
175                 wprintf("</A></li>\n");
176         }
177
178         if (ib_tasks)  {
179                 wprintf("<li>"
180                         "<A HREF=\"/dotgoto?room=Tasks\" "
181                         "TITLE=\"Go to your personal task list\" "
182                         ">"
183                 );
184                 if (ib_displayas != IB_TEXTONLY) {
185                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
186                         "SRC=\"/static/vcalendar.gif\">");
187                 }
188                 if (ib_displayas != IB_PICONLY) {
189                         wprintf("Tasks");
190                 }
191                 wprintf("</A></li>\n");
192         }
193
194         if (ib_rooms) {
195                 wprintf("<li>"
196                         "<A HREF=\"/knrooms\" TITLE=\"List all of your "
197                         "accessible rooms\" >"
198                 );
199                 if (ib_displayas != IB_TEXTONLY) {
200                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
201                         "SRC=\"/static/rooms-icon.gif\">");
202                 }
203                 if (ib_displayas != IB_PICONLY) {
204                         wprintf("Rooms");
205                 }
206                 wprintf("</A></li>\n");
207         }
208
209         if (ib_users) {
210                 wprintf("<li>"
211                         "<A HREF=\"/whobbs\" TITLE=\"See who is online right now\" "
212                         ">"
213                 );
214                 if (ib_displayas != IB_TEXTONLY) {
215                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
216                         "SRC=\"/static/users-icon.gif\">");
217                 }
218                 if (ib_displayas != IB_PICONLY) {
219                         wprintf("Users");
220                 }
221                 wprintf("</A></li>\n");
222         }
223
224         if (ib_chat) {
225                 wprintf("<li>"
226                         "<A HREF=\"#\" onClick=\"window.open('/chat', "
227                         "'ctdl_chat_window', "
228                         "'toolbar=no,location=no,directories=no,copyhistory=no,"
229                         "status=no,scrollbars=yes,resizable=yes');\""
230                         ">"
231                 );
232                 if (ib_displayas != IB_TEXTONLY) {
233                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
234                         "SRC=\"/static/chat-icon.gif\">");
235                 }
236                 if (ib_displayas != IB_PICONLY) {
237                         wprintf("Chat");
238                 }
239                 wprintf("</A></li>\n");
240         }
241
242         if (ib_advanced) {
243                 wprintf("<li>"
244                         "<A HREF=\"/display_main_menu\" "
245                         "TITLE=\"Advanced Options Menu: Advanced Room commands, "
246                         "Account Info, and Chat\" "
247                         ">"
248                 );
249                 if (ib_displayas != IB_TEXTONLY) {
250                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
251                         "SRC=\"/static/advanced-icon.gif\">");
252                 }
253                 if (ib_displayas != IB_PICONLY) {
254                         wprintf("Advanced");
255                 }
256                 wprintf("</A></li>\n");
257         }
258
259         if (ib_logoff) {
260                 wprintf("<li>"
261                         "<A HREF=\"/termquit\" TITLE=\"Log off\" "
262                         "onClick=\"return confirm('Log off now?');\">"
263                 );
264                 if (ib_displayas != IB_TEXTONLY) {
265                 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
266                         "SRC=\"/static/exit-icon.gif\">");
267                 }
268                 if (ib_displayas != IB_PICONLY) {
269                         wprintf("Log off");
270                 }
271                 wprintf("</A></li>\n");
272         }
273
274         wprintf(
275                 "<li><div align=\"center\">"
276                 "<A HREF=\"/display_customize_iconbar\" "
277                 "TITLE=\"Customize this menu\" "
278                 ">customize this menu</A>"
279                 "</A></div></li>\n"
280         );
281
282         if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
283                 "<li><div align=\"center\">"
284                 "<A HREF=\"http://www.citadel.org\" "
285                 "title=\"Find out more about Citadel\" target=\"aboutcit\" "
286                 "onMouseOver=\"window.status='Find out more about "
287                 "Citadel'; return true;\">powered by<br /><IMG "
288                 "BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
289                 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\">"
290                 "<br />CITADEL</A>"
291                 "</div></li>\n"
292         );
293
294         wprintf("</ul>\n"
295                 "</div>\n");
296 }
297
298
299
300 void display_customize_iconbar(void) {
301         char iconbar[SIZ];
302         char buf[SIZ];
303         char key[SIZ], value[SIZ];
304         int i;
305
306         /* The initialized values of these variables also happen to
307          * specify the default values for users who haven't customized
308          * their iconbars.  These should probably be set in a master
309          * configuration somewhere.
310          */
311         int ib_displayas = IB_PICTEXT;  /* pictures and text, pictures, text */
312         int ib_logo = 0;        /* Site logo */
313         int ib_summary = 1;     /* Summary page icon */
314         int ib_inbox = 1;       /* Inbox icon */
315         int ib_calendar = 1;    /* Calendar icon */
316         int ib_contacts = 1;    /* Contacts icon */
317         int ib_notes = 1;       /* Notes icon */
318         int ib_tasks = 1;       /* Tasks icon */
319         int ib_rooms = 1;       /* Rooms icon */
320         int ib_users = 1;       /* Users icon */
321         int ib_chat = 1;        /* Chat icon */
322         int ib_advanced = 1;    /* Advanced Options icon */
323         int ib_logoff = 1;      /* Logoff button */
324         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
325         /*
326          */
327
328         get_preference("iconbar", iconbar);
329         for (i=0; i<num_tokens(iconbar, ','); ++i) {
330                 extract_token(buf, iconbar, i, ',');
331                 extract_token(key, buf, 0, '=');
332                 extract_token(value, buf, 1, '=');
333
334                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
335                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
336                 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
337                 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
338                 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
339                 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
340                 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
341                 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
342                 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
343                 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
344                 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
345                 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
346                 if (!strcasecmp(key, "ib_logoff")) ib_logoff = atoi(value);
347                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
348         }
349
350         output_headers(1, 1, 2, 0, 0, 0, 0);
351         wprintf("<div id=\"banner\">\n"
352                 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
353                 "<SPAN CLASS=\"titlebar\">Customize the icon bar</SPAN>"
354                 "</TD></TR></TABLE>\n"
355                 "</div>\n<div id=\"content\">\n"
356         );
357
358         wprintf("<center><table border=0 width=99%% bgcolor=\"#ffffff\"><tr><td>");
359
360         wprintf("<FORM METHOD=\"POST\" ACTION=\"/commit_iconbar\">\n");
361
362         wprintf("<CENTER>"
363                 "Display icons as: ");
364         for (i=0; i<=2; ++i) {
365                 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
366                 if (ib_displayas == i) wprintf(" CHECKED");
367                 wprintf(">");
368                 if (i == IB_PICTEXT) wprintf("pictures and text");
369                 if (i == IB_PICONLY) wprintf("pictures only");
370                 if (i == IB_TEXTONLY) wprintf("text only");
371                 wprintf("\n");
372         }
373         wprintf("<br /><br />\n");
374
375         wprintf("Select the icons you would like to see displayed "
376                 "in the &quot;icon bar&quot; menu on the left side of the "
377                 "screen.</CENTER><br />\n"
378         );
379
380         wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
381
382         wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
383                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
384                 "</TD><TD>"
385                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
386                 "SRC=\"/image&name=hello\" ALT=\"&nbsp;\">"
387                 "</TD><TD>"
388                 "<B>Site logo</B><br />"
389                 "A graphic describing this site"
390                 "</TD></TR>\n",
391                 (ib_logo ? "CHECKED" : "")
392         );
393
394         wprintf("<TR><TD>"
395                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
396                 "</TD><TD>"
397                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
398                 "SRC=\"/static/summary.gif\" ALT=\"&nbsp;\">"
399                 "</TD><TD>"
400                 "<B>Summary</B><br />"
401                 "Your summary page"
402                 "</TD></TR>\n",
403                 (ib_summary ? "CHECKED" : "")
404         );
405
406         wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
407                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
408                 "</TD><TD>"
409                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
410                 "SRC=\"/static/mail.gif\" ALT=\"&nbsp;\">"
411                 "</TD><TD>"
412                 "<B>Mail (inbox)</B><br />"
413                 "A shortcut to your e-mail Inbox."
414                 "</TD></TR>\n",
415                 (ib_inbox ? "CHECKED" : "")
416         );
417
418         wprintf("<TR><TD>"
419                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
420                 "VALUE=\"yes\" %s>"
421                 "</TD><TD>"
422                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
423                 "SRC=\"/static/vcard.gif\" ALT=\"&nbsp;\">"
424                 "</TD><TD>"
425                 "<B>Contacts</B><br />"
426                 "Your personal address book."
427                 "</TD></TR>\n",
428                 (ib_contacts ? "CHECKED" : "")
429         );
430
431         wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
432                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
433                 "VALUE=\"yes\" %s>"
434                 "</TD><TD>"
435                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
436                 "SRC=\"/static/note.gif\" ALT=\"&nbsp;\">"
437                 "</TD><TD>"
438                 "<B>Notes</B><br />"
439                 "Your personal notes."
440                 "</TD></TR>\n",
441                 (ib_notes ? "CHECKED" : "")
442         );
443
444 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
445         wprintf("<TR><TD>"
446                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
447                 "VALUE=\"yes\" %s>"
448                 "</TD><TD>"
449                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
450                 "SRC=\"/static/vcalendar.gif\" ALT=\"&nbsp;\">"
451                 "</TD><TD>"
452                 "<B>Calendar</B><br />"
453                 "A shortcut to your personal calendar."
454                 "</TD></TR>\n",
455                 (ib_calendar ? "CHECKED" : "")
456         );
457
458         wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
459                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
460                 "</TD><TD>"
461                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
462                 "SRC=\"/static/vcalendar.gif\" ALT=\"&nbsp;\">"
463                 "</TD><TD>"
464                 "<B>Tasks</B><br />"
465                 "A shortcut to your personal task list."
466                 "</TD></TR>\n",
467                 (ib_tasks ? "CHECKED" : "")
468         );
469 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
470
471         wprintf("<TR><TD>"
472                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
473                 "</TD><TD>"
474                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
475                 "SRC=\"/static/rooms-icon.gif\" ALT=\"&nbsp;\">"
476                 "</TD><TD>"
477                 "<B>Rooms</B><br />"
478                 "Clicking this icon displays a list of all accesible "
479                 "rooms (or folders) available."
480                 "</TD></TR>\n",
481                 (ib_rooms ? "CHECKED" : "")
482         );
483
484         wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
485                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
486                 "</TD><TD>"
487                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
488                 "SRC=\"/static/users-icon.gif\" ALT=\"&nbsp;\">"
489                 "</TD><TD>"
490                 "<B>Users</B><br />"
491                 "Clicking this icon displays a list of all users "
492                 "currently logged in."
493                 "</TD></TR>\n",
494                 (ib_users ? "CHECKED" : "")
495         );
496
497         wprintf("<TR><TD>"
498                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
499                 "</TD><TD>"
500                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
501                 "SRC=\"/static/chat-icon.gif\" ALT=\"&nbsp;\">"
502                 "</TD><TD>"
503                 "<B>Chat</B><br />"
504                 "Clicking this icon enters real-time chat mode "
505                 "with other users in the same room."
506                 "</TD></TR>\n",
507                 (ib_chat ? "CHECKED" : "")
508         );
509
510         wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
511                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
512                 "VALUE=\"yes\" %s>"
513                 "</TD><TD>"
514                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
515                 "SRC=\"/static/advanced-icon.gif\" ALT=\"&nbsp;\">"
516                 "</TD><TD>"
517                 "<B>Advanced options</B><br />"
518                 "Access to the complete menu of Citadel functions."
519                 "</TD></TR>\n",
520                 (ib_advanced ? "CHECKED" : "")
521         );
522
523         wprintf("<TR><TD>"
524                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
525                 "VALUE=\"yes\" %s>"
526                 "</TD><TD>"
527                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
528                 "SRC=\"/static/exit-icon.gif\" ALT=\"&nbsp;\">"
529                 "</TD><TD>"
530                 "<B>Log off</B><br />"
531                 "Exit from the Citadel system.  If you remove this icon "
532                 "then you will have no way out!"
533                 "</TD></TR>\n",
534                 (ib_logoff ? "CHECKED" : "")
535         );
536         wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
537                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
538                 "VALUE=\"yes\" %s>"
539                 "</TD><TD>"
540                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
541                 "SRC=\"/static/citadel-logo.gif\" ALT=\"&nbsp;\">"
542                 "</TD><TD>"
543                 "<B>Citadel logo</B><br />"
544                 "Displays the &quot;Powered by Citadel&quot; graphic"
545                 "</TD></TR>\n",
546                 (ib_citadel ? "CHECKED" : "")
547         );
548
549         wprintf("</TABLE><br />\n"
550                 "<CENTER>"
551                 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
552                 "&nbsp;"
553                 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
554                 "</CENTER></FORM>\n"
555         );
556
557         wprintf("</td></tr></table></center>\n");
558         wDumpContent(2);
559 }
560
561
562 void commit_iconbar(void) {
563         char iconbar[SIZ];
564         int i;
565
566         char *boxen[] = {
567                 "ib_logo",
568                 "ib_summary",
569                 "ib_inbox",
570                 "ib_calendar",
571                 "ib_contacts",
572                 "ib_notes",
573                 "ib_tasks",
574                 "ib_rooms",
575                 "ib_users",
576                 "ib_chat",
577                 "ib_advanced",
578                 "ib_logoff",
579                 "ib_citadel"
580         };
581
582         if (strcmp(bstr("sc"), "OK")) {
583                 display_main_menu();
584                 return;
585         }
586
587         sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
588
589         for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
590                 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
591                 if (!strcasecmp(bstr(boxen[i]), "yes")) {
592                         sprintf(&iconbar[strlen(iconbar)], "1");
593                 }
594                 else {
595                         sprintf(&iconbar[strlen(iconbar)], "0");
596                 }
597         }
598
599         set_preference("iconbar", iconbar);
600
601         output_headers(1, 1, 0, 0, 0, 0, 0);
602         wprintf(
603                 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
604                 "<IMG SRC=\"/static/advanced-icon.gif\">"
605                 "&nbsp;"
606                 "Your icon bar has been updated.  Please select any of its "
607                 "choices to continue."
608                 "</td></tr></table>\n"
609         );
610         wDumpContent(2);
611 }