6 void display_main_menu(void)
9 output_headers(1, 0, 0, 0, 1, 0);
10 DoTemplate(HKEY("display_main_menu"), NULL, &NoCtx);
16 * System administration menu
18 void display_aide_menu(void)
21 output_headers(1, 0, 0, 0, 1, 0);
22 DoTemplate(HKEY("aide_display_menu"), NULL, &NoCtx);
28 * Interactive window to perform generic Citadel server commands.
32 WCTemplputParams SubTP;
39 if (!havebstr("sc_button")) {
45 serv_puts(bstr("g_cmd"));
46 StrBuf_ServGetln(Buf);
48 switch (GetServerStatus(Buf, NULL)) {
51 if ( (StrLength(Buf)==3) &&
52 !strcmp(ChrPtr(Buf), "000")) {
53 StrBufAppendBufPlain(Buf, HKEY("\000"), 0);
57 LineBuf = NewStrBuf();
58 StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
60 if (StrBuf_ServGetln(LineBuf) < 0)
62 if ( (StrLength(LineBuf)==3) &&
63 !strcmp(ChrPtr(LineBuf), "000")) {
66 StrBufAppendBuf(Buf, LineBuf, 0);
67 StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
74 text_to_server(bstr("g_input"));
78 len = atol(&ChrPtr(Buf)[4]);
79 StrBuf_ServGetBLOBBuffered(Buf, len);
82 len = atol(&ChrPtr(Buf)[4]);
85 serv_write(junk, len);
91 output_headers(1, 0, 0, 0, 1, 0);
93 StackContext(NULL, &SubTP, Buf, CTX_STRBUF, 0, NULL);
95 DoTemplate(HKEY("aide_display_generic_result"), NULL, &SubTP);
97 UnStackContext(&SubTP);
104 * Display the wait / input dialog while restarting the server.
106 void display_shutdown(void)
113 if (strcmp(when, "now") == 0){
114 serv_printf("DOWN 1");
115 StrBuf_ServGetln(Line);
116 GetServerStatusMsg(Line, NULL, 1, 5);
119 output_headers(1, 0, 0, 0, 1, 0);
120 DoTemplate(HKEY("aide_display_serverrestart"), NULL, &NoCtx);
122 lingering_close(WC->Hdr->http_sock);
127 else if (strcmp(when, "page") == 0) {
130 message = bstr("message");
131 if ((message == NULL) || (IsEmptyStr(message)))
134 output_headers(1, 0, 0, 0, 1, 0);
135 DoTemplate(HKEY("aide_display_serverrestart_page"), NULL, &NoCtx);
140 serv_printf("SEXP broadcast|%s", message);
141 StrBuf_ServGetln(Line);
142 GetServerStatusMsg(Line, NULL, 1, 0);
145 output_headers(1, 0, 0, 0, 1, 0);
146 DoTemplate(HKEY("aide_display_serverrestart_page"), NULL, &NoCtx);
150 else if (!strcmp(when, "idle")) {
151 serv_printf("SCDN 3");
152 StrBuf_ServGetln(Line);
153 GetServerStatusMsg(Line, NULL, 1, 2);
156 output_headers(1, 0, 0, 0, 1, 0);
157 DoTemplate(HKEY("aide_display_menu"), NULL, &NoCtx);
167 WebcitAddUrlHandler(HKEY("display_aide_menu"), "", 0, display_aide_menu, 0);
168 WebcitAddUrlHandler(HKEY("server_shutdown"), "", 0, display_shutdown, 0);
169 WebcitAddUrlHandler(HKEY("display_main_menu"), "", 0, display_main_menu, 0);
170 WebcitAddUrlHandler(HKEY("do_generic"), "", 0, do_generic, 0);