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