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