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