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