From e6b57805f6b3e76448ab9b6d280f2c53bc1410f3 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Oct 2001 15:29:31 +0000 Subject: preliminary web config editor new config files: username-ampersand, passwordmax fs-setup updates get rid of old and crufty and unused registries/ config foo documentation updates --- httemplate/config/config-process.cgi | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 httemplate/config/config-process.cgi (limited to 'httemplate/config/config-process.cgi') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi new file mode 100644 index 000000000..2dc4647ee --- /dev/null +++ b/httemplate/config/config-process.cgi @@ -0,0 +1,44 @@ +<% + my $conf = new FS::Conf; + $FS::Conf::DEBUG = 1; + my @config_items = $conf->config_items; + + foreach my $i ( @config_items ) { + my @touch = (); + my @delete = (); + my $n = 0; + foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { + if ( $type eq '' ) { + } elsif ( $type eq 'textarea' ) { + if ( $cgi->param($i->key. $n) ) { + $conf->set($i->key, $cgi->param($i->key. $n)); + } else { + $conf->delete($i->key); + } + } elsif ( $type eq 'checkbox' ) { +# if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) { + if ( defined $cgi->param($i->key. $n) ) { + #$conf->touch($i->key); + push @touch, $i->key; + } else { + #$conf->delete($i->key); + push @delete, $i->key; + } + } elsif ( $type eq 'text' ) { + if ( $cgi->param($i->key. $n) ) { + $conf->set($i->key, $cgi->param($i->key. $n)); + } else { + $conf->delete($i->key); + } + } else { + } + $n++; + } + # warn @touch; + $conf->touch($_) foreach @touch; + $conf->delete($_) foreach @delete; + } + +%> +<%= $cgi->redirect("config-view.cgi") %> + -- cgit v1.2.1 From 4308bf79cf9f31b6ec471788c34cde9b92a3c29b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Oct 2001 15:45:29 +0000 Subject: correct for browser munching --- httemplate/config/config-process.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate/config/config-process.cgi') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 2dc4647ee..99957ebd9 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -11,7 +11,9 @@ if ( $type eq '' ) { } elsif ( $type eq 'textarea' ) { if ( $cgi->param($i->key. $n) ) { - $conf->set($i->key, $cgi->param($i->key. $n)); + my $value = $cgi->param($i->key. $n); + $value =~ s/\r\n/\n/g; #browsers? + $conf->set($i->key, $value); } else { $conf->delete($i->key); } -- cgit v1.2.1 From 1904d44bb20adf403e21513db7470153f751d605 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Oct 2001 09:50:21 +0000 Subject: otherwise people will have problems with `0' zero --- httemplate/config/config-process.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/config/config-process.cgi') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 99957ebd9..690512977 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -10,7 +10,7 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { if ( $type eq '' ) { } elsif ( $type eq 'textarea' ) { - if ( $cgi->param($i->key. $n) ) { + if ( $cgi->param($i->key. $n) ne '' ) { my $value = $cgi->param($i->key. $n); $value =~ s/\r\n/\n/g; #browsers? $conf->set($i->key, $value); @@ -27,7 +27,7 @@ push @delete, $i->key; } } elsif ( $type eq 'text' ) { - if ( $cgi->param($i->key. $n) ) { + if ( $cgi->param($i->key. $n) ne '' ) { $conf->set($i->key, $cgi->param($i->key. $n)); } else { $conf->delete($i->key); -- cgit v1.2.1 From a4c96748eb6eab29a70f3a944c6520283a635c78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 16:05:22 +0000 Subject: *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. --- httemplate/config/config-process.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate/config/config-process.cgi') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 690512977..50f0d34ff 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -43,4 +43,3 @@ %> <%= $cgi->redirect("config-view.cgi") %> - -- cgit v1.2.1 From eca2a638625ac22a64b9807d9c4c7ee9a5090ebb Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 Feb 2002 12:31:40 +0000 Subject: fixup