preliminary web config editor
[freeside.git] / httemplate / config / config-process.cgi
1 <%
2   my $conf = new FS::Conf;
3   $FS::Conf::DEBUG = 1;
4   my @config_items = $conf->config_items;
5
6   foreach my $i ( @config_items ) {
7     my @touch = ();
8     my @delete = ();
9     my $n = 0;
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) ) {
14           $conf->set($i->key, $cgi->param($i->key. $n));
15         } else {
16           $conf->delete($i->key);
17         }
18       } elsif ( $type eq 'checkbox' ) {
19 #        if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) {
20         if ( defined $cgi->param($i->key. $n) ) {
21           #$conf->touch($i->key);
22           push @touch, $i->key;
23         } else {
24           #$conf->delete($i->key);
25           push @delete, $i->key;
26         }
27       } elsif ( $type eq 'text' )  {
28         if ( $cgi->param($i->key. $n) ) {
29           $conf->set($i->key, $cgi->param($i->key. $n));
30         } else {
31           $conf->delete($i->key);
32         }
33       } else {
34       }
35       $n++;
36     }
37    # warn @touch;
38     $conf->touch($_) foreach @touch;
39     $conf->delete($_) foreach @delete;
40   }
41
42 %>
43 <%= $cgi->redirect("config-view.cgi") %>
44