* Set up a toggleable iconbar that can switch between the menu and a room
[citadel.git] / webcit / iconbar.c
1 /*
2  * $Id$
3  *
4  * Displays and customizes the iconbar.
5  */
6
7 #include "webcit.h"
8
9
10 /* Values for ib_displayas */
11 #define IB_PICTEXT      0
12 #define IB_PICONLY      1
13 #define IB_TEXTONLY     2
14
15
16 void do_iconbar(void) {
17         char iconbar[SIZ];
18         char buf[SIZ];
19         char key[SIZ], value[SIZ];
20         int i;
21
22         /* The initialized values of these variables also happen to
23          * specify the default values for users who haven't customized
24          * their iconbars.  These should probably be set in a master
25          * configuration somewhere.
26          */
27         int ib_displayas = 0;   /* pictures and text, pictures, text */
28         int ib_logo = 0;        /* Site logo */
29         int ib_summary = 1;     /* Summary page icon */
30         int ib_inbox = 1;       /* Inbox icon */
31         int ib_calendar = 1;    /* Calendar icon */
32         int ib_contacts = 1;    /* Contacts icon */
33         int ib_notes = 1;       /* Notes icon */
34         int ib_tasks = 1;       /* Tasks icon */
35         int ib_rooms = 1;       /* Rooms icon */
36         int ib_users = 1;       /* Users icon */
37         int ib_chat = 1;        /* Chat icon */
38         int ib_advanced = 1;    /* Advanced Options icon */
39         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
40         /*
41          */
42
43         get_preference("iconbar", iconbar, sizeof iconbar);
44         for (i=0; i<num_tokens(iconbar, ','); ++i) {
45                 extract_token(buf, iconbar, i, ',', sizeof buf);
46                 extract_token(key, buf, 0, '=', sizeof key);
47                 extract_token(value, buf, 1, '=', sizeof value);
48
49                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
50                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
51                 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
52                 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
53                 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
54                 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
55                 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
56                 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
57                 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
58                 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
59                 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
60                 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
61                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
62         }
63
64         wprintf("<div id=\"button\">\n"
65                 "<ul>\n"
66         );
67
68         if (ib_logo) {
69                 wprintf("<li>");
70                 if (ib_displayas != IB_TEXTONLY) {
71                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
72                                 "HEIGHT=\"32\" src=\"image&name=hello\" ALT=\"&nbsp;\">\n"
73                         );
74                 }
75                 wprintf("</li>\n");
76         }
77
78         if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
79                 "<li><div align=\"center\">"
80                 "<a href=\"http://www.citadel.org\" "
81                 "title=\"%s\" target=\"aboutcit\">"
82                 "<img border=\"0\" "
83                 "src=\"static/citadel-logo.gif\" ALT=\"%s\"></a>"
84                 "</div></li>\n",
85                 _("Find out more about Citadel"),
86                 _("CITADEL")
87         );
88
89         wprintf("<li><a href=\"javascript:switch_to_room_list()\">switch to room list</a>\n");
90
91         if (ib_summary) {
92                 wprintf("<li><a href=\"summary\" "
93                         "TITLE=\"%s\" "
94                         ">", _("Your summary page")
95                 );
96                 if (ib_displayas != IB_TEXTONLY) {
97                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
98                                 "src=\"static/summscreen_32x.gif\">");
99                 }
100                 if (ib_displayas != IB_PICONLY) {
101                         wprintf(_("Summary"));
102                 }
103                 wprintf("</A></li>\n");
104         }
105
106         if (ib_inbox) {
107                 wprintf("<li>"
108                         "<a href=\"dotgoto?room=_MAIL_\" "
109                         "TITLE=\"%s\" "
110                         ">",
111                         _("Go to your email inbox")
112                 );
113                 if (ib_displayas != IB_TEXTONLY) {
114                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
115                                 "src=\"static/privatemess_32x.gif\">");
116                 }
117                 if (ib_displayas != IB_PICONLY) {
118                         wprintf(_("Mail"));
119                         if (WC->new_mail != WC->remember_new_mail) {
120 /*
121                                 if (WC->new_mail > 0) {
122                                         wprintf(" <b>(%d)</b>", WC->new_mail);
123                                 }
124 */
125                                 WC->remember_new_mail = WC->new_mail;
126                         }
127                 }
128                 wprintf("</A></li>\n");
129         }
130
131         if (ib_calendar) {
132                 wprintf("<li>"
133                         "<a href=\"dotgoto?room=_CALENDAR_\" "
134                         "TITLE=\"%s\" "
135                         ">",
136                         _("Go to your personal calendar")
137                 );
138                 if (ib_displayas != IB_TEXTONLY) {
139                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
140                         "src=\"static/calarea_32x.gif\">");
141                 }
142                 if (ib_displayas != IB_PICONLY) {
143                         wprintf(_("Calendar"));
144                 }
145                 wprintf("</A></li>\n");
146         }
147
148         if (ib_contacts) {
149                 wprintf("<li>"
150                         "<a href=\"dotgoto?room=_CONTACTS_\" "
151                         "TITLE=\"%s\" "
152                         ">",
153                         _("Go to your personal address book")
154                 );
155                 if (ib_displayas != IB_TEXTONLY) {
156                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
157                         "src=\"static/viewcontacts_32x.gif\">");
158                 }
159                 if (ib_displayas != IB_PICONLY) {
160                         wprintf(_("Contacts"));
161                 }
162                 wprintf("</A></li>\n");
163         }
164
165         if (ib_notes) {
166                 wprintf("<li>"
167                         "<a href=\"dotgoto?room=_NOTES_\" "
168                         "TITLE=\"%s\" "
169                         ">",
170                         _("Go to your personal notes")
171                 );
172                 if (ib_displayas != IB_TEXTONLY) {
173                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
174                         "src=\"static/storenotes_32x.gif\">");
175                 }
176                 if (ib_displayas != IB_PICONLY) {
177                         wprintf(_("Notes"));
178                 }
179                 wprintf("</A></li>\n");
180         }
181
182         if (ib_tasks)  {
183                 wprintf("<li>"
184                         "<a href=\"dotgoto?room=_TASKS_\" "
185                         "TITLE=\"%s\" "
186                         ">",
187                         _("Go to your personal task list")
188                 );
189                 if (ib_displayas != IB_TEXTONLY) {
190                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
191                         "src=\"static/taskmanag_32x.gif\">");
192                 }
193                 if (ib_displayas != IB_PICONLY) {
194                         wprintf(_("Tasks"));
195                 }
196                 wprintf("</A></li>\n");
197         }
198
199         if (ib_rooms) {
200                 wprintf("<li>"
201                         "<a href=\"knrooms\" TITLE=\"%s\" >",
202                         _("List all of your accessible rooms")
203                 );
204                 if (ib_displayas != IB_TEXTONLY) {
205                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
206                         "src=\"static/chatrooms_32x.gif\">");
207                 }
208                 if (ib_displayas != IB_PICONLY) {
209                         wprintf(_("Rooms"));
210                 }
211                 wprintf("</A></li>\n");
212         }
213
214         if (ib_users) {
215                 wprintf("<li>"
216                         "<a href=\"who\" TITLE=\"%s\" "
217                         ">",
218                         _("See who is online right now")
219                 );
220                 if (ib_displayas != IB_TEXTONLY) {
221                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
222                         "src=\"static/usermanag_32x.gif\">");
223                 }
224                 if (ib_displayas != IB_PICONLY) {
225                         wprintf(_("Who is online?"));
226                 }
227                 wprintf("</A></li>\n");
228         }
229
230         if (ib_chat) {
231                 wprintf("<li>"
232                         "<a href=\"#\" onClick=\"window.open('chat', "
233                         "'ctdl_chat_window', "
234                         "'toolbar=no,location=no,directories=no,copyhistory=no,"
235                         "status=no,scrollbars=yes,resizable=yes');\""
236                         ">"
237                 );
238                 if (ib_displayas != IB_TEXTONLY) {
239                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
240                         "src=\"static/citadelchat_32x.gif\">");
241                 }
242                 if (ib_displayas != IB_PICONLY) {
243                         wprintf(_("Chat"));
244                 }
245                 wprintf("</A></li>\n");
246         }
247
248         if (ib_advanced) {
249                 wprintf("<li>"
250                         "<a href=\"display_main_menu\" "
251                         "TITLE=\"%s\" "
252                         ">",
253                         _("Advanced Options Menu: Advanced Room commands, Account Info, and Chat")
254                 );
255                 if (ib_displayas != IB_TEXTONLY) {
256                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
257                         "src=\"static/advanpage2_32x.gif\">");
258                 }
259                 if (ib_displayas != IB_PICONLY) {
260                         wprintf(_("Advanced"));
261                 }
262                 wprintf("</A></li>\n");
263         }
264
265         if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
266                 wprintf("<li>"
267                         "<a href=\"display_aide_menu\" "
268                         "TITLE=\"%s\" "
269                         ">",
270                         _("Room and system administration functions")
271                 );
272                 if (ib_displayas != IB_TEXTONLY) {
273                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
274                         "src=\"static/advanpage2_32x.gif\">");
275                 }
276                 if (ib_displayas != IB_PICONLY) {
277                         wprintf(_("Administration"));
278                 }
279                 wprintf("</A></li>\n");
280         }
281
282         if (1) {
283                 wprintf("<li>"
284                         "<a href=\"termquit\" TITLE=\"%s\" "
285                         "onClick=\"return confirm('%s');\">",
286                         _("Log off"),
287                         _("Log off now?")
288                         
289                 );
290                 if (ib_displayas != IB_TEXTONLY) {
291                 wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
292                         "src=\"static/logoff_32x.gif\">");
293                 }
294                 if (ib_displayas != IB_PICONLY) {
295                         wprintf(_("Log off"));
296                 }
297                 wprintf("</A></li>\n");
298         }
299
300         wprintf(
301                 "<li><div align=\"center\">"
302                 "<a href=\"display_customize_iconbar\" "
303                 "TITLE=\"%s\" "
304                 ">%s"
305                 "</A></div></li>\n",
306                 _("Customize this menu"),
307                 _("customize this menu")
308         );
309
310         wprintf("</ul>\n");
311
312         wprintf("<div id=\"dropstuff\" style=\"font-size:6pt\">");
313         wprintf("Drag to trash here...<br>");
314         wprintf("</div>");
315
316         wprintf("</div>\n");
317 }
318
319
320 /*
321  * If the user has toggled the icon bar over to a room list, here's where
322  * we generate its innerHTML...
323  */
324 void do_iconbar_roomlist(void) {
325         char iconbar[SIZ];
326         char buf[SIZ];
327         char key[SIZ], value[SIZ];
328         int i;
329
330         /* The initialized values of these variables also happen to
331          * specify the default values for users who haven't customized
332          * their iconbars.  These should probably be set in a master
333          * configuration somewhere.
334          */
335         int ib_displayas = 0;   /* pictures and text, pictures, text */
336         int ib_logo = 0;        /* Site logo */
337         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
338         /*
339          */
340
341         get_preference("iconbar", iconbar, sizeof iconbar);
342         for (i=0; i<num_tokens(iconbar, ','); ++i) {
343                 extract_token(buf, iconbar, i, ',', sizeof buf);
344                 extract_token(key, buf, 0, '=', sizeof key);
345                 extract_token(value, buf, 1, '=', sizeof value);
346
347                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
348                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
349                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
350         }
351
352         wprintf("<div id=\"button\">\n"
353                 "<ul>\n"
354         );
355
356         if (ib_logo) {
357                 wprintf("<li>");
358                 if (ib_displayas != IB_TEXTONLY) {
359                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
360                                 "HEIGHT=\"32\" src=\"image&name=hello\" ALT=\"&nbsp;\">\n"
361                         );
362                 }
363                 wprintf("</li>\n");
364         }
365
366         if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
367                 "<li><div align=\"center\">"
368                 "<a href=\"http://www.citadel.org\" "
369                 "title=\"%s\" target=\"aboutcit\">"
370                 "<img border=\"0\" "
371                 "src=\"static/citadel-logo.gif\" ALT=\"%s\"></a>"
372                 "</div></li>\n",
373                 _("Find out more about Citadel"),
374                 _("CITADEL")
375         );
376
377         wprintf("<li><a href=\"javascript:switch_to_menu_buttons()\">back to menu...</a>");
378         
379         wprintf("</ul>\n");
380
381         wprintf("<br><br>Room list<br>will be<br>here<br><br>");
382
383         wprintf("<div id=\"dropstuff\" style=\"font-size:6pt\">");
384         wprintf("Drag to trash here...<br>");
385         wprintf("</div>");
386
387         wprintf("</div>\n");
388 }
389
390
391
392 void display_customize_iconbar(void) {
393         char iconbar[SIZ];
394         char buf[SIZ];
395         char key[SIZ], value[SIZ];
396         int i;
397         int bar = 0;
398
399         /* The initialized values of these variables also happen to
400          * specify the default values for users who haven't customized
401          * their iconbars.  These should probably be set in a master
402          * configuration somewhere.
403          */
404         int ib_displayas = IB_PICTEXT;  /* pictures and text, pictures, text */
405         int ib_logo = 0;        /* Site logo */
406         int ib_summary = 1;     /* Summary page icon */
407         int ib_inbox = 1;       /* Inbox icon */
408         int ib_calendar = 1;    /* Calendar icon */
409         int ib_contacts = 1;    /* Contacts icon */
410         int ib_notes = 1;       /* Notes icon */
411         int ib_tasks = 1;       /* Tasks icon */
412         int ib_rooms = 1;       /* Rooms icon */
413         int ib_users = 1;       /* Users icon */
414         int ib_chat = 1;        /* Chat icon */
415         int ib_advanced = 1;    /* Advanced Options icon */
416         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
417         /*
418          */
419
420         get_preference("iconbar", iconbar, sizeof iconbar);
421         for (i=0; i<num_tokens(iconbar, ','); ++i) {
422                 extract_token(buf, iconbar, i, ',', sizeof buf);
423                 extract_token(key, buf, 0, '=', sizeof key);
424                 extract_token(value, buf, 1, '=', sizeof value);
425
426                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
427                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
428                 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
429                 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
430                 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
431                 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
432                 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
433                 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
434                 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
435                 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
436                 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
437                 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
438                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
439         }
440
441         output_headers(1, 1, 2, 0, 0, 0);
442         wprintf("<div id=\"banner\">\n"
443                 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
444                 "<SPAN CLASS=\"titlebar\">");
445         wprintf(_("Customize the icon bar"));
446         wprintf("</SPAN>"
447                 "</TD></TR></TABLE>\n"
448                 "</div>\n<div id=\"content\">\n"
449         );
450
451         wprintf("<div id=\"fix_scrollbar_bug\">"
452                 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
453
454         wprintf("<FORM METHOD=\"POST\" action=\"commit_iconbar\">\n");
455
456         wprintf("<CENTER>");
457         wprintf(_("Display icons as:"));
458         wprintf(" ");
459         for (i=0; i<=2; ++i) {
460                 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
461                 if (ib_displayas == i) wprintf(" CHECKED");
462                 wprintf(">");
463                 if (i == IB_PICTEXT)    wprintf(_("pictures and text"));
464                 if (i == IB_PICONLY)    wprintf(_("pictures only"));
465                 if (i == IB_TEXTONLY)   wprintf(_("text only"));
466                 wprintf("\n");
467         }
468         wprintf("<br /><br />\n");
469
470         wprintf(_("Select the icons you would like to see displayed "
471                 "in the 'icon bar' menu on the left side of the "
472                 "screen."));
473         wprintf("</CENTER><br />\n");
474
475         wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
476
477         wprintf("<TR BGCOLOR=%s><TD>"
478                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
479                 "</TD><TD>"
480                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
481                 "src=\"image&name=hello\" ALT=\"&nbsp;\">"
482                 "</TD><TD>"
483                 "<B>%s</B><br />"
484                 "%s"
485                 "</TD></TR>\n",
486                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
487                 (ib_logo ? "CHECKED" : ""),
488                 _("Site logo"),
489                 _("An icon describing this site")
490         );
491
492         wprintf("<TR bgcolor=%s><TD>"
493                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
494                 "</TD><TD>"
495                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
496                 "src=\"static/summscreen_48x.gif\" ALT=\"&nbsp;\">"
497                 "</TD><TD>"
498                 "<B>%s</B><br />"
499                 "%s"
500                 "</TD></TR>\n",
501                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
502                 (ib_summary ? "CHECKED" : ""),
503                 _("Summary"),
504                 _("Your summary page")
505         );
506
507         wprintf("<TR bgcolor=%s><TD>"
508                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
509                 "</TD><TD>"
510                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
511                 "src=\"static/privatemess_48x.gif\" ALT=\"&nbsp;\">"
512                 "</TD><TD>"
513                 "<B>%s</B><br />"
514                 "%s"
515                 "</TD></TR>\n",
516                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
517                 (ib_inbox ? "CHECKED" : ""),
518                 _("Mail (inbox)"),
519                 _("A shortcut to your email Inbox")
520         );
521
522         wprintf("<TR bgcolor=%s><TD>"
523                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
524                 "VALUE=\"yes\" %s>"
525                 "</TD><TD>"
526                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
527                 "src=\"static/viewcontacts_48x.gif\" ALT=\"&nbsp;\">"
528                 "</TD><TD>"
529                 "<B>%s</B><br />"
530                 "%s"
531                 "</TD></TR>\n",
532                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
533                 (ib_contacts ? "CHECKED" : ""),
534                 _("Contacts"),
535                 _("Your personal address book")
536         );
537
538         wprintf("<TR bgcolor=%s><TD>"
539                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
540                 "VALUE=\"yes\" %s>"
541                 "</TD><TD>"
542                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
543                 "src=\"static/storenotes_48x.gif\" ALT=\"&nbsp;\">"
544                 "</TD><TD>"
545                 "<B>%s</B><br />"
546                 "%s"
547                 "</TD></TR>\n",
548                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
549                 (ib_notes ? "CHECKED" : ""),
550                 _("Notes"),
551                 _("Your personal notes")
552         );
553
554 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
555         wprintf("<TR bgcolor=%s><TD>"
556                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
557                 "VALUE=\"yes\" %s>"
558                 "</TD><TD>"
559                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
560                 "src=\"static/calarea_48x.gif\" ALT=\"&nbsp;\">"
561                 "</TD><TD>"
562                 "<B>%s</B><br />"
563                 "%s"
564                 "</TD></TR>\n",
565                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
566                 (ib_calendar ? "CHECKED" : ""),
567                 _("Calendar"),
568                 _("A shortcut to your personal calendar")
569         );
570
571         wprintf("<TR bgcolor=%s><TD>"
572                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
573                 "</TD><TD>"
574                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
575                 "src=\"static/taskmanag_48x.gif\" ALT=\"&nbsp;\">"
576                 "</TD><TD>"
577                 "<B>%s</B><br />"
578                 "%s"
579                 "</TD></TR>\n",
580                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
581                 (ib_tasks ? "CHECKED" : ""),
582                 _("Tasks"),
583                 _("A shortcut to your personal task list")
584         );
585 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
586
587         wprintf("<TR bgcolor=%s><TD>"
588                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
589                 "</TD><TD>"
590                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
591                 "src=\"static/chatrooms_48x.gif\" ALT=\"&nbsp;\">"
592                 "</TD><TD>"
593                 "<B>%s</B><br />"
594                 "%s"
595                 "</TD></TR>\n",
596                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
597                 (ib_rooms ? "CHECKED" : ""),
598                 _("Rooms"),
599                 _("Clicking this icon displays a list of all accesible "
600                 "rooms (or folders) available.")
601         );
602
603         wprintf("<TR bgcolor=%s><TD>"
604                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
605                 "</TD><TD>"
606                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
607                 "src=\"static/usermanag_48x.gif\" ALT=\"&nbsp;\">"
608                 "</TD><TD>"
609                 "<B>%s</B><br />"
610                 "%s"
611                 "</TD></TR>\n",
612                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
613                 (ib_users ? "CHECKED" : ""),
614                 _("Who is online?"),
615                 _("Clicking this icon displays a list of all users "
616                 "currently logged in.")
617         );
618
619         wprintf("<TR bgcolor=%s><TD>"
620                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
621                 "</TD><TD>"
622                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
623                 "src=\"static/citadelchat_48x.gif\" ALT=\"&nbsp;\">"
624                 "</TD><TD>"
625                 "<B>%s</B><br />"
626                 "%s"
627                 "</TD></TR>\n",
628                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
629                 (ib_chat ? "CHECKED" : ""),
630                 _("Chat"),
631                 _("Clicking this icon enters real-time chat mode "
632                 "with other users in the same room.")
633                 
634         );
635
636         wprintf("<TR bgcolor=%s><TD>"
637                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
638                 "VALUE=\"yes\" %s>"
639                 "</TD><TD>"
640                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
641                 "src=\"static/advanpage2_48x.gif\" ALT=\"&nbsp;\">"
642                 "</TD><TD>"
643                 "<B>%s</B><br />"
644                 "%s"
645                 "</TD></TR>\n",
646                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
647                 (ib_advanced ? "CHECKED" : ""),
648                 _("Advanced options"),
649                 _("Access to the complete menu of Citadel functions.")
650
651         );
652
653         wprintf("<TR bgcolor=%s><TD>"
654                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
655                 "VALUE=\"yes\" %s>"
656                 "</TD><TD>"
657                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
658                 "src=\"static/citadel-logo.gif\" ALT=\"&nbsp;\">"
659                 "</TD><TD>"
660                 "<B>%s</B><br />"
661                 "%s"
662                 "</TD></TR>\n",
663                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
664                 (ib_citadel ? "CHECKED" : ""),
665                 _("Citadel logo"),
666                 _("Displays the 'Powered by Citadel' icon")
667         );
668
669         wprintf("</TABLE><br />\n"
670                 "<CENTER>"
671                 "<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
672                 "&nbsp;"
673                 "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
674                 "</CENTER></FORM>\n",
675                 _("Save changes"),
676                 _("Cancel")
677         );
678
679         wprintf("</td></tr></table></div>\n");
680         wDumpContent(2);
681 }
682
683
684 void commit_iconbar(void) {
685         char iconbar[SIZ];
686         int i;
687
688         char *boxen[] = {
689                 "ib_logo",
690                 "ib_summary",
691                 "ib_inbox",
692                 "ib_calendar",
693                 "ib_contacts",
694                 "ib_notes",
695                 "ib_tasks",
696                 "ib_rooms",
697                 "ib_users",
698                 "ib_chat",
699                 "ib_advanced",
700                 "ib_logoff",
701                 "ib_citadel"
702         };
703
704         if (strlen(bstr("ok_button")) == 0) {
705                 display_main_menu();
706                 return;
707         }
708
709         sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
710
711         for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
712                 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
713                 if (!strcasecmp(bstr(boxen[i]), "yes")) {
714                         sprintf(&iconbar[strlen(iconbar)], "1");
715                 }
716                 else {
717                         sprintf(&iconbar[strlen(iconbar)], "0");
718                 }
719         }
720
721         set_preference("iconbar", iconbar, 1);
722
723         output_headers(1, 1, 0, 0, 0, 0);
724         wprintf(
725                 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
726                 "<img src=\"static/advanpage2_48x.gif\">"
727                 "&nbsp;");
728         wprintf(_("Your icon bar has been updated.  Please select any of its "
729                 "choices to continue."));
730         wprintf("</td></tr></table>\n");
731         wDumpContent(2);
732 }
733