* Completed the JavaScript-detection of room names in the iconbar as drop
[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         /*
313         wprintf("<div id=\"dropstuff\" style=\"font-size:6pt\">");
314         wprintf("Drag to trash here...<br>");
315         wprintf("</div>");
316         */
317
318         wprintf("</div>\n");
319 }
320
321
322 /*
323  * If the user has toggled the icon bar over to a room list, here's where
324  * we generate its innerHTML...
325  */
326 void do_iconbar_roomlist(void) {
327         char iconbar[SIZ];
328         char buf[SIZ];
329         char key[SIZ], value[SIZ];
330         int i;
331
332         /* The initialized values of these variables also happen to
333          * specify the default values for users who haven't customized
334          * their iconbars.  These should probably be set in a master
335          * configuration somewhere.
336          */
337         int ib_displayas = 0;   /* pictures and text, pictures, text */
338         int ib_logo = 0;        /* Site logo */
339         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
340         /*
341          */
342
343         get_preference("iconbar", iconbar, sizeof iconbar);
344         for (i=0; i<num_tokens(iconbar, ','); ++i) {
345                 extract_token(buf, iconbar, i, ',', sizeof buf);
346                 extract_token(key, buf, 0, '=', sizeof key);
347                 extract_token(value, buf, 1, '=', sizeof value);
348
349                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
350                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
351                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
352         }
353
354         wprintf("<div id=\"button\">\n"
355                 "<ul>\n"
356         );
357
358         if (ib_logo) {
359                 wprintf("<li>");
360                 if (ib_displayas != IB_TEXTONLY) {
361                         wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" "
362                                 "HEIGHT=\"32\" src=\"image&name=hello\" ALT=\"&nbsp;\">\n"
363                         );
364                 }
365                 wprintf("</li>\n");
366         }
367
368         if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
369                 "<li><div align=\"center\">"
370                 "<a href=\"http://www.citadel.org\" "
371                 "title=\"%s\" target=\"aboutcit\">"
372                 "<img border=\"0\" "
373                 "src=\"static/citadel-logo.gif\" ALT=\"%s\"></a>"
374                 "</div></li>\n",
375                 _("Find out more about Citadel"),
376                 _("CITADEL")
377         );
378
379         wprintf("<li><a href=\"javascript:switch_to_menu_buttons()\">back to menu...</a>");
380         
381         wprintf("</ul>\n");
382
383         /* embed the room list */
384         list_all_rooms_by_floor("iconbar");
385
386         /*
387         wprintf("<div id=\"dropstuff\" style=\"font-size:6pt\">");
388         wprintf("Drag to trash here...<br>");
389         wprintf("</div>");
390         */
391
392         wprintf("</div>\n");
393 }
394
395
396
397 void display_customize_iconbar(void) {
398         char iconbar[SIZ];
399         char buf[SIZ];
400         char key[SIZ], value[SIZ];
401         int i;
402         int bar = 0;
403
404         /* The initialized values of these variables also happen to
405          * specify the default values for users who haven't customized
406          * their iconbars.  These should probably be set in a master
407          * configuration somewhere.
408          */
409         int ib_displayas = IB_PICTEXT;  /* pictures and text, pictures, text */
410         int ib_logo = 0;        /* Site logo */
411         int ib_summary = 1;     /* Summary page icon */
412         int ib_inbox = 1;       /* Inbox icon */
413         int ib_calendar = 1;    /* Calendar icon */
414         int ib_contacts = 1;    /* Contacts icon */
415         int ib_notes = 1;       /* Notes icon */
416         int ib_tasks = 1;       /* Tasks icon */
417         int ib_rooms = 1;       /* Rooms icon */
418         int ib_users = 1;       /* Users icon */
419         int ib_chat = 1;        /* Chat icon */
420         int ib_advanced = 1;    /* Advanced Options icon */
421         int ib_citadel = 1;     /* 'Powered by Citadel' logo */
422         /*
423          */
424
425         get_preference("iconbar", iconbar, sizeof iconbar);
426         for (i=0; i<num_tokens(iconbar, ','); ++i) {
427                 extract_token(buf, iconbar, i, ',', sizeof buf);
428                 extract_token(key, buf, 0, '=', sizeof key);
429                 extract_token(value, buf, 1, '=', sizeof value);
430
431                 if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
432                 if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
433                 if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
434                 if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
435                 if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
436                 if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
437                 if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
438                 if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
439                 if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
440                 if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
441                 if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
442                 if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
443                 if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
444         }
445
446         output_headers(1, 1, 2, 0, 0, 0);
447         wprintf("<div id=\"banner\">\n"
448                 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
449                 "<SPAN CLASS=\"titlebar\">");
450         wprintf(_("Customize the icon bar"));
451         wprintf("</SPAN>"
452                 "</TD></TR></TABLE>\n"
453                 "</div>\n<div id=\"content\">\n"
454         );
455
456         wprintf("<div id=\"fix_scrollbar_bug\">"
457                 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>");
458
459         wprintf("<FORM METHOD=\"POST\" action=\"commit_iconbar\">\n");
460
461         wprintf("<CENTER>");
462         wprintf(_("Display icons as:"));
463         wprintf(" ");
464         for (i=0; i<=2; ++i) {
465                 wprintf("<INPUT TYPE=\"radio\" NAME=\"ib_displayas\" VALUE=\"%d\"", i);
466                 if (ib_displayas == i) wprintf(" CHECKED");
467                 wprintf(">");
468                 if (i == IB_PICTEXT)    wprintf(_("pictures and text"));
469                 if (i == IB_PICONLY)    wprintf(_("pictures only"));
470                 if (i == IB_TEXTONLY)   wprintf(_("text only"));
471                 wprintf("\n");
472         }
473         wprintf("<br /><br />\n");
474
475         wprintf(_("Select the icons you would like to see displayed "
476                 "in the 'icon bar' menu on the left side of the "
477                 "screen."));
478         wprintf("</CENTER><br />\n");
479
480         wprintf("<TABLE border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
481
482         wprintf("<TR BGCOLOR=%s><TD>"
483                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_logo\" VALUE=\"yes\" %s>"
484                 "</TD><TD>"
485                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
486                 "src=\"image&name=hello\" ALT=\"&nbsp;\">"
487                 "</TD><TD>"
488                 "<B>%s</B><br />"
489                 "%s"
490                 "</TD></TR>\n",
491                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
492                 (ib_logo ? "CHECKED" : ""),
493                 _("Site logo"),
494                 _("An icon describing this site")
495         );
496
497         wprintf("<TR bgcolor=%s><TD>"
498                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_summary\" VALUE=\"yes\" %s>"
499                 "</TD><TD>"
500                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
501                 "src=\"static/summscreen_48x.gif\" ALT=\"&nbsp;\">"
502                 "</TD><TD>"
503                 "<B>%s</B><br />"
504                 "%s"
505                 "</TD></TR>\n",
506                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
507                 (ib_summary ? "CHECKED" : ""),
508                 _("Summary"),
509                 _("Your summary page")
510         );
511
512         wprintf("<TR bgcolor=%s><TD>"
513                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_inbox\" VALUE=\"yes\" %s>"
514                 "</TD><TD>"
515                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
516                 "src=\"static/privatemess_48x.gif\" ALT=\"&nbsp;\">"
517                 "</TD><TD>"
518                 "<B>%s</B><br />"
519                 "%s"
520                 "</TD></TR>\n",
521                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
522                 (ib_inbox ? "CHECKED" : ""),
523                 _("Mail (inbox)"),
524                 _("A shortcut to your email Inbox")
525         );
526
527         wprintf("<TR bgcolor=%s><TD>"
528                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_contacts\" "
529                 "VALUE=\"yes\" %s>"
530                 "</TD><TD>"
531                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
532                 "src=\"static/viewcontacts_48x.gif\" ALT=\"&nbsp;\">"
533                 "</TD><TD>"
534                 "<B>%s</B><br />"
535                 "%s"
536                 "</TD></TR>\n",
537                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
538                 (ib_contacts ? "CHECKED" : ""),
539                 _("Contacts"),
540                 _("Your personal address book")
541         );
542
543         wprintf("<TR bgcolor=%s><TD>"
544                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
545                 "VALUE=\"yes\" %s>"
546                 "</TD><TD>"
547                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
548                 "src=\"static/storenotes_48x.gif\" ALT=\"&nbsp;\">"
549                 "</TD><TD>"
550                 "<B>%s</B><br />"
551                 "%s"
552                 "</TD></TR>\n",
553                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
554                 (ib_notes ? "CHECKED" : ""),
555                 _("Notes"),
556                 _("Your personal notes")
557         );
558
559 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
560         wprintf("<TR bgcolor=%s><TD>"
561                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
562                 "VALUE=\"yes\" %s>"
563                 "</TD><TD>"
564                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
565                 "src=\"static/calarea_48x.gif\" ALT=\"&nbsp;\">"
566                 "</TD><TD>"
567                 "<B>%s</B><br />"
568                 "%s"
569                 "</TD></TR>\n",
570                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
571                 (ib_calendar ? "CHECKED" : ""),
572                 _("Calendar"),
573                 _("A shortcut to your personal calendar")
574         );
575
576         wprintf("<TR bgcolor=%s><TD>"
577                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
578                 "</TD><TD>"
579                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
580                 "src=\"static/taskmanag_48x.gif\" ALT=\"&nbsp;\">"
581                 "</TD><TD>"
582                 "<B>%s</B><br />"
583                 "%s"
584                 "</TD></TR>\n",
585                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
586                 (ib_tasks ? "CHECKED" : ""),
587                 _("Tasks"),
588                 _("A shortcut to your personal task list")
589         );
590 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
591
592         wprintf("<TR bgcolor=%s><TD>"
593                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
594                 "</TD><TD>"
595                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
596                 "src=\"static/chatrooms_48x.gif\" ALT=\"&nbsp;\">"
597                 "</TD><TD>"
598                 "<B>%s</B><br />"
599                 "%s"
600                 "</TD></TR>\n",
601                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
602                 (ib_rooms ? "CHECKED" : ""),
603                 _("Rooms"),
604                 _("Clicking this icon displays a list of all accesible "
605                 "rooms (or folders) available.")
606         );
607
608         wprintf("<TR bgcolor=%s><TD>"
609                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
610                 "</TD><TD>"
611                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
612                 "src=\"static/usermanag_48x.gif\" ALT=\"&nbsp;\">"
613                 "</TD><TD>"
614                 "<B>%s</B><br />"
615                 "%s"
616                 "</TD></TR>\n",
617                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
618                 (ib_users ? "CHECKED" : ""),
619                 _("Who is online?"),
620                 _("Clicking this icon displays a list of all users "
621                 "currently logged in.")
622         );
623
624         wprintf("<TR bgcolor=%s><TD>"
625                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
626                 "</TD><TD>"
627                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
628                 "src=\"static/citadelchat_48x.gif\" ALT=\"&nbsp;\">"
629                 "</TD><TD>"
630                 "<B>%s</B><br />"
631                 "%s"
632                 "</TD></TR>\n",
633                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
634                 (ib_chat ? "CHECKED" : ""),
635                 _("Chat"),
636                 _("Clicking this icon enters real-time chat mode "
637                 "with other users in the same room.")
638                 
639         );
640
641         wprintf("<TR bgcolor=%s><TD>"
642                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
643                 "VALUE=\"yes\" %s>"
644                 "</TD><TD>"
645                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
646                 "src=\"static/advanpage2_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_advanced ? "CHECKED" : ""),
653                 _("Advanced options"),
654                 _("Access to the complete menu of Citadel functions.")
655
656         );
657
658         wprintf("<TR bgcolor=%s><TD>"
659                 "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
660                 "VALUE=\"yes\" %s>"
661                 "</TD><TD>"
662                 "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
663                 "src=\"static/citadel-logo.gif\" ALT=\"&nbsp;\">"
664                 "</TD><TD>"
665                 "<B>%s</B><br />"
666                 "%s"
667                 "</TD></TR>\n",
668                 ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")),
669                 (ib_citadel ? "CHECKED" : ""),
670                 _("Citadel logo"),
671                 _("Displays the 'Powered by Citadel' icon")
672         );
673
674         wprintf("</TABLE><br />\n"
675                 "<CENTER>"
676                 "<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
677                 "&nbsp;"
678                 "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
679                 "</CENTER></FORM>\n",
680                 _("Save changes"),
681                 _("Cancel")
682         );
683
684         wprintf("</td></tr></table></div>\n");
685         wDumpContent(2);
686 }
687
688
689 void commit_iconbar(void) {
690         char iconbar[SIZ];
691         int i;
692
693         char *boxen[] = {
694                 "ib_logo",
695                 "ib_summary",
696                 "ib_inbox",
697                 "ib_calendar",
698                 "ib_contacts",
699                 "ib_notes",
700                 "ib_tasks",
701                 "ib_rooms",
702                 "ib_users",
703                 "ib_chat",
704                 "ib_advanced",
705                 "ib_logoff",
706                 "ib_citadel"
707         };
708
709         if (strlen(bstr("ok_button")) == 0) {
710                 display_main_menu();
711                 return;
712         }
713
714         sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
715
716         for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
717                 sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]);
718                 if (!strcasecmp(bstr(boxen[i]), "yes")) {
719                         sprintf(&iconbar[strlen(iconbar)], "1");
720                 }
721                 else {
722                         sprintf(&iconbar[strlen(iconbar)], "0");
723                 }
724         }
725
726         set_preference("iconbar", iconbar, 1);
727
728         output_headers(1, 1, 0, 0, 0, 0);
729         wprintf(
730                 "<center><table border=1 bgcolor=\"#ffffff\"><tr><td>"
731                 "<img src=\"static/advanpage2_48x.gif\">"
732                 "&nbsp;");
733         wprintf(_("Your icon bar has been updated.  Please select any of its "
734                 "choices to continue."));
735         wprintf("</td></tr></table>\n");
736         wDumpContent(2);
737 }
738