From cc0c6be1aa795f85d05f15a3e8568fcef2bbd380 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 18 Jul 2007 18:07:38 +0000 Subject: config in database cleanup, editing, and agent-specific config (452, 1419) --- httemplate/browse/agent.cgi | 22 ++ httemplate/config/config-delete.cgi | 15 ++ httemplate/config/config-download.cgi | 18 +- httemplate/config/config-process.cgi | 109 +++++---- httemplate/config/config-view.cgi | 57 ++++- httemplate/config/config.cgi | 423 ++++++++++++++++++---------------- 6 files changed, 380 insertions(+), 264 deletions(-) create mode 100644 httemplate/config/config-delete.cgi (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 063f259de..83e79a2f3 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -38,6 +38,7 @@ full offerings (via their type).

% } Payment Gateway Overrides + Configuration Overrides Freq. Prog. @@ -344,6 +345,27 @@ Unused + + +% foreach my $override ( +% qsearch('conf', { 'agentnum' => $agent->agentnum } ) +% ) { +% + + + + +% } + + + + +
+ <% $override->name %> + (delete) +
(add override)
+ + +% } elsif ( $config_item->editlist_parts->[$pnum]{type} eq 'immutable' ) { - -% } elsif ( $type eq 'editlist' ) { - - - - "> + -
- - -
- <% itable() %> -% if ( defined $i->editlist_parts ) { -% my $pnum=0; foreach my $part ( @{$i->editlist_parts} ) { +% foreach my $line ( $conf->config($key, $agentnum) ) { - -% if ( $part->{type} eq 'text' ) { + - "> -% } elsif ( $part->{type} eq 'immutable' ) { +% } - <% $part->{value} %>" value="<% $part->{value} %>"> -% } elsif ( $part->{type} eq 'select' ) { +
+ ()"> + +
<% itable() %> - -% } else { +% if ( $part->{type} eq 'text' ) { - unknown type <% $part->type %> -% } + "> - -% $pnum++; } -% } else { +% } elsif ( $part->{type} eq 'immutable' ) { - -% } + <% $part->{value} %> + " value="<% $part->{value} %>"> - - -% } else { +% } elsif ( $part->{type} eq 'select' ) { + -

-% } +% } else { + + unknown type <% $part->type %> + +% } + + + +% $pnum++; +% } +% } else { + > - +% } + + (this.form)"> + + +% } else { + + unknown type $type + +% } +% $n++; +% } + + <% $description %> + + + + + +<%once> +my $conf = new FS::Conf; +my %confitems = map { $_->key => $_ } $conf->config_items; + - <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my($agentnum, $agent, $title, $action, $key, $value, $config_item, + $description, $type); + +$action = 'Set'; + +if ($cgi->param('agentnum') =~ /(\d+)$/) { + $agentnum=$1; +} + +if ($agentnum) { + $agent = qsearchs('agent', { 'agentnum' => $1 } ); + die "Agent $agentnum not found!" unless $agent; + + $title = "$action configuration override for ". $agent->agent; +} else { + $title = "$action global configuration"; +} + +$cgi->param('key') =~ /^([-.\w]+)$/ or die "illegal configuration item"; +$key=$1; +$value = $conf->config($key); +$config_item = $confitems{$key}; + +$description = $config_item->description; +$type = $config_item->type; + -- cgit v1.2.1