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 ) {
62 % if ( $page_agent ) {
63 % @agents = ( $page_agent );
67 % grep { defined( _config_agentonly($conf, $i->key, $_->agentnum) ) }
72 % foreach my $agent ( @agents ) {
73 % my $agentnum = $agent ? $agent->agentnum : '';
75 % my $label = $i->key;
76 % $label = '['. $agent->agent. "] $label"
77 % if $agent && $cgi->param('showagent');
82 <td><% include('/elements/popup_link.html',
83 'action' => 'config.cgi?key='. $i->key.
84 ';agentnum='. $agentnum,
87 'actionlabel' => 'Enter configuration value',
88 'label' => "<b>$label</b>",
89 'aname' => $i->key, #agentnum
90 # if $cgi->param('showagent')?
92 %>: <% $i->description %>
97 % foreach my $type (@types) {
99 % if ( $type eq '' ) {
102 <td><font color="#ff0000">no type</font></td>
105 % } elsif ( $type eq 'image' ) {
108 <td bgcolor='#ffffff'>
109 <% $conf->exists($i->key, $agentnum)
110 ? '<img src="config-image.cgi?key='. $i->key.
111 ';agentnum='. $agentnum. '">'
118 <% $conf->exists($i->key, $agentnum)
119 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
125 % } elsif ( $type eq 'binary' ) {
129 <% $conf->exists($i->key, $agentnum)
130 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
136 % } elsif ( $type eq 'textarea'
137 % || $type eq 'editlist'
138 % || $type eq 'selectmultiple' ) {
141 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
142 <font size="-2"><pre><% encode_entities(join("\n",
143 map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
144 $conf->config($i->key, $agentnum)
150 % } elsif ( $type eq 'checkbox' ) {
153 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
156 % } elsif ( $type eq 'select' && $i->select_hash ) {
159 % if ( ref($i->select_hash) eq 'ARRAY' ) {
160 % tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash };
162 % tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash };
166 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
167 <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
171 % } elsif ( $type eq 'text' || $type eq 'select' ) {
174 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
175 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
179 % } elsif ( $type eq 'select-sub' ) {
182 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
183 <% $conf->config($i->key, $agentnum) %>:
184 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
191 <font color="#ff0000">unknown type <% $type %></font>
200 % } # foreach my $agentnum
206 % } # foreach my $nav_section
211 #should probably be a Conf method. what else would need to use it?
212 sub _config_agentonly {
213 my($self,$name,$agentnum)=@_;
214 my $hashref = { 'name' => $name };
215 $hashref->{agentnum} = $agentnum;
216 local $FS::Record::conf = undef; # XXX evil hack prevents recursion
217 FS::Record::qsearchs('conf', $hashref);
224 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
229 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
230 my $page_agentnum = $1;
231 $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } );
232 die "Agent $page_agentnum not found!" unless $page_agent;
234 push @menubar, 'View all agents' => $p.'browse/agent.cgi';
235 $title = 'Agent Configuration for '. $page_agent->agent;
237 $title = 'Global Configuration';
240 my $conf = new FS::Conf;
242 my @config_items = grep { $page_agent ? $_->per_agent : 1 }
243 grep { $_->key != ~/^invoice_(html|latex|template)/ }
246 my @sections = qw(required billing username password UI session shell BIND );
247 push @sections, '', 'deprecated';
249 my %section_items = ();
250 foreach my $section (@sections) {
251 $section_items{$section} = [ grep $_->section eq $section, @config_items ];
254 @sections = grep scalar( @{ $section_items{$_} } ), @sections;
257 if ( $cgi->param('showagent') ) {
258 @all_agents = qsearch('agent', { 'disabled' => '' } );
260 warn 'all agents: '. join('-', @all_agents);