X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmainmenu.c;h=14b3cedc3fb1e7e25af947bcfd6a2c39e4dafdcb;hb=2362c3d4de86f20822ab81015222a196137fd20e;hp=92b11d4efc92dc80123af6df73bff760ea1cfa40;hpb=c7a28913ad7fbcd263888e0bbb24b380d3a81b9c;p=citadel.git diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index 92b11d4ef..14b3cedc3 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -1,256 +1,195 @@ /* * $Id$ */ -/** - * \defgroup DispAdvancedMenu Displays the "advanced" (main) menu. - * - */ -/*@{*/ + #include "webcit.h" -/** - * \brief The Main Menu +/* + * The Main Menu */ void display_main_menu(void) { + char buf[SIZ]; output_headers(1, 1, 1, 0, 0, 0); wprintf("
" - "" - "
\n"); + "" + "" - "" + "
\n"); - svprintf("BOXTITLE", WCS_STRING, _("Basic commands")); + svput("BOXTITLE", WCS_STRING, _("Basic commands")); do_template("beginbox"); - wprintf("\n" - "" - "" - "
"); /**< start of first column */ + /* start of first column */ + wprintf("\n"); /* start of second column */ + wprintf("\n"); - wprintf("" - ""); + /* start of second column */ + + wprintf("\n"); - wprintf(""); /* start of third column */ + /* start of third column */ - wprintf("" - ""); + wprintf("
\n"); - do_template("endbox"); - - wprintf("
"); - - svprintf("BOXTITLE", WCS_STRING, _("Your info")); - do_template("beginbox"); - - wprintf("" - ""); - wprintf(_("Change your preferences and settings")); - wprintf("
\n"); - - wprintf("
" - ""); - wprintf(_("Update your contact information")); - wprintf("
\n"); + wprintf("\n"); - wprintf("
" - ""); - wprintf(_("Change your password")); - wprintf("
\n"); + wprintf("\n"); - wprintf("" - ""); - wprintf(_("Enter your 'bio'")); - wprintf("
\n"); - - wprintf("" - ""); - wprintf(_("Edit your online photo")); - wprintf("\n"); + wprintf(" "); do_template("endbox"); - wprintf("
"); - - svprintf("BOXTITLE", WCS_STRING, _("Advanced room commands")); - do_template("beginbox"); - - if ((WC->axlevel >= 6) || (WC->is_room_aide)) { - wprintf("" - ""); - wprintf(_("Edit or delete this room")); - wprintf("
\n"); - } - - wprintf("" - ""); - wprintf(_("Go to a 'hidden' room")); - wprintf("
\n"); - - wprintf("" - ""); - wprintf(_("Create a new room")); - wprintf("
\n"); + wprintf("
"); + + print_menu_box(_("Your info"), "adminitems", 8, + "display_preferences", _("Change your preferences and settings"), + "display_reg", _("Update your contact information"), + "display_changepw", _("Change your password"), + "display_editbio", _("Enter your 'bio'"), + "display_editpic", _("Edit your online photo"), + "display_sieve", _("View/edit server-side mail filters"), + "display_pushemail", _("Edit your push email settings"), + "display_openids", _("Manage your OpenIDs") + ); - wprintf("" - ""); - wprintf(_("Zap (forget) this room (%s)"), WC->wc_roomname); - wprintf("
\n"); + wprintf("
"); - wprintf("" - ""); - wprintf(_("List all forgotten rooms")); - wprintf("\n"); + snprintf(buf, SIZ, _("Zap (forget) this room (%s)"), WC->wc_roomname); - do_template("endbox"); + if ( (WC->axlevel >= 6) || (WC->is_room_aide) || (WC->is_mailbox) ) + print_menu_box(_("Advanced room commands"),"adminitems", 5, + "display_editroom", _("Edit or delete this room"), + "display_private", _("Go to a 'hidden' room"), + "display_entroom", _("Create a new room"), + "display_zap",buf, + "zapped_list",_("List all forgotten rooms")); + else + print_menu_box(_("Advanced room commands"),"adminitems", 4, + "display_private", _("Go to a 'hidden' room"), + "display_entroom", _("Create a new room"), + "display_zap",buf, + "zapped_list",_("List all forgotten rooms")); wprintf("
"); wDumpContent(2); } -/** - * \brief System administration menu +/* + * System administration menu */ void display_aide_menu(void) { output_headers(1, 1, 2, 0, 0, 0); - wprintf("
\n" - "
" - ""); - wprintf(_("System Administration Menu")); - wprintf("" - "
\n" - "
\n
\n" - ); - - wprintf("
" - "
"); - svprintf("BOXTITLE", WCS_STRING, _("Global Configuration")); - do_template("beginbox"); - - wprintf("" - ""); - wprintf(_("Edit site-wide configuration")); - wprintf("
\n"); - - wprintf("" - ""); - wprintf(_("Domain names and Internet mail configuration")); - wprintf("
\n"); - - wprintf("" - ""); - wprintf(_("Configure replication with other Citadel servers")); - wprintf("\n"); + wprintf("
\n"); + wprintf("

"); + wprintf(_("System Administration Menu")); + wprintf("

"); + wprintf("
\n"); - do_template("endbox"); + wprintf("
"); - wprintf("
"); + wprintf("
" + " " + "
"); - svprintf("BOXTITLE", WCS_STRING, _("User account management")); - do_template("beginbox"); + print_menu_box(_("Global Configuration"), "adminitems", 4, + "display_siteconfig", _("Edit site-wide configuration"), + "display_inetconf",_("Domain names and Internet mail configuration"), + "display_netconf", _("Configure replication with other Citadel servers"), + "display_smtpqueue", _("View the outbound SMTP queue")); + + wprintf(""); - wprintf("" - ""); - wprintf(_("Add, change, delete user accounts")); - wprintf("
\n"); + print_menu_box(_("User account management"), "adminitems", 2, + "select_user_to_edit", _("Add, change, delete user accounts"), + "validate", _("Validate new users")); - wprintf("" - ""); - wprintf(_("Validate new users")); - wprintf("
\n"); + wprintf("
"); - do_template("endbox"); - svprintf("BOXTITLE", WCS_STRING, _("Rooms and Floors")); - do_template("beginbox"); + print_menu_box(_("Shutdown Citadel"), "adminitems", 3, + "server_shutdown?when=now", _("Restart Now"), + "server_shutdown?when=page", _("Restart after paging users"), + "server_shutdown?when=idle", _("Restart when all users are idle")); - wprintf("" - ""); - wprintf(_("Add, change, or delete floors")); - wprintf("\n"); + wprintf(""); - do_template("endbox"); + print_menu_box(_("Rooms and Floors"), "adminitems", 1, + "display_floorconfig", _("Add, change, or delete floors")); wprintf("
"); wDumpContent(2); @@ -258,53 +197,52 @@ void display_aide_menu(void) - - -/** - * \brief Display the screen to enter a generic server command +/* + * Display the screen to enter a generic server command */ void display_generic(void) { output_headers(1, 1, 2, 0, 0, 0); - wprintf("
\n" - "
" - ""); + wprintf("
\n"); + wprintf("

"); wprintf(_("Enter a server command")); - wprintf("

\n" - "
\n
\n" - ); + wprintf(""); + wprintf("
\n"); + + wprintf("
\n"); wprintf("
" - "
\n"); + "
\n"); - wprintf("
"); + wprintf("
"); wprintf(_("This screen allows you to enter Citadel server commands which are " "not supported by WebCit. If you do not know what that means, " "then this screen will not be of much use to you.")); wprintf("
\n"); - wprintf("
\n"); + wprintf("\n"); + wprintf("\n", WC->nonce); wprintf(_("Enter command:")); - wprintf("

\n"); + wprintf("

\n"); wprintf(_("Command input (if requesting SEND_LISTING transfer mode):")); - wprintf("

\n"); + wprintf("

\n"); - wprintf(""); + wprintf(""); wprintf(_("Detected host header is %s://%s"), (is_https ? "https" : "http"), WC->http_host); - wprintf("\n"); - wprintf("", _("Send command")); + wprintf("\n"); + wprintf("", _("Send command")); wprintf(" "); - wprintf("
\n", _("Cancel")); + wprintf("
\n", _("Cancel")); - wprintf("
\n"); + wprintf("
\n"); wprintf("
\n"); wDumpContent(1); } -/** - * \brief what??? +/* + * Interactive window to perform generic Citadel server commands. */ void do_generic(void) { @@ -313,7 +251,7 @@ void do_generic(void) char *junk; size_t len; - if (strlen(bstr("sc_button")) == 0) { + if (!havebstr("sc_button")) { display_main_menu(); return; } @@ -323,14 +261,14 @@ void do_generic(void) serv_printf("%s", bstr("g_cmd")); serv_getln(buf, sizeof buf); - svprintf("BOXTITLE", WCS_STRING, _("Server command results")); + svput("BOXTITLE", WCS_STRING, _("Server command results")); do_template("beginbox"); - wprintf("
Command:"); + wprintf("
Command:"); escputs(bstr("g_cmd")); - wprintf("
Result:"); + wprintf("
Result:"); escputs(buf); - wprintf("

\n"); + wprintf("

\n"); if (buf[0] == '8') { serv_printf("\n\n000"); @@ -343,7 +281,7 @@ void do_generic(void) wprintf("000"); } if (buf[0] == '4') { - text_to_server(bstr("g_input"), 0); + text_to_server(bstr("g_input")); serv_puts("000"); } if (buf[0] == '6') { @@ -360,29 +298,30 @@ void do_generic(void) free(junk); } wprintf("
"); - wprintf("Enter another command
\n"); - wprintf("Return to menu\n"); + wprintf("Enter another command
\n"); + wprintf("Return to menu\n"); do_template("endbox"); wDumpContent(1); } -/** - * \brief Display the menubar. - * \param as_single_page Set to display HTML headers and footers -- otherwise it's assumed +/* + * Display the menubar. + * + * Set 'as_single_page' to display HTML headers and footers -- otherwise it's assumed * that the menubar is being embedded in another page. */ void display_menubar(int as_single_page) { if (as_single_page) { output_headers(0, 0, 0, 0, 0, 0); - wprintf("\n" - "\n" - "MenuBar\n" - "\n" - "\n"); + wprintf("\n" + "\n" + "MenuBar\n" + "\n" + "\n"); do_template("background"); } @@ -396,4 +335,83 @@ void display_menubar(int as_single_page) { } -/*@}*/ +/* + * Display the wait / input dialog while restarting the server. + */ +void display_shutdown(void) +{ + char buf[SIZ]; + char *when; + + when=bstr("when"); + if (!strcmp(when, "now")){ + serv_printf("DOWN 1"); + serv_getln(buf, sizeof buf); + if (atol(buf) == 500) + { /* upsie. maybe the server is not running as daemon? */ + wprintf("Attention: %s", &buf[4]); + + } + else { + wprintf("\n" + "\n" + "\n" + "\n" + "\n" + " %s " + "\n\n", + _("Please wait while the Citadel server is restarted... ") + ); + } + wDumpContent(0); + lingering_close(WC->http_sock); + sleeeeeeeeeep(10); + serv_printf("NOOP"); + serv_printf("NOOP"); + } + else if (!strcmp(when, "page")) { + char *message; + + message = bstr("message"); + if ((message == NULL) || (IsEmptyStr(message))) + { + output_headers(1, 1, 1, 0, 0, 0); + svput("BOXTITLE", WCS_STRING, _("Message to your Users:")); + do_template("beginbox"); + wprintf("
\n" + "\n" + "\n" + "\n" + "
\n", + _("The citadel server has to be restarted. It 'll be back in a minute.") + ); + do_template("endbox"); + wDumpContent(1); + + + } + else + { + // TODO: page the users... wait longer... + serv_printf("SEXP broadcast|%s", message); + serv_getln(buf, sizeof buf); // should we care? + wprintf("\n" + "\n" + "\n" + "\n" + "\n" + " %s " + "\n\n", + _("Please wait while your users are being paged, the citadel server will be restarted after that... ")); + + } + } + else if (!strcmp(when, "idle")) { + serv_printf("SCDN 3"); + serv_getln(buf, sizeof buf); + if (atol(buf) == 500) { + /* oops ... maybe the server is not running as a daemon? */ + wprintf("Attention: %s", &buf[4]); + } + } +}