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