1 <% include("/elements/header.html", $title, menubar(@menubar)) %>
3 Click on a configuration value to change it.
6 % unless ( $page_agent ) {
8 % if ( $cgi->param('showagent') ) {
9 % $cgi->param('showagent', 0);
10 ( <a href="<% $cgi->self_url %>">hide agent overrides</a> )
11 % $cgi->param('showagent', 1);
13 % $cgi->param('showagent', 1);
14 ( <a href="<% $cgi->self_url %>">show agent overrides</a> )
15 % $cgi->param('showagent', 0);
21 <% include('/elements/init_overlib.html') %>
23 % if ($FS::UID::use_confcompat) {
24 <FONT SIZE="+1" COLOR="#ff0000">CONFIGURATION NOT STORED IN DATABASE -- USING COMPATIBILITY MODE</FONT><BR><BR>
27 % foreach my $section (@sections) {
29 <A NAME="<% $section || 'unclassified' %>"></A>
32 % foreach my $nav_section (@sections) {
34 % if ( $section eq $nav_section ) {
35 [<A NAME="not<% $nav_section || 'unclassified' %>" style="background-color: #cccccc"><% ucfirst($nav_section || 'unclassified') %></A>]
37 [<A HREF="#<% $nav_section || 'unclassified' %>"><% ucfirst($nav_section || 'unclassified') %></A>]
43 <TABLE BGCOLOR="#cccccc" BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR="#999999">
45 <th colspan="2" bgcolor="#dcdcdc">
46 <% ucfirst($section || 'unclassified') %> configuration options
49 % foreach my $i (@{ $section_items{$section} }) {
50 % my @types = ref($i->type) ? @{$i->type} : ($i->type);
51 % my( $width, $height ) = ( 522, 336 );
52 % if ( grep $_ eq 'textarea', @types ) {
61 % my @agents = $page_agent ? ( $page_agent ) : ( '', @all_agents );
63 % foreach my $agent ( @agents ) {
64 % my $agentnum = $agent ? $agent->agentnum : '';
66 % my $label = $i->key;
67 % $label = '['. $agent->agent. "] $label"
68 % if $agent && $cgi->param('showagent');
73 <td><% include('/elements/popup_link.html',
74 'action' => 'config.cgi?key='. $i->key.
75 ';agentnum='. $agentnum,
78 'actionlabel' => 'Enter configuration value',
79 'label' => "<b>$label</b>",
80 'aname' => $i->key, #agentnum
81 # if $cgi->param('showagent')?
83 %>: <% $i->description %>
88 % foreach my $type (@types) {
90 % if ( $type eq '' ) {
93 <td><font color="#ff0000">no type</font></td>
96 % } elsif ( $type eq 'image' ) {
99 <td bgcolor='#ffffff'>
100 <% $conf->exists($i->key, $agentnum)
101 ? '<img src="config-image.cgi?key='. $i->key.
102 ';agentnum='. $agentnum. '">'
109 <% $conf->exists($i->key, $agentnum)
110 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
116 % } elsif ( $type eq 'binary' ) {
120 <% $conf->exists($i->key, $agentnum)
121 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
127 % } elsif ( $type eq 'textarea'
128 % || $type eq 'editlist'
129 % || $type eq 'selectmultiple' ) {
132 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
133 <font size="-2"><pre><% encode_entities(join("\n",
134 map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
135 $conf->config($i->key, $agentnum)
141 % } elsif ( $type eq 'checkbox' ) {
144 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
147 % } elsif ( $type eq 'select' && $i->select_hash ) {
150 % if ( ref($i->select_hash) eq 'ARRAY' ) {
151 % tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash };
153 % tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash };
157 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
158 <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
162 % } elsif ( $type eq 'text' || $type eq 'select' ) {
165 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
166 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
170 % } elsif ( $type eq 'select-sub' ) {
173 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
174 <% $conf->config($i->key, $agentnum) %>:
175 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
182 <font color="#ff0000">unknown type <% $type %></font>
191 % } # foreach my $agentnum
197 % } # foreach my $nav_section
202 #should probably be a Conf method. what else would need to use it?
203 #not even us, apparantly...
204 # defined( _config_agentonly($conf, $i->key, $_->agentnum) )
205 #sub _config_agentonly {
206 # my($self,$name,$agentnum)=@_;
207 # my $hashref = { 'name' => $name };
208 # $hashref->{agentnum} = $agentnum;
209 # local $FS::Record::conf = undef; # XXX evil hack prevents recursion
210 # FS::Record::qsearchs('conf', $hashref);
217 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
222 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
223 my $page_agentnum = $1;
224 $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } );
225 die "Agent $page_agentnum not found!" unless $page_agent;
227 push @menubar, 'View all agents' => $p.'browse/agent.cgi';
228 $title = 'Agent Configuration for '. $page_agent->agent;
230 $title = 'Global Configuration';
233 my $conf = new FS::Conf;
235 my @config_items = grep { $page_agent ? $_->per_agent : 1 }
236 grep { $_->key != ~/^invoice_(html|latex|template)/ }
239 my @sections = qw(required billing username password UI session shell BIND );
240 push @sections, '', 'deprecated';
242 my %section_items = ();
243 foreach my $section (@sections) {
244 $section_items{$section} = [ grep $_->section eq $section, @config_items ];
247 @sections = grep scalar( @{ $section_items{$_} } ), @sections;
250 if ( $cgi->param('showagent') ) {
251 @all_agents = qsearch('agent', { 'disabled' => '' } );
253 warn 'all agents: '. join('-', @all_agents);