X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ficonbar.c;h=15729cfdec32b5ccc70c1990ed70322187f0a922;hb=c477d6a73cf3afdc47913e2c775ceb5938b6a469;hp=5cad259deb797231d49c1370ae8b33c63c1340f3;hpb=352c3e7ed9dbb730fa86d4402789cf2740e7028f;p=citadel.git diff --git a/webcit/iconbar.c b/webcit/iconbar.c index 5cad259de..15729cfde 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -1,66 +1,70 @@ -/* $Id$ */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/* + * $Id$ + */ +/** + * \defgroup IconBar Displays and customizes the iconbar. + * \ingroup MenuInfrastructure + */ +/*@{*/ #include "webcit.h" -/* Values for ib_displayas */ -#define IB_PICTEXT 0 -#define IB_PICONLY 1 -#define IB_TEXTONLY 2 +/** Values for ib_displayas */ +#define IB_PICTEXT 0 /**< picture and text */ +#define IB_PICONLY 1 /**< just a picture */ +#define IB_TEXTONLY 2 /**< just text */ + +/** + * \brief draw the icon bar????? + */ +void do_selected_iconbar(void) { + if (WC->current_iconbar == current_iconbar_roomlist) { + do_iconbar_roomlist(); + } + else { + do_iconbar(); + } +} + +/** + * \brief draw the icon bar??? + */ void do_iconbar(void) { char iconbar[SIZ]; char buf[SIZ]; char key[SIZ], value[SIZ]; int i; - /* The initialized values of these variables also happen to + WC->current_iconbar = current_iconbar_menu; + + /** + * The initialized values of these variables also happen to * specify the default values for users who haven't customized * their iconbars. These should probably be set in a master * configuration somewhere. */ - int ib_displayas = 0; /* pictures and text, pictures, text */ - int ib_logo = 0; /* Site logo */ - int ib_summary = 0; /* Summary page icon */ - int ib_inbox = 0; /* Inbox icon */ - int ib_calendar = 0; /* Calendar icon */ - int ib_contacts = 0; /* Contacts icon */ - int ib_notes = 0; /* Notes icon */ - int ib_tasks = 0; /* Tasks icon */ - int ib_rooms = 1; /* Rooms icon */ - int ib_users = 1; /* Users icon */ - int ib_chat = 0; /* Chat icon */ - int ib_advanced = 1; /* Advanced Options icon */ - int ib_logoff = 1; /* Logoff button */ - int ib_citadel = 1; /* 'Powered by Citadel' logo */ + int ib_displayas = 0; /**< pictures and text, pictures, text */ + int ib_logo = 0; /**< Site logo */ + int ib_summary = 1; /**< Summary page icon */ + int ib_inbox = 1; /**< Inbox icon */ + int ib_calendar = 1; /**< Calendar icon */ + int ib_contacts = 1; /**< Contacts icon */ + int ib_notes = 1; /**< Notes icon */ + int ib_tasks = 1; /**< Tasks icon */ + int ib_rooms = 1; /**< Rooms icon */ + int ib_users = 1; /**< Users icon */ + int ib_chat = 1; /**< Chat icon */ + int ib_advanced = 1; /**< Advanced Options icon */ + int ib_citadel = 1; /**< 'Powered by Citadel' logo */ /* */ - get_preference("iconbar", iconbar); + get_preference("iconbar", iconbar, sizeof iconbar); for (i=0; i\n" - "\n"); + + wprintf( + " \n" + ); +} -void display_customize_iconbar(void) { +/** + * \brief roomtree view of the iconbar + * If the user has toggled the icon bar over to a room list, here's where + * we generate its innerHTML... + */ +void do_iconbar_roomlist(void) { char iconbar[SIZ]; char buf[SIZ]; char key[SIZ], value[SIZ]; int i; - /* The initialized values of these variables also happen to + WC->current_iconbar = current_iconbar_roomlist; + + /** + * The initialized values of these variables also happen to * specify the default values for users who haven't customized * their iconbars. These should probably be set in a master * configuration somewhere. */ - int ib_displayas = IB_PICTEXT; /* pictures and text, pictures, text */ + int ib_displayas = 0; /* pictures and text, pictures, text */ int ib_logo = 0; /* Site logo */ - int ib_summary = 0; /* Summary page icon */ - int ib_inbox = 0; /* Inbox icon */ - int ib_calendar = 0; /* Calendar icon */ - int ib_contacts = 0; /* Contacts icon */ - int ib_notes = 0; /* Notes icon */ - int ib_tasks = 0; /* Tasks icon */ - int ib_rooms = 1; /* Rooms icon */ - int ib_users = 1; /* Users icon */ - int ib_chat = 0; /* Chat icon */ - int ib_advanced = 1; /* Advanced Options icon */ - int ib_logoff = 1; /* Logoff button */ int ib_citadel = 1; /* 'Powered by Citadel' logo */ /* */ - get_preference("iconbar", iconbar); + get_preference("iconbar", iconbar, sizeof iconbar); + for (i=0; i \" \" " + "\n" + ); + } + } + + if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf( + "
" + " " + "\"%s\" " + "
\n", + _("Find out more about Citadel"), + _("CITADEL") + ); + + wprintf("\n"); + + /** embed the room list */ + list_all_rooms_by_floor("iconbar"); + + wprintf("\n"); +} + + +/** + * \brief display a customized version of the iconbar + */ +void display_customize_iconbar(void) { + char iconbar[SIZ]; + char buf[SIZ]; + char key[SIZ], value[SIZ]; + int i; + int bar = 0; + + /** + * The initialized values of these variables also happen to + * specify the default values for users who haven't customized + * their iconbars. These should probably be set in a master + * configuration somewhere. + */ + int ib_displayas = IB_PICTEXT; /**< pictures and text, pictures, text */ + int ib_logo = 0; /**< Site logo */ + int ib_summary = 1; /**< Summary page icon */ + int ib_inbox = 1; /**< Inbox icon */ + int ib_calendar = 1; /**< Calendar icon */ + int ib_contacts = 1; /**< Contacts icon */ + int ib_notes = 1; /**< Notes icon */ + int ib_tasks = 1; /**< Tasks icon */ + int ib_rooms = 1; /**< Rooms icon */ + int ib_users = 1; /**< Users icon */ + int ib_chat = 1; /**< Chat icon */ + int ib_advanced = 1; /**< Advanced Options icon */ + int ib_citadel = 1; /**< 'Powered by Citadel' logo */ + /* + */ + + get_preference("iconbar", iconbar, sizeof iconbar); for (i=0; i\n" + "
" + ""); + wprintf(_("Customize the icon bar")); + wprintf("" + "
\n" + "\n
\n" + ); + + wprintf("
" + "
"); - wprintf("
\n"); + wprintf("\n"); + wprintf("\n", WC->nonce); - wprintf("
" - "Display icons as: "); + wprintf("
"); + wprintf(_("Display icons as:")); + wprintf(" "); for (i=0; i<=2; ++i) { - wprintf(""); - if (i == IB_PICTEXT) wprintf("pictures and text"); - if (i == IB_PICONLY) wprintf("pictures only"); - if (i == IB_TEXTONLY) wprintf("text only"); + if (i == IB_PICTEXT) wprintf(_("pictures and text")); + if (i == IB_PICONLY) wprintf(_("pictures only")); + if (i == IB_TEXTONLY) wprintf(_("text only")); wprintf("\n"); } wprintf("

\n"); - wprintf("Select the icons you would like to see displayed " - "in the "icon bar" menu on the left side of the " - "screen.

\n" - ); + wprintf(_("Select the icons you would like to see displayed " + "in the 'icon bar' menu on the left side of the " + "screen.")); + wprintf("

\n"); wprintf("\n"); - wprintf("\n", - (ib_logo ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_logo ? "CHECKED" : ""), + _("Site logo"), + _("An icon describing this site") ); - wprintf("\n", - (ib_summary ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_summary ? "CHECKED" : ""), + _("Summary"), + _("Your summary page") ); - wprintf("\n", - (ib_inbox ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_inbox ? "CHECKED" : ""), + _("Mail (inbox)"), + _("A shortcut to your email Inbox") ); - wprintf("\n", - (ib_contacts ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_contacts ? "CHECKED" : ""), + _("Contacts"), + _("Your personal address book") ); - wprintf("\n", - (ib_notes ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_notes ? "CHECKED" : ""), + _("Notes"), + _("Your personal notes") ); #ifdef WEBCIT_WITH_CALENDAR_SERVICE - wprintf("\n", - (ib_calendar ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_calendar ? "CHECKED" : ""), + _("Calendar"), + _("A shortcut to your personal calendar") ); - wprintf("\n", - (ib_tasks ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_tasks ? "CHECKED" : ""), + _("Tasks"), + _("A shortcut to your personal task list") ); #endif /* WEBCIT_WITH_CALENDAR_SERVICE */ - wprintf("\n", - (ib_rooms ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_rooms ? "CHECKED" : ""), + _("Rooms"), + _("Clicking this icon displays a list of all accessible " + "rooms (or folders) available.") ); - wprintf("\n", - (ib_users ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_users ? "CHECKED" : ""), + _("Who is online?"), + _("Clicking this icon displays a list of all users " + "currently logged in.") ); - wprintf("\n", - (ib_chat ? "CHECKED" : "") + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_chat ? "CHECKED" : ""), + _("Chat"), + _("Clicking this icon enters real-time chat mode " + "with other users in the same room.") + ); - wprintf("\n", - (ib_advanced ? "CHECKED" : "") - ); + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_advanced ? "CHECKED" : ""), + _("Advanced options"), + _("Access to the complete menu of Citadel functions.") - wprintf("\n", - (ib_logoff ? "CHECKED" : "") ); - wprintf("\n", - (ib_citadel ? "CHECKED" : "") + + wprintf("\n", + ((bar = 1 - bar), (bar ? "\"#CCCCCC\"" : "\"#FFFFFF\"")), + (ib_citadel ? "CHECKED" : ""), + _("Citadel logo"), + _("Displays the 'Powered by Citadel' icon") ); - wprintf("
" - "" - "" - "\" \"" - "" - "Site logo
" - "A graphic describing this site" - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Summary
" - "Your summary page" - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Mail (inbox)
" - "A shortcut to your e-mail Inbox." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Contacts
" - "Your personal address book." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Notes
" - "Your personal notes." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Calendar
" - "A shortcut to your personal calendar." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Tasks
" - "A shortcut to your personal task list." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Rooms
" - "Clicking this icon displays a list of all accesible " - "rooms (or folders) available." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Users
" - "Clicking this icon displays a list of all users " - "currently logged in." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Chat
" - "Clicking this icon enters real-time chat mode " - "with other users in the same room." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Advanced options
" - "Access to the complete menu of Citadel functions." - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "
" - "" - "" - "\" \"" - "" - "Log off
" - "Exit from the Citadel system. If you remove this icon " - "then you will have no way out!" - "
" - "" - "" - "\" \"" - "" - "Citadel logo
" - "Displays the "Powered by Citadel" graphic" - "
" + "" + "" + "\" \"" + "" + "%s
" + "%s" + "

\n" + wprintf("

\n" "
" - "" + "" " " - "" - "
\n" + "" + "\n", + _("Save changes"), + _("Cancel") ); - do_template("endbox"); + wprintf("
\n"); wDumpContent(2); } - +/** + * \brief commit the changes of an edited iconbar ???? + */ void commit_iconbar(void) { char iconbar[SIZ]; int i; @@ -569,7 +746,7 @@ void commit_iconbar(void) { "ib_citadel" }; - if (strcmp(bstr("sc"), "OK")) { + if (IsEmptyStr(bstr("ok_button"))) { display_main_menu(); return; } @@ -577,25 +754,29 @@ void commit_iconbar(void) { sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas"))); for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) { - sprintf(&iconbar[strlen(iconbar)], ",%s=", boxen[i]); + char *Val; if (!strcasecmp(bstr(boxen[i]), "yes")) { - sprintf(&iconbar[strlen(iconbar)], "1"); + Val = "1"; } else { - sprintf(&iconbar[strlen(iconbar)], "0"); + Val = "0"; } + sprintf(&iconbar[strlen(iconbar)], ",%s=%s", boxen[i], Val); } - set_preference("iconbar", iconbar); + set_preference("iconbar", iconbar, 1); - output_headers(1, 1, 0, 0, 0, 0, 0); - do_template("beginbox_nt"); + output_headers(1, 1, 0, 0, 0, 0); wprintf( - "" - " " - "Your icon bar has been updated. Please select any of its " - "choices to continue.\n" - ); - do_template("endbox"); + "
" + "" + " "); + wprintf(_("Your icon bar has been updated. Please select any of its " + "choices to continue.")); + wprintf("
\n"); wDumpContent(2); } + + + +/*@}*/