10 void display_main_menu(void)
13 output_headers(1, 1, 1, 0, 0, 0);
15 wprintf("<div class=\"fix_scrollbar_bug\">"
16 "<table width=\"100%%\" cellspacing=\"10px\" cellpadding=\"0\">"
17 "<tr><td colspan=\"2\" class=\"advanced\">\n");
19 svput("BOXTITLE", WCS_STRING, _("Basic commands"));
20 do_template("beginbox", NULL);
22 /* start of first column */
23 wprintf("<ul class=\"adminitems col1\">");
25 wprintf("<li><a href=\"knrooms\">");
26 wprintf(_("List known rooms"));
27 wprintf("</a><span>");
28 wprintf(_("Where can I go from here?"));
29 wprintf("</span></li>\n");
31 wprintf("<li><a href=\"gotonext\">");
32 wprintf(_("Goto next room"));
33 wprintf("</a><span>");
34 wprintf(_("...with <em>unread</em> messages"));
35 wprintf("</span></li>\n");
37 wprintf("<li><a href=\"skip\">");
38 wprintf(_("Skip to next room"));
39 wprintf("</a><span>");
40 wprintf(_("(come back here later)"));
41 wprintf("</span></li>\n");
43 if ((!IsEmptyStr(WC->ugname)) && (strcasecmp(WC->ugname, WC->wc_roomname))) {
44 wprintf("<li><a href=\"ungoto\">");
46 wprintf("</a><span>");
47 wprintf(_("(oops! Back to %s)"), WC->ugname);
48 wprintf("</span></li>\n");
53 /* start of second column */
55 wprintf("<ul class=\"adminitems col2\">");
57 wprintf("<li><a href=\"readnew\">");
58 wprintf(_("Read new messages"));
59 wprintf("</a><span>");
60 wprintf(_("...in this room"));
61 wprintf("</span></li>\n");
63 wprintf("<li><a href=\"readfwd\">");
64 wprintf(_("Read all messages"));
65 wprintf("</a><span>");
66 wprintf(_("...old <EM>and</EM> new"));
67 wprintf("</span></li>\n");
69 wprintf("<li><a href=\"display_enter\">");
70 wprintf(_("Enter a message"));
71 wprintf("</a><span>");
72 wprintf(_("(post in this room)"));
73 wprintf("</span></li>\n");
75 if (WC->room_flags & QR_VISDIR) {
76 wprintf("<li><a href=\"display_room_directory\">");
77 wprintf(_("File library"));
78 wprintf("</a><span>");
79 wprintf(_("(List files available for download)"));
80 wprintf("</span></li>\n");
85 /* start of third column */
87 wprintf("<ul class=\"adminitems lastcol\">");
89 wprintf("<li><a href=\"summary\">");
90 wprintf(_("Summary page"));
91 wprintf("</a><span>");
92 wprintf(_("Summary of my account"));
93 wprintf("</span></li>\n");
95 wprintf("<li><a href=\"userlist\">\n");
96 wprintf(_("User list"));
97 wprintf("</a><span>");
98 wprintf(_("(all registered users)"));
99 wprintf("</span></li>\n");
101 wprintf("<li><a href=\"termquit\" TARGET=\"_top\">");
102 wprintf(_("Log off"));
103 wprintf("</a><span>");
105 wprintf("</span></li>\n");
111 do_template("endbox", NULL);
114 "<tr valign=top><td width=50%%>");
116 print_menu_box(_("Your info"), "adminitems", 8,
117 "display_preferences", _("Change your preferences and settings"),
118 "display_reg", _("Update your contact information"),
119 "display_changepw", _("Change your password"),
120 "display_editbio", _("Enter your 'bio'"),
121 "display_editpic", _("Edit your online photo"),
122 "display_sieve", _("View/edit server-side mail filters"),
123 "display_pushemail", _("Edit your push email settings"),
124 "display_openids", _("Manage your OpenIDs")
127 wprintf("</td><td width=50%%>");
129 snprintf(buf, SIZ, _("Zap (forget) this room (%s)"), WC->wc_roomname);
131 if ( (WC->axlevel >= 6) || (WC->is_room_aide) || (WC->is_mailbox) )
132 print_menu_box(_("Advanced room commands"),"adminitems", 5,
133 "display_editroom", _("Edit or delete this room"),
134 "display_private", _("Go to a 'hidden' room"),
135 "display_entroom", _("Create a new room"),
137 "zapped_list",_("List all forgotten rooms"));
139 print_menu_box(_("Advanced room commands"),"adminitems", 4,
140 "display_private", _("Go to a 'hidden' room"),
141 "display_entroom", _("Create a new room"),
143 "zapped_list",_("List all forgotten rooms"));
145 wprintf("</td></tr></table></div>");
151 * System administration menu
153 void display_aide_menu(void)
155 output_headers(1, 1, 2, 0, 0, 0);
157 wprintf("<div id=\"banner\">\n");
159 wprintf(_("System Administration Menu"));
163 wprintf("<div id=\"content\" class=\"service\">");
165 wprintf("<div class=\"fix_scrollbar_bug\">"
167 "<tr valign=top><td width=50%% valign=\"top\">");
169 print_menu_box(_("Global Configuration"), "adminitems", 4,
170 "display_siteconfig", _("Edit site-wide configuration"),
171 "display_inetconf",_("Domain names and Internet mail configuration"),
172 "display_netconf", _("Configure replication with other Citadel servers"),
173 "display_smtpqueue", _("View the outbound SMTP queue"));
175 wprintf("</td><td width=50%% valign=\"top\">");
177 print_menu_box(_("User account management"), "adminitems", 2,
178 "select_user_to_edit", _("Add, change, delete user accounts"),
179 "validate", _("Validate new users"));
181 wprintf("</td></tr><tr><td width=50%% valign=\"top\">");
184 print_menu_box(_("Shutdown Citadel"), "adminitems", 3,
185 "server_shutdown?when=now", _("Restart Now"),
186 "server_shutdown?when=page", _("Restart after paging users"),
187 "server_shutdown?when=idle", _("Restart when all users are idle"));
189 wprintf("</td><td width=50%% valign=\"top\">");
191 print_menu_box(_("Rooms and Floors"), "adminitems", 1,
192 "display_floorconfig", _("Add, change, or delete floors"));
194 wprintf("</td></tr></table></div>");
201 * Display the screen to enter a generic server command
203 void display_generic(void)
205 output_headers(1, 1, 2, 0, 0, 0);
206 wprintf("<div id=\"banner\">\n");
208 wprintf(_("Enter a server command"));
212 wprintf("<div id=\"content\" class=\"service\">\n");
214 wprintf("<div class=\"fix_scrollbar_bug\">"
215 "<table class=\"mainmenu_background\"><tr><td>\n");
218 wprintf(_("This screen allows you to enter Citadel server commands which are "
219 "not supported by WebCit. If you do not know what that means, "
220 "then this screen will not be of much use to you."));
223 wprintf("<form method=\"post\" action=\"do_generic\">\n");
224 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
226 wprintf(_("Enter command:"));
227 wprintf("<br /><input type=\"text\" name=\"g_cmd\" size=80 maxlength=\"250\"><br />\n");
229 wprintf(_("Command input (if requesting SEND_LISTING transfer mode):"));
230 wprintf("<br /><textarea name=\"g_input\" rows=10 cols=80 width=80></textarea><br />\n");
232 wprintf("<font size=-2>");
233 wprintf(_("Detected host header is %s://%s"), (is_https ? "https" : "http"), WC->http_host);
234 wprintf("</font>\n");
235 wprintf("<input type=\"submit\" name=\"sc_button\" value=\"%s\">", _("Send command"));
237 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\"><br />\n", _("Cancel"));
239 wprintf("</form></center>\n");
240 wprintf("</td></tr></table></div>\n");
245 * Interactive window to perform generic Citadel server commands.
247 void do_generic(void)
254 if (!havebstr("sc_button")) {
259 output_headers(1, 1, 0, 0, 0, 0);
261 serv_printf("%s", bstr("g_cmd"));
262 serv_getln(buf, sizeof buf);
264 svput("BOXTITLE", WCS_STRING, _("Server command results"));
265 do_template("beginbox", NULL);
267 wprintf("<table border=0><tr><td>Command:</td><td><tt>");
268 escputs(bstr("g_cmd"));
269 wprintf("</tt></td></tr><tr><td>Result:</td><td><tt>");
271 wprintf("</tt></td></tr></table><br />\n");
274 serv_printf("\n\n000");
276 if ((buf[0] == '1') || (buf[0] == '8')) {
277 while (serv_getln(gcontent, sizeof gcontent), strcmp(gcontent, "000")) {
284 text_to_server(bstr("g_input"));
290 serv_read(junk, len);
296 memset(junk, 0, len);
297 serv_write(junk, len);
301 wprintf("<a href=\"display_generic\">Enter another command</a><br />\n");
302 wprintf("<a href=\"display_advanced\">Return to menu</a>\n");
303 do_template("endbox", NULL);
309 * Display the menubar.
311 * Set 'as_single_page' to display HTML headers and footers -- otherwise it's assumed
312 * that the menubar is being embedded in another page.
314 void display_menubar(int as_single_page) {
316 if (as_single_page) {
317 output_headers(0, 0, 0, 0, 0, 0);
320 "<title>MenuBar</title>\n"
321 "<style type=\"text/css\">\n"
322 "body { text-decoration: none; }\n"
325 do_template("background", NULL);
328 do_template("menubar", NULL);
330 if (as_single_page) {
339 * Display the wait / input dialog while restarting the server.
341 void display_shutdown(void)
347 if (!strcmp(when, "now")){
348 serv_printf("DOWN 1");
349 serv_getln(buf, sizeof buf);
350 if (atol(buf) == 500)
351 { /* upsie. maybe the server is not running as daemon? */
352 wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);
358 "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
360 "<body bgcolor=\"#FFFFFF\">\n"
361 "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
362 "</body>\n</html>\n",
363 _("Please wait while the Citadel server is restarted... ")
367 lingering_close(WC->http_sock);
372 else if (!strcmp(when, "page")) {
375 message = bstr("message");
376 if ((message == NULL) || (IsEmptyStr(message)))
378 output_headers(1, 1, 1, 0, 0, 0);
379 svput("BOXTITLE", WCS_STRING, _("Message to your Users:"));
380 do_template("beginbox", NULL);
381 wprintf("<form action=\"server_shutdown\">\n"
382 "<input type=\"hidden\" name=\"when\" value=\"page\">\n"
383 "<input type=\"text\" name=\"message\" value=\"%s\">\n"
384 "<input type=\"submit\" value=\"go\">\n"
386 _("The citadel server has to be restarted. It 'll be back in a minute.")
388 do_template("endbox", NULL);
395 // TODO: page the users... wait longer...
396 serv_printf("SEXP broadcast|%s", message);
397 serv_getln(buf, sizeof buf); // should we care?
400 "<meta http-equiv=\"refresh\" content=\"15; URL=knrooms\"/>\n"
402 "<body bgcolor=\"#FFFFFF\">\n"
403 "<img src=\"static/throbber.gif\" /> <font color=\"#AAAAAA\">%s </font>"
404 "</body>\n</html>\n",
405 _("Please wait while your users are being paged, the citadel server will be restarted after that... "));
409 else if (!strcmp(when, "idle")) {
410 serv_printf("SCDN 3");
411 serv_getln(buf, sizeof buf);
412 if (atol(buf) == 500) {
413 /* oops ... maybe the server is not running as a daemon? */
414 wprintf("<html><head></head><body>Attention: %s</body></html>", &buf[4]);
419 void _display_menubar(void) { display_menubar(0); }
425 WebcitAddUrlHandler(HKEY("display_aide_menu"), display_aide_menu, 0);
426 WebcitAddUrlHandler(HKEY("server_shutdown"), display_shutdown, 0);
427 WebcitAddUrlHandler(HKEY("display_main_menu"), display_main_menu, 0);
428 WebcitAddUrlHandler(HKEY("display_generic"), display_generic, 0);
429 WebcitAddUrlHandler(HKEY("do_generic"), do_generic, 0);
430 WebcitAddUrlHandler(HKEY("display_menubar"), _display_menubar, 0);