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