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