10 void display_main_menu(void)
13 output_headers(1, 0, 0, 0, 1, 0);
14 DoTemplate(HKEY("display_main_menu"), NULL, &NoCtx);
19 output_headers(1, 1, 1, 0, 0, 0);
21 wprintf("<div class=\"fix_scrollbar_bug\">"
22 "<table width=\"100%%\" cellspacing=\"10\" cellpadding=\"0\">"
23 "<tr><td colspan=\"2\" class=\"advanced\">\n");
25 svput("BOXTITLE", WCS_STRING, _("Basic commands"));
26 do_template("beginbox", NULL);
28 / * start of first column * /
29 wprintf("<ul class=\"adminitems col1\">");
31 wprintf("<li><a href=\"knrooms\">");
32 wprintf(_("List known rooms"));
33 wprintf("</a><span>");
34 wprintf(_("Where can I go from here?"));
35 wprintf("</span></li>\n");
37 wprintf("<li><a href=\"gotonext\">");
38 wprintf(_("Goto next room"));
39 wprintf("</a><span>");
40 wprintf(_("...with <em>unread</em> messages"));
41 wprintf("</span></li>\n");
43 wprintf("<li><a href=\"skip\">");
44 wprintf(_("Skip to next room"));
45 wprintf("</a><span>");
46 wprintf(_("(come back here later)"));
47 wprintf("</span></li>\n");
49 if ((!IsEmptyStr(WC->ugname)) && (strcasecmp(WC->ugname, WC->wc_roomname))) {
50 wprintf("<li><a href=\"ungoto\">");
52 wprintf("</a><span>");
53 wprintf(_("(oops! Back to %s)"), WC->ugname);
54 wprintf("</span></li>\n");
59 / * start of second column * /
61 wprintf("<ul class=\"adminitems col2\">");
63 wprintf("<li><a href=\"readnew\">");
64 wprintf(_("Read new messages"));
65 wprintf("</a><span>");
66 wprintf(_("...in this room"));
67 wprintf("</span></li>\n");
69 wprintf("<li><a href=\"readfwd\">");
70 wprintf(_("Read all messages"));
71 wprintf("</a><span>");
72 wprintf(_("...old <EM>and</EM> new"));
73 wprintf("</span></li>\n");
75 wprintf("<li><a href=\"display_enter\">");
76 wprintf(_("Enter a message"));
77 wprintf("</a><span>");
78 wprintf(_("(post in this room)"));
79 wprintf("</span></li>\n");
81 if (WC->room_flags & QR_VISDIR) {
82 wprintf("<li><a href=\"display_room_directory\">");
83 wprintf(_("File library"));
84 wprintf("</a><span>");
85 wprintf(_("(List files available for download)"));
86 wprintf("</span></li>\n");
91 / * start of third column * /
93 wprintf("<ul class=\"adminitems lastcol\">");
95 wprintf("<li><a href=\"summary\">");
96 wprintf(_("Summary page"));
97 wprintf("</a><span>");
98 wprintf(_("Summary of my account"));
99 wprintf("</span></li>\n");
101 wprintf("<li><a href=\"userlist\">\n");
102 wprintf(_("User list"));
103 wprintf("</a><span>");
104 wprintf(_("(all registered users)"));
105 wprintf("</span></li>\n");
107 wprintf("<li><a href=\"termquit\" TARGET=\"_top\">");
108 wprintf(_("Log off"));
109 wprintf("</a><span>");
111 wprintf("</span></li>\n");
117 do_template("endbox", NULL);
120 "<tr valign=top><td width=50%%>");
122 print_menu_box(_("Your info"), "adminitems", 8,
123 "display_preferences", _("Change your preferences and settings"),
124 "display_reg", _("Update your contact information"),
125 "display_changepw", _("Change your password"),
126 "display_editbio", _("Enter your 'bio'"),
127 "display_editpic", _("Edit your online photo"),
128 "display_sieve", _("View/edit server-side mail filters"),
129 "display_pushemail", _("Edit your push email settings"),
130 "display_openids", _("Manage your OpenIDs")
133 wprintf("</td><td width=50%%>");
135 snprintf(buf, SIZ, _("Zap (forget) this room (%s)"), WC->wc_roomname);
137 if ( (WC->axlevel >= 6) || (WC->is_room_aide) || (WC->is_mailbox) )
138 print_menu_box(_("Advanced room commands"),"adminitems", 5,
139 "display_editroom", _("Edit or delete this room"),
140 "display_private", _("Go to a 'hidden' room"),
141 "display_entroom", _("Create a new room"),
143 "zapped_list",_("List all forgotten rooms"));
145 print_menu_box(_("Advanced room commands"),"adminitems", 4,
146 "display_private", _("Go to a 'hidden' room"),
147 "display_entroom", _("Create a new room"),
149 "zapped_list",_("List all forgotten rooms"));
151 wprintf("</td></tr></table></div>");
158 * System administration menu
160 void display_aide_menu(void)
163 output_headers(1, 0, 0, 0, 1, 0);
164 DoTemplate(HKEY("display_aide_menu"), NULL, &NoCtx);
167 output_headers(1, 1, 2, 0, 0, 0);
169 wprintf("<div id=\"banner\">\n");
171 wprintf(_("System Administration Menu"));
175 wprintf("<div id=\"content\" class=\"service\">");
177 wprintf("<div class=\"fix_scrollbar_bug\">"
179 "<tr valign=top><td width=50%% valign=\"top\">");
181 print_menu_box(_("Global Configuration"), "adminitems", 4,
182 "display_siteconfig", _("Edit site-wide configuration"),
183 "display_inetconf",_("Domain names and Internet mail configuration"),
184 "display_netconf", _("Configure replication with other Citadel servers"),
185 "display_smtpqueue", _("View the outbound SMTP queue"));
187 wprintf("</td><td width=50%% valign=\"top\">");
189 print_menu_box(_("User account management"), "adminitems", 2,
190 "select_user_to_edit", _("Add, change, delete user accounts"),
191 "validate", _("Validate new users"));
193 wprintf("</td></tr><tr><td width=50%% valign=\"top\">");
196 print_menu_box(_("Shutdown Citadel"), "adminitems", 3,
197 "server_shutdown?when=now", _("Restart Now"),
198 "server_shutdown?when=page", _("Restart after paging users"),
199 "server_shutdown?when=idle", _("Restart when all users are idle"));
201 wprintf("</td><td width=50%% valign=\"top\">");
203 print_menu_box(_("Rooms and Floors"), "adminitems", 1,
204 "display_floorconfig", _("Add, change, or delete floors"));
206 wprintf("</td></tr></table></div>");
214 * Display the screen to enter a generic server command
216 void display_generic(void)
218 output_headers(1, 1, 2, 0, 0, 0);
219 wprintf("<div id=\"banner\">\n");
221 wprintf(_("Enter a server command"));
225 wprintf("<div id=\"content\" class=\"service\">\n");
227 wprintf("<div class=\"fix_scrollbar_bug\">"
228 "<table class=\"mainmenu_background\"><tr><td>\n");
231 wprintf(_("This screen allows you to enter Citadel server commands which are "
232 "not supported by WebCit. If you do not know what that means, "
233 "then this screen will not be of much use to you."));
236 wprintf("<form method=\"post\" action=\"do_generic\">\n");
237 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
239 wprintf(_("Enter command:"));
240 wprintf("<br /><input type=\"text\" name=\"g_cmd\" size=80 maxlength=\"250\"><br />\n");
242 wprintf(_("Command input (if requesting SEND_LISTING transfer mode):"));
243 wprintf("<br /><textarea name=\"g_input\" rows=10 cols=80 width=80></textarea><br />\n");
245 wprintf("<font size=-2>");
246 wprintf(_("Detected host header is %s://%s"), (is_https ? "https" : "http"), ChrPtr(WC->http_host));
247 wprintf("</font>\n");
248 wprintf("<input type=\"submit\" name=\"sc_button\" value=\"%s\">", _("Send command"));
250 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\"><br />\n", _("Cancel"));
252 wprintf("</form></center>\n");
253 wprintf("</td></tr></table></div>\n");
258 * Interactive window to perform generic Citadel server commands.
260 void do_generic(void)
269 if (!havebstr("sc_button")) {
274 output_headers(1, 1, 0, 0, 0, 0);
276 serv_puts(bstr("g_cmd"));
278 svput("BOXTITLE", WCS_STRING, _("Server command results"));
279 do_template("beginboxx", NULL);
281 wprintf("<table border=0><tr><td>Command:</td><td><tt>");
282 StrEscAppend(WCC->WBuf, sbstr("g_cmd"), NULL, 0, 0);
283 wprintf("</tt></td></tr><tr><td>Result:</td><td><tt>");
284 StrEscAppend(WCC->WBuf, Buf, NULL, 0, 0);
285 StrBufAppendBufPlain(WCC->WBuf, HKEY("<br>\n"), 0);
286 wprintf("</tt></td></tr></table><br />\n");
288 switch (GetServerStatus(Buf, NULL)) {
290 serv_puts("\n\n000");
291 if ( (StrLength(Buf)==3) &&
292 !strcmp(ChrPtr(Buf), "000")) {
293 StrBufAppendBufPlain(WCC->WBuf, HKEY("\000"), 0);
298 StrBuf_ServGetln(Buf);
299 if ( (StrLength(Buf)==3) &&
300 !strcmp(ChrPtr(Buf), "000")) {
303 StrEscAppend(WCC->WBuf, Buf, NULL, 0, 0);
304 StrBufAppendBufPlain(WCC->WBuf, HKEY("<br>\n"), 0);
308 text_to_server(bstr("g_input"));
312 len = atol(&ChrPtr(Buf)[4]);
313 StrBuf_ServGetBLOBBuffered(Buf, len);
316 len = atol(&ChrPtr(Buf)[4]);
318 memset(junk, 0, len);
319 serv_write(junk, len);
324 wprintf("<a href=\"display_generic\">Enter another command</a><br />\n");
325 wprintf("<a href=\"display_advanced\">Return to menu</a>\n");
326 do_template("endbox", NULL);
332 * Display the menubar.
334 * Set 'as_single_page' to display HTML headers and footers -- otherwise it's assumed
335 * that the menubar is being embedded in another page.
337 void display_menubar(int as_single_page) {
339 if (as_single_page) {
340 output_headers(0, 0, 0, 0, 0, 0);
343 "<title>MenuBar</title>\n"
344 "<style type=\"text/css\">\n"
345 "body { text-decoration: none; }\n"
348 do_template("background", NULL);
351 do_template("menubar", NULL);
353 if (as_single_page) {
362 * Display the wait / input dialog while restarting the server.
364 void display_shutdown(void)
370 if (strcmp(when, "now") == 0){
371 serv_printf("DOWN 1");
372 serv_getln(buf, sizeof buf);
373 if (atol(buf) == 500)
374 { /* upsie. maybe the server is not running as daemon? */
376 safestrncpy(WC->ImportantMessage,
378 sizeof WC->ImportantMessage);
381 output_headers(1, 0, 0, 0, 1, 0);
382 DoTemplate(HKEY("display_serverrestart"), NULL, &NoCtx);
384 lingering_close(WC->http_sock);
389 else if (strcmp(when, "page") == 0) {
392 message = bstr("message");
393 if ((message == NULL) || (IsEmptyStr(message)))
396 output_headers(1, 0, 0, 0, 1, 0);
397 DoTemplate(HKEY("display_serverrestartpage"), NULL, &NoCtx);
402 serv_printf("SEXP broadcast|%s", message);
403 serv_getln(buf, sizeof buf); /* TODO: should we care? */
405 output_headers(1, 0, 0, 0, 1, 0);
406 DoTemplate(HKEY("display_serverrestartpagedo"), NULL, &NoCtx);
410 else if (!strcmp(when, "idle")) {
411 serv_printf("SCDN 3");
412 serv_getln(buf, sizeof buf);
414 if (atol(buf) == 500)
415 { /* upsie. maybe the server is not running as daemon? */
416 safestrncpy(WC->ImportantMessage,
418 sizeof WC->ImportantMessage);
421 output_headers(1, 0, 0, 0, 1, 0);
422 DoTemplate(HKEY("display_aide_menu"), NULL, &NoCtx);
427 void _display_menubar(void) { display_menubar(0); }
433 WebcitAddUrlHandler(HKEY("display_aide_menu"), display_aide_menu, 0);
434 WebcitAddUrlHandler(HKEY("server_shutdown"), display_shutdown, 0);
435 WebcitAddUrlHandler(HKEY("display_main_menu"), display_main_menu, 0);
436 WebcitAddUrlHandler(HKEY("display_generic"), display_generic, 0);
437 WebcitAddUrlHandler(HKEY("do_generic"), do_generic, 0);
438 WebcitAddUrlHandler(HKEY("display_menubar"), _display_menubar, 0);