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 % my @add_agents = ();
63 % if ( $page_agent ) {
64 % @agents = ( $page_agent );
67 % if ( $i->per_agent ) {
68 % foreach my $agent (@all_agents) {
69 % if ( defined($conf->conf( $i->key, $agent->agentnum, 1 ) ) ) {
70 % push @agents, $agent;
72 % push @add_agents, $agent;
78 % foreach my $agent ( @agents ) {
79 % my $agentnum = $agent ? $agent->agentnum : '';
81 % next if $section eq 'deprecated' && ! $conf->exists($i->key, $agentnum);
83 % my $label = $i->key;
84 % $label = '['. $agent->agent. "] $label"
85 % if $agent && $cgi->param('showagent');
90 <td><% include('/elements/popup_link.html',
91 'action' => 'config.cgi?key='. $i->key.
92 ';agentnum='. $agentnum,
95 'actionlabel' => 'Enter configuration value',
96 'label' => "<b>$label</b>",
97 'aname' => $i->key, #agentnum
98 # if $cgi->param('showagent')?
100 %>: <% $i->description %>
101 % if ( $agent && $cgi->param('showagent') ) {
102 % my $confnum = $conf->conf( $i->key, $agent->agentnum, 1 )->confnum;
103 (<A HREF="javascript:areyousure('delete this agent override', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view_showagent')">delete agent override</A>)
104 % } elsif ( $i->base_key
105 % || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) {
108 % ? $conf->conf( $i->key, $agent->agentnum, 1 )->confnum
109 % : $conf->conf( $i->key )->confnum;
110 % my $showagent = $cgi->param('showagent') ? '_showagent' : '';
111 (<A HREF="javascript:areyousure('delete this configuration item', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view<%$showagent%>')">delete configuration item</A>)
118 % foreach my $type (@types) {
120 % if ( $type eq '' ) {
123 <td><font color="#ff0000">no type</font></td>
126 % } elsif ( $type eq 'image' ) {
129 <td bgcolor='#ffffff'>
130 <% $conf->exists($i->key, $agentnum)
131 ? '<img src="config-image.cgi?key='. $i->key.
132 ';agentnum='. $agentnum. '">'
139 <% $conf->exists($i->key, $agentnum)
140 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
146 % } elsif ( $type eq 'binary' ) {
150 <% $conf->exists($i->key, $agentnum)
151 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
157 % } elsif ( $type eq 'textarea'
158 % || $type eq 'editlist'
159 % || $type eq 'selectmultiple' ) {
162 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
163 <font size="-2"><pre><% encode_entities(join("\n",
164 map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
165 $conf->config($i->key, $agentnum)
171 % } elsif ( $type eq 'checkbox' ) {
174 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
177 % } elsif ( $type eq 'select' && $i->select_hash ) {
180 % if ( ref($i->select_hash) eq 'ARRAY' ) {
181 % tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash };
183 % tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash };
187 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
188 <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
192 % } elsif ( $type eq 'text' || $type eq 'select' ) {
195 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
196 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
200 % } elsif ( $type eq 'select-sub' ) {
203 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
204 <% $conf->config($i->key, $agentnum) %>:
205 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
212 <font color="#ff0000">unknown type <% $type %></font>
221 % } # foreach my $agentnum
223 % if ( @add_agents ) {
228 Add <b><% $i->key %></b> override for
229 <% include('/elements/select-agent.html',
230 'agents' => \@add_agents,
231 'empty_label' => 'Select agent',
232 'onchange' => "agent_changed",
233 'id' => 'agent_'. $i->key,
238 % my $agent_el = "document.getElementById('agent_". $i->key. "')";
239 <INPUT TYPE = "button"
241 ID = "add_<% $i->key %>"
244 include('/elements/popup_link_onclick.html',
246 'config.cgi?key='. $i->key.
248 "$agent_el.options[$agent_el.selectedIndex].value".
252 'actionlabel' => 'Enter configuration value',
266 % } # foreach my $nav_section
268 <SCRIPT TYPE="text/javascript">
270 function agent_changed(what) {
271 var key = what.id.substring(6); // trim agent_
272 var button = document.getElementById('add_'+key);
273 if ( what.selectedIndex > 0 ) {
274 button.disabled = false;
276 button.disabled = true;
280 function areyousure(what, href) {
281 if ( confirm("Are you sure you want to " + what + "?") == true )
282 window.location.href = href;
291 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
296 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
297 my $page_agentnum = $1;
298 $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } );
299 die "Agent $page_agentnum not found!" unless $page_agent;
301 push @menubar, 'View all agents' => $p.'browse/agent.cgi';
302 $title = 'Agent Configuration for '. $page_agent->agent;
304 $title = 'Global Configuration';
307 my $conf = new FS::Conf;
309 my @config_items = grep { $page_agent ? $_->per_agent : 1 }
310 grep { $page_agent ? 1 : !$_->agentonly }
313 my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress );
314 my %deleteable = map { $_ => 1 } @deleteable;
316 my @sections = qw(required billing username password UI session shell BIND );
317 push @sections, '', 'deprecated';
319 my %section_items = ();
320 foreach my $section (@sections) {
321 $section_items{$section} = [ grep $_->section eq $section, @config_items ];
324 @sections = grep scalar( @{ $section_items{$_} } ), @sections;
327 if ( $cgi->param('showagent') ) {
328 @all_agents = qsearch('agent', { 'disabled' => '' } );
330 warn 'all agents: '. join('-', @all_agents);