* 'whobbs' is now 'who'
[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\" width=\"48\" height=\"48\" "
102                 "SRC=\"/static/citadel-logo.gif\" ALT=\"CITADEL\">"
103                 "CITADEL</A>"
104                 "</div></li>\n"
105         );
106
107
108         if (ib_summary) {
109                 wprintf("<li><A HREF=\"/summary\" "
110                         "TITLE=\"Your summary page\" "
111                         ">"
112                 );
113                 if (ib_displayas != IB_TEXTONLY) {
114                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
115                                 "SRC=\"/static/summscreen_32x.gif\">");
116                 }
117                 if (ib_displayas != IB_PICONLY) {
118                         wprintf("Summary");
119                 }
120                 wprintf("</A></li>\n");
121         }
122
123         if (ib_inbox) {
124                 wprintf("<li>"
125                         "<A HREF=\"/dotgoto?room=_MAIL_\" "
126                         "TITLE=\"Go to your e-mail inbox\" "
127                         ">"
128                 );
129                 if (ib_displayas != IB_TEXTONLY) {
130                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
131                                 "SRC=\"/static/privatemess_32x.gif\">");
132                 }
133                 if (ib_displayas != IB_PICONLY) {
134                         wprintf("Mail");
135                 }
136                 wprintf("</A></li>\n");
137         }
138
139         if (ib_calendar) {
140                 wprintf("<li>"
141                         "<A HREF=\"/dotgoto?room=Calendar\" "
142                         "TITLE=\"Go to your personal calendar\" "
143                         ">"
144                 );
145                 if (ib_displayas != IB_TEXTONLY) {
146                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
147                         "SRC=\"/static/calarea_32x.gif\">");
148                 }
149                 if (ib_displayas != IB_PICONLY) {
150                         wprintf("Calendar");
151                 }
152                 wprintf("</A></li>\n");
153         }
154
155         if (ib_contacts) {
156                 wprintf("<li>"
157                         "<A HREF=\"/dotgoto?room=Contacts\" "
158                         "TITLE=\"Go to your personal address book\" "
159                         ">"
160                 );
161                 if (ib_displayas != IB_TEXTONLY) {
162                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
163                         "SRC=\"/static/viewcontacts_32x.gif\">");
164                 }
165                 if (ib_displayas != IB_PICONLY) {
166                         wprintf("Contacts");
167                 }
168                 wprintf("</A></li>\n");
169         }
170
171         if (ib_notes) {
172                 wprintf("<li>"
173                         "<A HREF=\"/dotgoto?room=Notes\" "
174                         "TITLE=\"Go to your personal notes\" "
175                         ">"
176                 );
177                 if (ib_displayas != IB_TEXTONLY) {
178                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
179                         "SRC=\"/static/storenotes_32x.gif\">");
180                 }
181                 if (ib_displayas != IB_PICONLY) {
182                         wprintf("Notes");
183                 }
184                 wprintf("</A></li>\n");
185         }
186
187         if (ib_tasks)  {
188                 wprintf("<li>"
189                         "<A HREF=\"/dotgoto?room=Tasks\" "
190                         "TITLE=\"Go to your personal task list\" "
191                         ">"
192                 );
193                 if (ib_displayas != IB_TEXTONLY) {
194                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
195                         "SRC=\"/static/taskmanag_32x.gif\">");
196                 }
197                 if (ib_displayas != IB_PICONLY) {
198                         wprintf("Tasks");
199                 }
200                 wprintf("</A></li>\n");
201         }
202
203         if (ib_rooms) {
204                 wprintf("<li>"
205                         "<A HREF=\"/knrooms\" TITLE=\"List all of your "
206                         "accessible rooms\" >"
207                 );
208                 if (ib_displayas != IB_TEXTONLY) {
209                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
210                         "SRC=\"/static/chatrooms_32x.gif\">");
211                 }
212                 if (ib_displayas != IB_PICONLY) {
213                         wprintf("Rooms");
214                 }
215                 wprintf("</A></li>\n");
216         }
217
218         if (ib_users) {
219                 wprintf("<li>"
220                         "<A HREF=\"/who\" TITLE=\"See who is online right now\" "
221                         ">"
222                 );
223                 if (ib_displayas != IB_TEXTONLY) {
224                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
225                         "SRC=\"/static/usermanag_32x.gif\">");
226                 }
227                 if (ib_displayas != IB_PICONLY) {
228                         wprintf("Who is online?");
229                 }
230                 wprintf("</A></li>\n");
231         }
232
233         if (ib_chat) {
234                 wprintf("<li>"
235                         "<A HREF=\"#\" onClick=\"window.open('/chat', "
236                         "'ctdl_chat_window', "
237                         "'toolbar=no,location=no,directories=no,copyhistory=no,"
238                         "status=no,scrollbars=yes,resizable=yes');\""
239                         ">"
240                 );
241                 if (ib_displayas != IB_TEXTONLY) {
242                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
243                         "SRC=\"/static/citadelchat_32x.gif\">");
244                 }
245                 if (ib_displayas != IB_PICONLY) {
246                         wprintf("Chat");
247                 }
248                 wprintf("</A></li>\n");
249         }
250
251         if (ib_advanced) {
252                 wprintf("<li>"
253                         "<A HREF=\"/display_main_menu\" "
254                         "TITLE=\"Advanced Options Menu: Advanced Room commands, "
255                         "Account Info, and Chat\" "
256                         ">"
257                 );
258                 if (ib_displayas != IB_TEXTONLY) {
259                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
260                         "SRC=\"/static/advanpage2_32x.gif\">");
261                 }
262                 if (ib_displayas != IB_PICONLY) {
263                         wprintf("Advanced");
264                 }
265                 wprintf("</A></li>\n");
266         }
267
268         if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
269                 wprintf("<li>"
270                         "<A HREF=\"/display_aide_menu\" "
271                         "TITLE=\"Room and system administration functions\" "
272                         ">"
273                 );
274                 if (ib_displayas != IB_TEXTONLY) {
275                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
276                         "SRC=\"/static/advanpage2_32x.gif\">");
277                 }
278                 if (ib_displayas != IB_PICONLY) {
279                         wprintf("Administration");
280                 }
281                 wprintf("</A></li>\n");
282         }
283
284         if (1) {
285                 wprintf("<li>"
286                         "<A HREF=\"/termquit\" TITLE=\"Log off\" "
287                         "onClick=\"return confirm('Log off now?');\">"
288                 );
289                 if (ib_displayas != IB_TEXTONLY) {
290                 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
291                         "SRC=\"/static/logoff_32x.gif\">");
292                 }
293                 if (ib_displayas != IB_PICONLY) {
294                         wprintf("Log off");
295                 }
296                 wprintf("</A></li>\n");
297         }
298
299         wprintf(
300                 "<li><div align=\"center\">"
301                 "<A HREF=\"/display_customize_iconbar\" "
302                 "TITLE=\"Customize this menu\" "
303                 ">customize this menu"
304                 "</A></div></li>\n"
305         );
306
307         wprintf("</ul>\n"
308                 "</div>\n");
309 }
310
311
312
313 void display_customize_iconbar(void) {
314         char iconbar[SIZ];
315         char buf[SIZ];
316         char key[SIZ], value[SIZ];
317         int i;
318         int bar = 0;
319
320         /* The initialized values of these variables also happen to
321          * specify the default values for users who haven't customized
322          * their iconbars.  These should probably be set in a master
323          * configuration somewhere.
324          */
325         int ib_displayas = IB_PICTEXT;  /* pictures and text, pictures, text */
326         int ib_logo = 0;        /* Site logo */
327         int ib_summary = 1;     /* Summary page icon */
328         int ib_inbox = 1;       /* Inbox icon */
329         int ib_calendar = 1;    /* Calendar icon */
330         int ib_contacts = 1;    /* Contacts icon */
331         int ib_notes = 1;       /* Notes icon */
332         int ib_tasks = 1;       /* Tasks icon */
333         int ib_rooms = 1;       /* Rooms icon */
334         int ib_users = 1;       /* Users icon */
335         int ib_chat = 1;        /* Chat icon */
336         int ib_advanced = 1;    /* Advanced Options icon */
337         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
338         /*
339          */
340
341         get_preference("iconbar", iconbar, sizeof iconbar);
342         for (i=0; i<num_tokens(iconbar, ','); ++i) {
343                 extract_token(buf, iconbar, i, ',', sizeof buf);
344                 extract_token(key, buf, 0, '=', sizeof key);
345                 extract_token(value, buf, 1, '=', sizeof value);
346
347                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
348                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
349                 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
350                 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
351                 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
352                 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
353                 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
354                 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
355                 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
356                 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
357                 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
358                 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
359                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
360         }
361
362         output_headers(1, 1, 2, 0, 0, 0, 0);
363         wprintf("<div id=\"banner\">\n"
364                 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
365                 "<SPAN CLASS=\"titlebar\">Customize the icon bar</SPAN>"
366                 "</TD></TR></TABLE>\n"
367                 "</div>\n<div id=\"content\">\n"
368         );
369
370         wprintf("<div id=\"fix_scrollbar_bug\">"
371                 "<table border=0 width=100%% 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                 "An icon 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/summscreen_48x.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/privatemess_48x.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/viewcontacts_48x.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/storenotes_48x.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/calarea_48x.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/taskmanag_48x.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/chatrooms_48x.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/usermanag_48x.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/citadelchat_48x.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/advanpage2_48x.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; icon"
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></div>\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, 1);
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/advanpage2_48x.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 }