diff options
Diffstat (limited to 'httemplate/config')
-rw-r--r-- | httemplate/config/config-delete.cgi | 15 | ||||
-rw-r--r-- | httemplate/config/config-process.cgi | 58 | ||||
-rw-r--r-- | httemplate/config/config-view.cgi | 2 | ||||
-rw-r--r-- | httemplate/config/config.cgi | 18 |
4 files changed, 8 insertions, 85 deletions
diff --git a/httemplate/config/config-delete.cgi b/httemplate/config/config-delete.cgi index 488886824..a05cb1e14 100644 --- a/httemplate/config/config-delete.cgi +++ b/httemplate/config/config-delete.cgi @@ -1,17 +1,6 @@ <%init> - -my $curuser = $FS::CurrentUser::CurrentUser; -die "access denied\n" unless $curuser->access_right('Configuration'); - -my $fsconf = new FS::Conf; -if ( $fsconf->exists('disable_settings_changes') ) { - my @changers = split(/\s*,\s*/, $fsconf->config('disable_settings_changes')); - my %changers = map { $_=>1 } @changers; - unless ( $changers{$curuser->username} ) { - errorpage("Disabled in web demo"); - die "shouldn't be reached"; - } -} +die "access denied\n" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); $cgi->param('confnum') =~ /^(\d+)$/ or die "illegal or missing confnum"; my $confnum = $1; diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 4e1c85a03..788d9016e 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -1,30 +1,3 @@ -%if ( scalar(@error) ) { -% -% my $url = popurl(1)."config.cgi"; -% if ( length($cgi->query_string) > 1920 ) { #stupid IE 2083 URL limit -% -% my $session = int(rand(4294967296)); #XXX -% my $pref = new FS::access_user_pref({ -% 'usernum' => $FS::CurrentUser::CurrentUser->usernum, -% 'prefname' => "redirect$session", -% 'prefvalue' => $cgi->query_string, -% 'expiration' => time + 3600, #1h? 1m? -% }); -% my $pref_error = $pref->insert; -% if ( $pref_error ) { -% die "FATAL: couldn't even set redirect cookie: $pref_error". -% " attempting to set redirect$session to ". $cgi->query_string."\n"; -% } -% -<% $cgi->redirect("$url?redirect=$session") %> -% -% } else { -% -<% $cgi->redirect("$url?". $cgi->query_string ) %> -% -% } -% -%} else { <% header('Configuration set') %> <SCRIPT TYPE="text/javascript"> % my $n = 0; @@ -73,7 +46,7 @@ % my $record = qsearchs($table, { $pkey => $key }); % my $value = $record ? "$key: ".$record->$namecol() : $key; configCell.innerHTML = <% $value |js_string %>; -% } elsif ( $type eq 'select-sub' && ! $i->multiple ) { +% } elsif ( $type eq 'select-sub' ) { configCell.innerHTML = <% $conf->config($i->key, $agentnum) |js_string %> + ': ' + <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) |js_string %>; @@ -88,7 +61,6 @@ </SCRIPT> </BODY> </HTML> -%} <%once> #false laziness w/config-view.cgi my %namecol = ( @@ -98,21 +70,10 @@ my %namecol = ( ); </%once> <%init> - -my $curuser = $FS::CurrentUser::CurrentUser; -die "access denied\n" unless $curuser->access_right('Configuration'); +die "access denied\n" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $conf = new FS::Conf; - -if ( $conf->exists('disable_settings_changes') ) { - my @changers = split(/\s*,\s*/, $conf->config('disable_settings_changes')); - my %changers = map { $_=>1 } @changers; - unless ( $changers{$curuser->username} ) { - errorpage_popup("Disabled in web demo"); - die "shouldn't be reached"; - } -} - $FS::Conf::DEBUG = 1; my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ } $conf->config_items; @@ -122,7 +83,6 @@ my $agentnum = $cgi->param('agentnum'); my $key = $cgi->param('key'); my $i = $confitems{$key}; -my @error = (); my @touch = (); my @delete = (); my $n = 0; @@ -132,8 +92,6 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { if ( $cgi->param($i->key.$n) ne '' ) { my $value = $cgi->param($i->key.$n); $value =~ s/\r\n/\n/g; #browsers? - my $error = &{$i->validate}($value, $n) if $i->validate; - push @error, $error if $error; $conf->set($i->key, $value, $agentnum); } else { $conf->delete($i->key, $agentnum); @@ -141,8 +99,6 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { } elsif ( $type eq 'binary' || $type eq 'image' ) { if ( defined($cgi->param($i->key.$n)) && $cgi->param($i->key.$n) ) { my $fh = $cgi->upload($i->key.$n); - my $error = &{$i->validate}($fh, $n) if $i->validate; - push @error, $error if $error; if (defined($fh)) { local $/; $conf->set_binary($i->key, <$fh>, $agentnum); @@ -162,16 +118,12 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { || $i->multiple ) ) { if ( scalar(@{[ $cgi->param($i->key.$n) ]}) ) { - my $error = &{$i->validate}([ $cgi->param($i->key.$n) ], $n) if $i->validate; - push @error, $error if $error; $conf->set($i->key, join("\n", @{[ $cgi->param($i->key.$n) ]} ), $agentnum); } else { $conf->delete($i->key, $agentnum); } } elsif ( $type =~ /^(text|select(-(sub|part_svc|part_pkg|pkg_class))?)$/ ) { if ( $cgi->param($i->key.$n) ne '' ) { - my $error = &{$i->validate}($cgi->param($i->key.$n), $n) if $i->validate; - push @error, $error if $error; $conf->set($i->key, $cgi->param($i->key.$n), $agentnum); } else { $conf->delete($i->key, $agentnum); @@ -183,8 +135,4 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { $conf->touch($_, $agentnum) foreach @touch; $conf->delete($_, $agentnum) foreach @delete; -if (scalar(@error)) { - $cgi->param('error', join(' ', @error)); -} - </%init> diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 11e75707c..08f6c1020 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -349,7 +349,7 @@ my @config_items = grep { $page_agent ? $_->per_agent : 1 } my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress ); my %deleteable = map { $_ => 1 } @deleteable; -my @sections = qw(required billing invoicing notification UI self-service username password session shell BIND ); +my @sections = qw(required billing invoicing UI self-service username password session shell BIND ); push @sections, '', 'deprecated'; my %section_items = (); diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index cde48382a..ce96bc162 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -131,11 +131,7 @@ Setting <b><% $key %></b> % } elsif ( $type eq 'select-sub' ) { - <select name="<% "$key$n" %>" <% $config_item->multiple ? 'MULTIPLE' : '' %>> - -% unless ( $config_item->multiple ) { - <option value=""> -% } + <select name="<% "$key$n" %>"><option value=""> % my %options = &{$config_item->options_sub}; % my @options = sort { $a <=> $b } keys %options; @@ -143,17 +139,7 @@ Setting <b><% $key %></b> % foreach my $value ( @options ) { % local($^W)=0; next if $saw{$value}++; - <option value="<% $value %>" - -% if ( $value eq $conf->config($key, $agentnum) -% || ( $config_item->multiple -% && grep { $_ eq $value } $conf->config($key, $agentnum) ) ){ - - SELECTED - -% } - - ><% $value %>: <% $options{$value} %> + <option value="<% $value %>" <% $value eq $conf->config($key, $agentnum) ? 'SELECTED' : '' %>><% $value %>: <% $options{$value} %> % } % my $curvalue = $conf->config($key, $agentnum); |