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 if (StrBuf_ServGetln(LineBuf) < 0)
63 if ( (StrLength(LineBuf)==3) &&
64 !strcmp(ChrPtr(LineBuf), "000")) {
67 StrBufAppendBuf(Buf, LineBuf, 0);
68 StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
75 text_to_server(bstr("g_input"));
79 len = atol(&ChrPtr(Buf)[4]);
80 StrBuf_ServGetBLOBBuffered(Buf, len);
83 len = atol(&ChrPtr(Buf)[4]);
86 serv_write(junk, len);
92 output_headers(1, 0, 0, 0, 1, 0);
94 SubTP.Filter.ContextType = CTX_STRBUF;
97 DoTemplate(HKEY("aide_display_generic_result"), NULL, &SubTP);
105 * Display the wait / input dialog while restarting the server.
107 void display_shutdown(void)
113 if (strcmp(when, "now") == 0){
114 serv_printf("DOWN 1");
115 serv_getln(buf, sizeof buf);
116 if (atol(buf) == 500)
117 { /* upsie. maybe the server is not running as daemon? */
119 safestrncpy(WC->ImportantMessage,
121 sizeof WC->ImportantMessage);
124 output_headers(1, 0, 0, 0, 1, 0);
125 DoTemplate(HKEY("aide_display_serverrestart"), NULL, &NoCtx);
127 lingering_close(WC->Hdr->http_sock);
132 else if (strcmp(when, "page") == 0) {
135 message = bstr("message");
136 if ((message == NULL) || (IsEmptyStr(message)))
139 output_headers(1, 0, 0, 0, 1, 0);
140 DoTemplate(HKEY("aide_display_serverrestart_page"), NULL, &NoCtx);
145 serv_printf("SEXP broadcast|%s", message);
146 serv_getln(buf, sizeof buf); /* TODO: should we care? */
148 output_headers(1, 0, 0, 0, 1, 0);
149 DoTemplate(HKEY("aide_display_serverrestart_page"), NULL, &NoCtx);
153 else if (!strcmp(when, "idle")) {
154 serv_printf("SCDN 3");
155 serv_getln(buf, sizeof buf);
157 if (atol(buf) == 500)
158 { /* upsie. maybe the server is not running as daemon? */
159 safestrncpy(WC->ImportantMessage,
161 sizeof WC->ImportantMessage);
164 output_headers(1, 0, 0, 0, 1, 0);
165 DoTemplate(HKEY("aide_display_menu"), NULL, &NoCtx);
174 WebcitAddUrlHandler(HKEY("display_aide_menu"), "", 0, display_aide_menu, 0);
175 WebcitAddUrlHandler(HKEY("server_shutdown"), "", 0, display_shutdown, 0);
176 WebcitAddUrlHandler(HKEY("display_main_menu"), "", 0, display_main_menu, 0);
177 WebcitAddUrlHandler(HKEY("do_generic"), "", 0, do_generic, 0);