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/config/config-view.cgi | 57 +++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 11 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 7f2a1b293..5f2166320 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -1,6 +1,22 @@ -<% include("/elements/header.html",'View Configuration', menubar( 'Main Menu' => $p, - 'Edit Configuration' => 'config.cgi' ) ) %> -% my $conf = new FS::Conf; my @config_items = $conf->config_items; +<% include("/elements/header.html", + $title, + menubar( + 'Main Menu' => $p, + 'View all agents' => $p.'browse/agent.cgi', + ) + ) +%> + + + + + + +% if ($FS::UID::use_confcompat) { + + CONFIGURATION NOT STORED IN DATABASE -- USING COMPATIBILITY MODE

+%} +% % foreach my $section ( qw(required billing username password UI session % shell BIND % ), @@ -31,7 +47,7 @@ % foreach my $i (grep $_->section eq $section, @config_items) { - + <% $i->key %> - <% $i->description %> @@ -45,8 +61,8 @@ % } elsif ( $type eq 'binary' ) { - <% $conf->exists($i->key) - ? qq!download! + <% $conf->exists($i->key, $agentnum) + ? qq!download! : 'empty' %> @@ -57,27 +73,27 @@ % } elsif ( $type eq 'checkbox' ) { - + % } elsif ( $type eq 'text' || $type eq 'select' ) { % } elsif ( $type eq 'select-sub' ) { % } else { @@ -100,4 +116,23 @@ <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my ($conf, $title, @config_items, $agentnum); + +if ($cgi->param('agentnum') =~ /^(\d+)$/) { + $agentnum = $1; +} + +if ($agentnum) { + my $agent = qsearchs('agent', { 'agentnum' => $agentnum } ); + die "Agent $agentnum not found!" unless $agent; + + $title = "Configuration for ". $agent->agent; +} else { + $title = 'Global Configuration'; +} + +$conf = new FS::Conf; +@config_items = grep { $agentnum ? $_->per_agent : 1 } $conf->config_items; + -- cgit v1.2.1
-<% encode_entities(join("\n", $conf->config($i->key) ) ) %>
+<% encode_entities(join("\n", $conf->config($i->key, $agentnum) ) ) %>
 
YES' : 'ff0000">NO' %>YES' : 'ff0000">NO' %>
- <% $conf->exists($i->key) ? $conf->config($i->key) : '' %> + <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
- <% $conf->config($i->key) %>: - <% &{ $i->option_sub }( $conf->config($i->key) ) %> + <% $conf->config($i->key, $agentnum) %>: + <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>