X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fconfig%2Fconfig-process.cgi;h=fe04b324c6a2138fc1affbd40d719f1df39e754f;hp=99957ebd9a3e8dbf8cdfdc4825fd361f4e6ef7f6;hb=3ce7691203a7737406bf2d4442f7fd84b81f847e;hpb=4308bf79cf9f31b6ec471788c34cde9b92a3c29b diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 99957ebd9..fe04b324c 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -1,46 +1,52 @@ -<% - 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) ) { - my $value = $cgi->param($i->key. $n); - $value =~ s/\r\n/\n/g; #browsers? - $conf->set($i->key, $value); - } 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") %> +% +% 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) ne '' ) { +% my $value = $cgi->param($i->key. $n); +% $value =~ s/\r\n/\n/g; #browsers? +% $conf->set($i->key, $value); +% } 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' || $type eq 'select' ) { +% if ( $cgi->param($i->key. $n) ne '' ) { +% $conf->set($i->key, $cgi->param($i->key. $n)); +% } else { +% $conf->delete($i->key); +% } +% } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' ) { +% if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) { +% $conf->set($i->key, join("\n", @{[ $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") %>