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