From 59d7006b05bb301e36f786b047b90ab9ef5be122 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 17 Mar 1998 11:44:16 +0000 Subject: - added "Full View"/"Normal View" on the "view config" page - added the ability to auto-refresh the status page. There is a problem with this (it can kill inetd!). Hopefully we can fix that. (This used to be commit 4488d8932fa072bf8a3ae236ab666618051b5e83) --- source3/web/statuspage.c | 33 +++++++++++++++++++++++++++++++++ source3/web/swat.c | 35 ++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 7 deletions(-) (limited to 'source3/web') diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index 3ba46ff14f..41681c2228 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -75,6 +75,9 @@ void status_page(void) struct connect_record crec; pstring fname; FILE *f; + char *v; + int autorefresh=0; + int refresh_interval=30; if (cgi_variable("smbd_start")) { start_smbd(); @@ -92,6 +95,23 @@ void status_page(void) stop_nmbd(); } + if (cgi_variable("autorefresh")) { + autorefresh = 1; + } else if (cgi_variable("norefresh")) { + autorefresh = 0; + } else if (cgi_variable("refresh")) { + autorefresh = 1; + } + + if ((v=cgi_variable("refresh_interval"))) { + refresh_interval = atoi(v); + } + + if (autorefresh) { + printf("\n", + refresh_interval, cgi_baseurl(), refresh_interval); + } + pstrcpy(fname,lp_lockdir()); standard_sub_basic(fname); trim_string(fname,"","/"); @@ -118,6 +138,19 @@ void status_page(void) printf("
\n"); + if (!autorefresh) { + printf("\n"); + printf("
Refresh Interval: "); + printf("\n", + refresh_interval); + } else { + printf("\n"); + printf("
Refresh Interval: %d\n", refresh_interval); + printf("\n"); + } + + printf("

\n"); + f = fopen(fname,"r"); if (!f) { printf("Couldn't open status file %s\n",fname); diff --git a/source3/web/swat.c b/source3/web/swat.c index 1a12d99ffd..a41249a9ee 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -168,6 +168,16 @@ static void show_parameters(int snum, int allparameters, int advanced, int print } +/* write a config file */ +static void write_config(FILE *f, BOOL show_defaults) +{ + fprintf(f, "# Samba config file created using SWAT\n"); + fprintf(f, "# Date: %s\n\n", timestring()); + + lp_dump(f, show_defaults); +} + + /* save and reoad the smb.conf config file */ static int save_reload(void) { @@ -179,11 +189,7 @@ static int save_reload(void) return 0; } - fprintf(f, "# Samba config file created using SWAT\n"); - fprintf(f, "# Date: %s\n\n", timestring()); - - lp_dump(f); - + write_config(f, False); fclose(f); lp_killunused(NULL); @@ -282,10 +288,25 @@ static void welcome_page(void) /* display the current smb.conf */ static void viewconfig_page(void) { + int full_view=0; + + if (cgi_variable("full_view")) { + full_view = 1; + } + printf("

Current Config

\n"); - printf("
");
-	include_html(servicesf);
+	printf("\n");
+
+	if (full_view) {
+		printf("\n");
+	} else {
+		printf("\n");
+	}
+
+	printf("

");
+	write_config(stdout, !full_view);
 	printf("
"); + printf("\n"); } -- cgit