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 width=\"100%%\" cellspacing=\"10px\" cellpadding=\"0\">"
22 "<tr><td colspan=\"2\" class=\"advanced\">\n");
24 svput("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", 8,
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"),
129 "display_openids", _("Manage your OpenIDs")
132 wprintf("</td><td width=50%%>");
134 snprintf(buf, SIZ, _("Zap (forget) this room (%s)"), WC->wc_roomname);
136 if ( (WC->axlevel >= 6) || (WC->is_room_aide) || (WC->is_mailbox) )
137 print_menu_box(_("Advanced room commands"),"adminitems", 5,
138 "display_editroom", _("Edit or delete this room"),
139 "display_private", _("Go to a 'hidden' room"),
140 "display_entroom", _("Create a new room"),
142 "zapped_list",_("List all forgotten rooms"));
144 print_menu_box(_("Advanced room commands"),"adminitems", 4,
145 "display_private", _("Go to a 'hidden' room"),
146 "display_entroom", _("Create a new room"),
148 "zapped_list",_("List all forgotten rooms"));
150 wprintf("</td></tr></table></div>");
156 * \brief System administration menu
158 void display_aide_menu(void)
160 output_headers(1, 1, 2, 0, 0, 0);
162 wprintf("<div id=\"banner\">\n");
164 wprintf(_("System Administration Menu"));
168 wprintf("<div id=\"content\" class=\"service\">");
170 wprintf("<div class=\"fix_scrollbar_bug\">"
172 "<tr valign=top><td width=50%% valign=\"top\">");
174 print_menu_box(_("Global Configuration"), "adminitems", 4,
175 "display_siteconfig", _("Edit site-wide configuration"),
176 "display_inetconf",_("Domain names and Internet mail configuration"),
177 "display_netconf", _("Configure replication with other Citadel servers"),
178 "display_smtpqueue", _("View the outbound SMTP queue"));
180 wprintf("</td><td width=50%% valign=\"top\">");
182 print_menu_box(_("User account management"), "adminitems", 2,
183 "select_user_to_edit", _("Add, change, delete user accounts"),
184 "validate", _("Validate new users"));
186 wprintf("</td></tr><tr><td width=50%% valign=\"top\">");
189 print_menu_box(_("Shutdown Citadel"), "adminitems", 3,
190 "server_shutdown?when=now", _("Restart Now"),
191 "server_shutdown?when=page", _("Restart after paging users"),
192 "server_shutdown?when=idle", _("Restart when all users are idle"));
194 wprintf("</td><td width=50%% valign=\"top\">");
196 print_menu_box(_("Rooms and Floors"), "adminitems", 1,
197 "display_floorconfig", _("Add, change, or delete floors"));
199 wprintf("</td></tr></table></div>");
206 * \brief Display the screen to enter a generic server command
208 void display_generic(void)
210 output_headers(1, 1, 2, 0, 0, 0);
211 wprintf("<div id=\"banner\">\n");
213 wprintf(_("Enter a server command"));
217 wprintf("<div id=\"content\" class=\"service\">\n");
219 wprintf("<div class=\"fix_scrollbar_bug\">"
220 "<table class=\"mainmenu_background\"><tr><td>\n");
223 wprintf(_("This screen allows you to enter Citadel server commands which are "
224 "not supported by WebCit. If you do not know what that means, "
225 "then this screen will not be of much use to you."));
228 wprintf("<form method=\"post\" action=\"do_generic\">\n");
229 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
231 wprintf(_("Enter command:"));
232 wprintf("<br /><input type=\"text\" name=\"g_cmd\" size=80 maxlength=\"250\"><br />\n");
234 wprintf(_("Command input (if requesting SEND_LISTING transfer mode):"));
235 wprintf("<br /><textarea name=\"g_input\" rows=10 cols=80 width=80></textarea><br />\n");
237 wprintf("<font size=-2>");
238 wprintf(_("Detected host header is %s://%s"), (is_https ? "https" : "http"), WC->http_host);
239 wprintf("</font>\n");
240 wprintf("<input type=\"submit\" name=\"sc_button\" value=\"%s\">", _("Send command"));
242 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\"><br />\n", _("Cancel"));
244 wprintf("</form></center>\n");
245 wprintf("</td></tr></table></div>\n");
250 * \brief Interactive window to perform generic Citadel server commands.
252 void do_generic(void)
259 if (!havebstr("sc_button")) {
264 output_headers(1, 1, 0, 0, 0, 0);
266 serv_printf("%s", bstr("g_cmd"));
267 serv_getln(buf, sizeof buf);
269 svput("BOXTITLE", WCS_STRING, _("Server command results"));
270 do_template("beginbox");
272 wprintf("<table border=0><tr><td>Command:</td><td><tt>");
273 escputs(bstr("g_cmd"));
274 wprintf("</tt></td></tr><tr><td>Result:</td><td><tt>");
276 wprintf("</tt></td></tr></table><br />\n");
279 serv_printf("\n\n000");
281 if ((buf[0] == '1') || (buf[0] == '8')) {
282 while (serv_getln(gcontent, sizeof gcontent), strcmp(gcontent, "000")) {
289 text_to_server(bstr("g_input"));
295 serv_read(junk, len);
301 memset(junk, 0, len);
302 serv_write(junk, len);
306 wprintf("<a href=\"display_generic\">Enter another command</a><br />\n");
307 wprintf("<a href=\"display_advanced\">Return to menu</a>\n");
308 do_template("endbox");
314 * \brief Display the menubar.
315 * \param as_single_page Set to display HTML headers and footers -- otherwise it's assumed
316 * that the menubar is being embedded in another page.
318 void display_menubar(int as_single_page) {
320 if (as_single_page) {
321 output_headers(0, 0, 0, 0, 0, 0);
324 "<title>MenuBar</title>\n"
325 "<style type=\"text/css\">\n"
326 "body { text-decoration: none; }\n"
329 do_template("background");
332 do_template("menubar");
334 if (as_single_page) {
343 * \brief Display the wait / input dialog while restarting the server.
345 void display_shutdown(void)
351 if (!strcmp(when, "now")){
352 serv_printf("DOWN 1");
353 serv_getln(buf, sizeof buf);
354 if (atol(buf) == 500)
355 { /* upsie. maybe the server is not running as daemon? */
356 wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);
362 "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
364 "<body bgcolor=\"#FFFFFF\">\n"
365 "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
366 "</body>\n</html>\n",
367 _("Please wait while the Citadel server is restarted... ")
371 lingering_close(WC->http_sock);
376 else if (!strcmp(when, "page")) {
379 message = bstr("message");
380 if ((message == NULL) || (IsEmptyStr(message)))
382 output_headers(1, 1, 1, 0, 0, 0);
383 svput("BOXTITLE", WCS_STRING, _("Message to your Users:"));
384 do_template("beginbox");
385 wprintf("<form action=\"server_shutdown\">\n"
386 "<input type=\"hidden\" name=\"when\" value=\"page\">\n"
387 "<input type=\"text\" name=\"message\" value=\"%s\">\n"
388 "<input type=\"submit\" value=\"go\">\n"
390 _("The citadel server has to be restarted. It 'll be back in a minute.")
392 do_template("endbox");
399 // TODO: page the users... wait longer...
400 serv_printf("SEXP broadcast|%s", message);
401 serv_getln(buf, sizeof buf); // should we care?
404 "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
406 "<body bgcolor=\"#FFFFFF\">\n"
407 "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
408 "</body>\n</html>\n",
409 _("Please wait while your users are being paged, the citadel server will be restarted after that... "));
413 else if (!strcmp(when, "idle")) {
414 serv_printf("SCDN 3");
415 serv_getln(buf, sizeof buf);
416 if (atol(buf) == 500)
417 { /* upsie. maybe the server is not running as daemon? */
418 wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);