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