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