2 % my $conf = new FS::Conf;
3 % $FS::Conf::DEBUG = 1;
4 % my @config_items = $conf->config_items;
6 % foreach my $i ( @config_items ) {
10 % foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
11 % if ( $type eq '' ) {
12 % } elsif ( $type eq 'textarea' ) {
13 % if ( $cgi->param($i->key. $n) ne '' ) {
14 % my $value = $cgi->param($i->key. $n);
15 % $value =~ s/\r\n/\n/g; #browsers?
16 % $conf->set($i->key, $value);
18 % $conf->delete($i->key);
20 % } elsif ( $type eq 'checkbox' ) {
21 %# if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) {
22 % if ( defined $cgi->param($i->key. $n) ) {
23 % #$conf->touch($i->key);
24 % push @touch, $i->key;
26 % #$conf->delete($i->key);
27 % push @delete, $i->key;
29 % } elsif ( $type eq 'text' || $type eq 'select' || $type eq 'select-sub' ) {
30 % if ( $cgi->param($i->key. $n) ne '' ) {
31 % $conf->set($i->key, $cgi->param($i->key. $n));
33 % $conf->delete($i->key);
35 % } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' ) {
36 % if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) {
37 % $conf->set($i->key, join("\n", @{[ $cgi->param($i->key. $n) ]} ));
39 % $conf->delete($i->key);
46 % $conf->touch($_) foreach @touch;
47 % $conf->delete($_) foreach @delete;
52 <% $cgi->redirect("config-view.cgi") %>