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")) {
44 memset(&SubTP, 0, sizeof(WCTemplputParams));
46 serv_puts(bstr("g_cmd"));
47 StrBuf_ServGetln(Buf);
49 switch (GetServerStatus(Buf, NULL)) {
52 if ( (StrLength(Buf)==3) &&
53 !strcmp(ChrPtr(Buf), "000")) {
54 StrBufAppendBufPlain(Buf, HKEY("\000"), 0);
58 LineBuf = NewStrBuf();
59 StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
61 StrBuf_ServGetln(LineBuf);
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 SubTP.Filter.ContextType = CTX_STRBUF;
96 DoTemplate(HKEY("aide_display_generic_result"), NULL, &SubTP);
104 * Display the wait / input dialog while restarting the server.
106 void display_shutdown(void)
112 if (strcmp(when, "now") == 0){
113 serv_printf("DOWN 1");
114 serv_getln(buf, sizeof buf);
115 if (atol(buf) == 500)
116 { /* upsie. maybe the server is not running as daemon? */
118 safestrncpy(WC->ImportantMessage,
120 sizeof WC->ImportantMessage);
123 output_headers(1, 0, 0, 0, 1, 0);
124 DoTemplate(HKEY("aide_display_serverrestart"), NULL, &NoCtx);
126 lingering_close(WC->Hdr->http_sock);
131 else if (strcmp(when, "page") == 0) {
134 message = bstr("message");
135 if ((message == NULL) || (IsEmptyStr(message)))
138 output_headers(1, 0, 0, 0, 1, 0);
139 DoTemplate(HKEY("aide_display_serverrestart_page"), NULL, &NoCtx);
144 serv_printf("SEXP broadcast|%s", message);
145 serv_getln(buf, sizeof buf); /* TODO: should we care? */
147 output_headers(1, 0, 0, 0, 1, 0);
148 DoTemplate(HKEY("aide_display_serverrestart_page"), NULL, &NoCtx);
152 else if (!strcmp(when, "idle")) {
153 serv_printf("SCDN 3");
154 serv_getln(buf, sizeof buf);
156 if (atol(buf) == 500)
157 { /* upsie. maybe the server is not running as daemon? */
158 safestrncpy(WC->ImportantMessage,
160 sizeof WC->ImportantMessage);
163 output_headers(1, 0, 0, 0, 1, 0);
164 DoTemplate(HKEY("aide_display_menu"), NULL, &NoCtx);
173 WebcitAddUrlHandler(HKEY("display_aide_menu"), "", 0, display_aide_menu, 0);
174 WebcitAddUrlHandler(HKEY("server_shutdown"), "", 0, display_shutdown, 0);
175 WebcitAddUrlHandler(HKEY("display_main_menu"), "", 0, display_main_menu, 0);
176 WebcitAddUrlHandler(HKEY("do_generic"), "", 0, do_generic, 0);