X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fconfig%2Fconfig.cgi;h=ce96bc162d3b62c42aa88094fd62c45380acdb75;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=485565e8009b5b5c342b2f278a483d3f45aa543f;hpb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;p=freeside.git diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index 485565e80..ce96bc162 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -20,32 +20,49 @@ function SafeOnsubmit() { } -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %>
-Setting <% $key %> +Setting <% $key %> + +% my $description_printed = 0; +% if ( grep $_ eq 'textarea', @types ) { +% $description_printed = 1; + + - <% $description %> + +% }
% my $n = 0; -% foreach my $type ( ref($config_item->type) ? @{$config_item->type} : $config_item->type ) { +% foreach my $type (@types) { % if ( $type eq '' ) { no type +% } elsif ( $type eq 'image' ) { + + <% $conf->exists($key, $agentnum) + ? 'Current image
'. + '
' + : '' + %> + +
+ New image filename "> + % } elsif ( $type eq 'binary' ) { Filename "> % } elsif ( $type eq 'textarea' ) { - + % } elsif ( $type eq 'checkbox' ) { @@ -54,7 +71,7 @@ Setting <% $key %> % } elsif ( $type eq 'text' ) { - " type="text" value="<% $conf->exists($key, $agentnum) ? $conf->config($key, $agentnum) : '' %>"> + " type="text" value="<% $conf->exists($key, $agentnum) ? $conf->config($key, $agentnum) : '' |h %>"> % } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) { @@ -67,11 +84,9 @@ Setting <% $key %> % '' => '', map { $_ => $_ } @{ $config_item->select_enum }; % } elsif ( $config_item->select_hash ) { % if ( ref($config_item->select_hash) eq 'ARRAY' ) { -% tie %hash, 'Tie::IxHash', -% '' => '', @{ $config_item->select_hash }; +% tie %hash, 'Tie::IxHash', '' => '', @{ $config_item->select_hash }; % } else { -% tie %hash, 'Tie::IxHash', -% '' => '', %{ $config_item->select_hash }; +% tie %hash, 'Tie::IxHash', '' => '', %{ $config_item->select_hash }; % } % } else { % %hash = ( '' => 'WARNING: neither select_enum nor select_hash specified in Conf.pm for configuration option "'. $key. '"' ); @@ -252,15 +267,36 @@ Setting <% $key %>
(this.form)">
+% } elsif ( $element_types{$type} ) { +% +% my %opt = ( 'element_name' => "$key$n", +% 'empty_label' => ' ', +% 'showdisabled' => 1, +% ); +% if ( $config_item->multiple ) { +% $opt{'multiple'} = 1 if $config_item->multiple; +% $opt{'curr_value'} = [ $conf->config($key, $agentnum) ]; +% } else { +% $opt{'curr_value'} = +% $conf->exists($key, $agentnum) ? $conf->config($key, $agentnum) : ''; +% } + + <% include("/elements/$type.html", %opt ) %> + % } else { - unknown type $type + unknown type <% $type %> % } % $n++; % } - <% $description %> + +% unless ( $description_printed ) { + <% $description %> +% } + +
@@ -269,25 +305,28 @@ Setting <% $key %> <%once> my $conf = new FS::Conf; -my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ } - $conf->config_items; +my @config_items = $conf->config_items; my %confitems = map { $_->key => $_ } @config_items; +my %element_types = map { $_ => 1 } qw( + select-part_svc select-part_pkg select-pkg_class +); + <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my($agentnum, $agent, $title, $action, $key, $value, $config_item, - $description, $type); - -$action = 'Set'; +my $action = 'Set'; +my $agentnum = ''; if ($cgi->param('agentnum') =~ /(\d+)$/) { $agentnum=$1; } +my $agent = ''; +my $title; if ($agentnum) { $agent = qsearchs('agent', { 'agentnum' => $1 } ); die "Agent $agentnum not found!" unless $agent; @@ -298,11 +337,12 @@ if ($agentnum) { } $cgi->param('key') =~ /^([-.\w]+)$/ or die "illegal configuration item"; -$key=$1; -$value = $conf->config($key); -$config_item = $confitems{$key}; +my $key = $1; +my $value = $conf->config($key); +my $config_item = $confitems{$key}; -$description = $config_item->description; -$type = $config_item->type; +my $description = $config_item->description; +my $config_type = $config_item->type; +my @types = ref($config_type) ? @$config_type : ($config_type);