5 * \defgroup DispAdvancedMenu Displays the "advanced" (main) menu.
6 * \ingroup MenuInfrastructure
13 * \brief The Main Menu
15 void display_main_menu(void)
18 output_headers(1, 1, 1, 0, 0, 0);
20 wprintf("<div class=\"fix_scrollbar_bug\">"
21 "<table class=\"advanced\">"
22 "<tr><td colspan=\"2\">\n");
24 svprintf("BOXTITLE", WCS_STRING, _("Basic commands"));
25 do_template("beginbox");
27 /**< start of first column */
28 wprintf("<ul class=\"adminitems col1\">");
30 wprintf("<li><a href=\"knrooms\">");
31 wprintf(_("List known rooms"));
32 wprintf("</a><span>");
33 wprintf(_("Where can I go from here?"));
34 wprintf("</span></li>\n");
36 wprintf("<li><a href=\"gotonext\">");
37 wprintf(_("Goto next room"));
38 wprintf("</a><span>");
39 wprintf(_("...with <em>unread</em> messages"));
40 wprintf("</span></li>\n");
42 wprintf("<li><a href=\"skip\">");
43 wprintf(_("Skip to next room"));
44 wprintf("</a><span>");
45 wprintf(_("(come back here later)"));
46 wprintf("</span></li>\n");
48 if ((!IsEmptyStr(WC->ugname)) && (strcasecmp(WC->ugname, WC->wc_roomname))) {
49 wprintf("<li><a href=\"ungoto\">");
51 wprintf("</a><span>");
52 wprintf(_("(oops! Back to %s)"), WC->ugname);
53 wprintf("</span></li>\n");
58 /* start of second column */
60 wprintf("<ul class=\"adminitems col2\">");
62 wprintf("<li><a href=\"readnew\">");
63 wprintf(_("Read new messages"));
64 wprintf("</a><span>");
65 wprintf(_("...in this room"));
66 wprintf("</span></li>\n");
68 wprintf("<li><a href=\"readfwd\">");
69 wprintf(_("Read all messages"));
70 wprintf("</a><span>");
71 wprintf(_("...old <EM>and</EM> new"));
72 wprintf("</span></li>\n");
74 wprintf("<li><a href=\"display_enter\">");
75 wprintf(_("Enter a message"));
76 wprintf("</a><span>");
77 wprintf(_("(post in this room)"));
78 wprintf("</span></li>\n");
80 if (WC->room_flags & QR_VISDIR) {
81 wprintf("<li><a href=\"display_room_directory\">");
82 wprintf(_("File library"));
83 wprintf("</a><span>");
84 wprintf(_("(List files available for download)"));
85 wprintf("</span></li>\n");
90 /* start of third column */
92 wprintf("<ul class=\"adminitems lastcol\">");
94 wprintf("<li><a href=\"summary\">");
95 wprintf(_("Summary page"));
96 wprintf("</a><span>");
97 wprintf(_("Summary of my account"));
98 wprintf("</span></li>\n");
100 wprintf("<li><a href=\"userlist\">\n");
101 wprintf(_("User list"));
102 wprintf("</a><span>");
103 wprintf(_("(all registered users)"));
104 wprintf("</span></li>\n");
106 wprintf("<li><a href=\"termquit\" TARGET=\"_top\">");
107 wprintf(_("Log off"));
108 wprintf("</a><span>");
110 wprintf("</span></li>\n");
116 do_template("endbox");
119 "<tr valign=top><td width=50%%>");
121 print_menu_box(_("Your info"), "adminitems", 7,
122 "display_preferences", _("Change your preferences and settings"),
123 "display_reg", _("Update your contact information"),
124 "display_changepw", _("Change your password"),
125 "display_editbio", _("Enter your 'bio'"),
126 "display_editpic", _("Edit your online photo"),
127 "display_sieve", _("View/edit server-side mail filters"),
128 "display_pushemail", _("Edit your push email settings"));
130 wprintf("</td><td width=50%%>");
132 snprintf(buf, SIZ, _("Zap (forget) this room (%s)"), WC->wc_roomname);
134 if ( (WC->axlevel >= 6) || (WC->is_room_aide) || (WC->is_mailbox) )
135 print_menu_box(_("Advanced room commands"),"adminitems", 5,
136 "display_editroom", _("Edit or delete this room"),
137 "display_private", _("Go to a 'hidden' room"),
138 "display_entroom", _("Create a new room"),
140 "zapped_list",_("List all forgotten rooms"));
142 print_menu_box(_("Advanced room commands"),"adminitems", 4,
143 "display_private", _("Go to a 'hidden' room"),
144 "display_entroom", _("Create a new room"),
146 "zapped_list",_("List all forgotten rooms"));
148 wprintf("</td></tr></table></div>");
154 * \brief System administration menu
156 void display_aide_menu(void)
158 output_headers(1, 1, 2, 0, 0, 0);
160 wprintf("<div id=\"banner\">\n");
162 wprintf(_("System Administration Menu"));
166 wprintf("<div id=\"content\" class=\"service\">");
168 wprintf("<div class=\"fix_scrollbar_bug\">"
170 "<tr valign=top><td width=50%% valign=\"top\">");
172 print_menu_box(_("Global Configuration"), "adminitems", 4,
173 "display_siteconfig", _("Edit site-wide configuration"),
174 "display_inetconf",_("Domain names and Internet mail configuration"),
175 "display_netconf", _("Configure replication with other Citadel servers"),
176 "display_smtpqueue", _("View the outbound SMTP queue"));
178 wprintf("</td><td width=50%% valign=\"top\">");
180 print_menu_box(_("User account management"), "adminitems", 2,
181 "select_user_to_edit", _("Add, change, delete user accounts"),
182 "validate", _("Validate new users"));
184 wprintf("</td></tr><tr><td width=50%% valign=\"top\">");
187 print_menu_box(_("Shutdown Citadel"), "adminitems", 3,
188 "server_shutdown?when=now", _("Restart Now"),
189 "server_shutdown?when=page", _("Restart after paging users"),
190 "server_shutdown?when=idle", _("Restart when all users are idle"));
192 wprintf("</td><td width=50%% valign=\"top\">");
194 print_menu_box(_("Rooms and Floors"), "adminitems", 1,
195 "display_floorconfig", _("Add, change, or delete floors"));
197 wprintf("</td></tr></table></div>");
204 * \brief Display the screen to enter a generic server command
206 void display_generic(void)
208 output_headers(1, 1, 2, 0, 0, 0);
209 wprintf("<div id=\"banner\">\n");
211 wprintf(_("Enter a server command"));
215 wprintf("<div id=\"content\" class=\"service\">\n");
217 wprintf("<div class=\"fix_scrollbar_bug\">"
218 "<table class=\"mainmenu_background\"><tr><td>\n");
221 wprintf(_("This screen allows you to enter Citadel server commands which are "
222 "not supported by WebCit. If you do not know what that means, "
223 "then this screen will not be of much use to you."));
226 wprintf("<form method=\"post\" action=\"do_generic\">\n");
227 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
229 wprintf(_("Enter command:"));
230 wprintf("<br /><input type=\"text\" name=\"g_cmd\" size=80 maxlength=\"250\"><br />\n");
232 wprintf(_("Command input (if requesting SEND_LISTING transfer mode):"));
233 wprintf("<br /><textarea name=\"g_input\" rows=10 cols=80 width=80></textarea><br />\n");
235 wprintf("<font size=-2>");
236 wprintf(_("Detected host header is %s://%s"), (is_https ? "https" : "http"), WC->http_host);
237 wprintf("</font>\n");
238 wprintf("<input type=\"submit\" name=\"sc_button\" value=\"%s\">", _("Send command"));
240 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\"><br />\n", _("Cancel"));
242 wprintf("</form></center>\n");
243 wprintf("</td></tr></table></div>\n");
248 * \brief Interactive window to perform generic Citadel server commands.
250 void do_generic(void)
257 if (IsEmptyStr(bstr("sc_button"))) {
262 output_headers(1, 1, 0, 0, 0, 0);
264 serv_printf("%s", bstr("g_cmd"));
265 serv_getln(buf, sizeof buf);
267 svprintf("BOXTITLE", WCS_STRING, _("Server command results"));
268 do_template("beginbox");
270 wprintf("<table border=0><tr><td>Command:</td><td><tt>");
271 escputs(bstr("g_cmd"));
272 wprintf("</tt></td></tr><tr><td>Result:</td><td><tt>");
274 wprintf("</tt></td></tr></table><br />\n");
277 serv_printf("\n\n000");
279 if ((buf[0] == '1') || (buf[0] == '8')) {
280 while (serv_getln(gcontent, sizeof gcontent), strcmp(gcontent, "000")) {
287 text_to_server(bstr("g_input"));
293 serv_read(junk, len);
299 memset(junk, 0, len);
300 serv_write(junk, len);
304 wprintf("<a href=\"display_generic\">Enter another command</a><br />\n");
305 wprintf("<a href=\"display_advanced\">Return to menu</a>\n");
306 do_template("endbox");
312 * \brief Display the menubar.
313 * \param as_single_page Set to display HTML headers and footers -- otherwise it's assumed
314 * that the menubar is being embedded in another page.
316 void display_menubar(int as_single_page) {
318 if (as_single_page) {
319 output_headers(0, 0, 0, 0, 0, 0);
322 "<title>MenuBar</title>\n"
323 "<style type=\"text/css\">\n"
324 "body { text-decoration: none; }\n"
327 do_template("background");
330 do_template("menubar");
332 if (as_single_page) {
341 * \brief Display the wait / input dialog while restarting the server.
343 void display_shutdown(void)
349 if (!strcmp(when, "now")){
350 serv_printf("DOWN 1");
351 serv_getln(buf, sizeof buf);
352 if (atol(buf) == 500)
353 { /* upsie. maybe the server is not running as daemon? */
354 wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);
360 "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
362 "<body bgcolor=\"#FFFFFF\">\n"
363 "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
364 "</body>\n</html>\n",
365 _("Please wait while the Citadel server is restarted... ")
369 lingering_close(WC->http_sock);
374 else if (!strcmp(when, "page")) {
377 message = bstr("message");
378 if ((message == NULL) || (IsEmptyStr(message)))
380 output_headers(1, 1, 1, 0, 0, 0);
381 svprintf("BOXTITLE", WCS_STRING, _("Message to your Users:"));
382 do_template("beginbox");
383 wprintf("<form action=\"server_shutdown\">\n"
384 "<input type=\"hidden\" name=\"when\" value=\"page\">\n"
385 "<input type=\"text\" name=\"message\" value=\"%s\">\n"
386 "<input type=\"submit\" value=\"go\">\n"
388 _("The citadel server has to be restarted. It 'll be back in a minute.")
390 do_template("endbox");
397 // TODO: page the users... wait longer...
398 serv_printf("SEXP broadcast|%s", message);
399 serv_getln(buf, sizeof buf); // should we care?
402 "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
404 "<body bgcolor=\"#FFFFFF\">\n"
405 "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
406 "</body>\n</html>\n",
407 _("Please wait while your users are being paged, the citadel server will be restarted after that... "));
411 else if (!strcmp(when, "idle")) {
412 serv_printf("SCDN 3");
413 serv_getln(buf, sizeof buf);
414 if (atol(buf) == 500)
415 { /* upsie. maybe the server is not running as daemon? */
416 wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);