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