From: Wilfried Göesgens Date: Thu, 22 Jul 2010 21:02:58 +0000 (+0000) Subject: * templatize manual post X-Git-Tag: v8.01~1015 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=e4961bbeab85f60cd019135ba61421104f0b8ddc;p=citadel.git * templatize manual post --- diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index b2831714b..6bb1171a5 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -28,60 +28,15 @@ void display_aide_menu(void) } - -/* - * Display the screen to enter a generic server command - */ -void display_generic(void) -{ - output_headers(1, 1, 2, 0, 0, 0); - wc_printf("
\n"); - wc_printf("

"); - wc_printf(_("Enter a server command")); - wc_printf("

"); - wc_printf("
\n"); - - wc_printf("
\n"); - - wc_printf("
" - "
\n"); - - wc_printf("
"); - wc_printf(_("This screen allows you to enter Citadel server commands which are " - "not supported by WebCit. If you do not know what that means, " - "then this screen will not be of much use to you.")); - wc_printf("
\n"); - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - - wc_printf(_("Enter command:")); - wc_printf("

\n"); - - wc_printf(_("Command input (if requesting SEND_LISTING transfer mode):")); - wc_printf("

\n"); - - wc_printf(""); - wc_printf(_("Detected host header is %s://%s"), (is_https ? "https" : "http"), ChrPtr(WC->Hdr->HR.http_host)); - wc_printf("\n"); - wc_printf("", _("Send command")); - wc_printf(" "); - wc_printf("
\n", _("Cancel")); - - wc_printf("
\n"); - wc_printf("
\n"); - wDumpContent(1); -} - /* * Interactive window to perform generic Citadel server commands. */ void do_generic(void) { - - wcsession *WCC = WC; + WCTemplputParams SubTP; int Done = 0; StrBuf *Buf; + StrBuf *LineBuf; char *junk; size_t len; @@ -90,38 +45,34 @@ void do_generic(void) return; } - output_headers(1, 1, 0, 0, 0, 0); + memset(&SubTP, 0, sizeof(WCTemplputParams)); Buf = NewStrBuf(); serv_puts(bstr("g_cmd")); StrBuf_ServGetln(Buf); - svput("BOXTITLE", WCS_STRING, _("Server command results")); - do_template("beginboxx", NULL); - - wc_printf("
Command:"); - StrEscAppend(WCC->WBuf, sbstr("g_cmd"), NULL, 0, 0); - wc_printf("
Result:"); - StrEscAppend(WCC->WBuf, Buf, NULL, 0, 0); - StrBufAppendBufPlain(WCC->WBuf, HKEY("
\n"), 0); - wc_printf("

\n"); switch (GetServerStatus(Buf, NULL)) { case 8: serv_puts("\n\n000"); if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { - StrBufAppendBufPlain(WCC->WBuf, HKEY("\000"), 0); + StrBufAppendBufPlain(Buf, HKEY("\000"), 0); break; } case 1: + LineBuf = NewStrBuf(); + StrBufAppendBufPlain(Buf, HKEY("\n"), 0); while (!Done) { - StrBuf_ServGetln(Buf); - if ( (StrLength(Buf)==3) && - !strcmp(ChrPtr(Buf), "000")) { + StrBuf_ServGetln(LineBuf); + if ( (StrLength(LineBuf)==3) && + !strcmp(ChrPtr(LineBuf), "000")) { Done = 1; } - StrEscAppend(WCC->WBuf, Buf, NULL, 0, 0); - StrBufAppendBufPlain(WCC->WBuf, HKEY("
\n"), 0); + StrBufAppendBuf(Buf, LineBuf, 0); + StrBufAppendBufPlain(Buf, HKEY("\n"), 0); } + FreeStrBuf(&LineBuf); + break; + case 2: break; case 4: text_to_server(bstr("g_input")); @@ -137,47 +88,22 @@ void do_generic(void) memset(junk, 0, len); serv_write(junk, len); free(junk); + break; } - wc_printf("
"); - wc_printf("Enter another command
\n"); - wc_printf("Return to menu\n"); - do_template("endbox", NULL); - FreeStrBuf(&Buf); - wDumpContent(1); -} - - -/* - * Display the menubar. - * - * Set 'as_single_page' to display HTML headers and footers -- otherwise it's assumed - * that the menubar is being embedded in another page. - */ -void display_menubar(int as_single_page) { - - if (as_single_page) { - output_headers(0, 0, 0, 0, 0, 0); - wc_printf("\n" - "\n" - "MenuBar\n" - "\n" - "\n"); - do_template("background", NULL); - } + begin_burst(); + output_headers(1, 0, 0, 0, 1, 0); - do_template("menubar", NULL); + SubTP.Filter.ContextType = CTX_STRBUF; + SubTP.Context = Buf; - if (as_single_page) { - wDumpContent(2); - } + DoTemplate(HKEY("aide_display_generic_result"), NULL, &SubTP); + wDumpContent(1); + FreeStrBuf(&Buf); } - /* * Display the wait / input dialog while restarting the server. */ @@ -244,8 +170,6 @@ void display_shutdown(void) } } -void _display_menubar(void) { display_menubar(0); } - void InitModule_MAINMENU (void) @@ -253,7 +177,5 @@ InitModule_MAINMENU WebcitAddUrlHandler(HKEY("display_aide_menu"), "", 0, display_aide_menu, 0); WebcitAddUrlHandler(HKEY("server_shutdown"), "", 0, display_shutdown, 0); WebcitAddUrlHandler(HKEY("display_main_menu"), "", 0, display_main_menu, 0); - WebcitAddUrlHandler(HKEY("display_generic"), "", 0, display_generic, 0); WebcitAddUrlHandler(HKEY("do_generic"), "", 0, do_generic, 0); - WebcitAddUrlHandler(HKEY("display_menubar"), "", 0, _display_menubar, 0); } diff --git a/webcit/static/t/aide/display_generic_cmd.html b/webcit/static/t/aide/display_generic_cmd.html new file mode 100644 index 000000000..549229b00 --- /dev/null +++ b/webcit/static/t/aide/display_generic_cmd.html @@ -0,0 +1,32 @@ + + + +
+
+ + + + + +
+ diff --git a/webcit/static/t/aide/display_generic_result.html b/webcit/static/t/aide/display_generic_result.html new file mode 100644 index 000000000..809d5d7bd --- /dev/null +++ b/webcit/static/t/aide/display_generic_result.html @@ -0,0 +1,23 @@ + + + + + + +
Command: + + + +
Result: + + + +
+

+
+
+ + +
+ +