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