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 % my( $width, $height ) = ( 600, 336 );
53 % if ( grep $_ eq 'textarea', @types ) {
63 % my @add_agents = ();
64 % if ( $page_agent ) {
65 % @agents = ( $page_agent );
68 % if ( $i->per_agent ) {
69 % foreach my $agent (@all_agents) {
70 % if ( defined($conf->conf( $i->key, $agent->agentnum, 1 ) ) ) {
71 % push @agents, $agent;
73 % push @add_agents, $agent;
79 % foreach my $agent ( @agents ) {
80 % my $agentnum = $agent ? $agent->agentnum : '';
82 % next if $section eq 'deprecated' && ! $conf->exists($i->key, $agentnum);
84 % my $label = $i->key;
85 % $label = '['. $agent->agent. "] $label"
86 % if $agent && $cgi->param('showagent');
91 <td><% include('/elements/popup_link.html',
92 'action' => 'config.cgi?key='. $i->key.
93 ';agentnum='. $agentnum,
96 'actionlabel' => 'Enter configuration value',
97 'label' => "<b>$label</b>",
98 'aname' => $i->key, #agentnum
99 # if $cgi->param('showagent')?
101 %>: <% $i->description %>
102 % if ( $agent && $cgi->param('showagent') ) {
103 % my $confnum = $conf->conf( $i->key, $agent->agentnum, 1 )->confnum;
104 (<A HREF="javascript:areyousure('delete this agent override', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view_showagent')">delete agent override</A>)
105 % } elsif ( $i->base_key
106 % || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) {
109 % ? $conf->conf( $i->key, $agent->agentnum, 1 )->confnum
110 % : $conf->conf( $i->key )->confnum;
111 % my $showagent = $cgi->param('showagent') ? '_showagent' : '';
112 (<A HREF="javascript:areyousure('delete this configuration item', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view<%$showagent%>')">delete configuration item</A>)
119 % foreach my $type (@types) {
121 % if ( $type eq '' ) {
124 <td><font color="#ff0000">no type</font></td>
127 % } elsif ( $type eq 'image' ) {
130 <td bgcolor='#ffffff'>
131 <% $conf->exists($i->key, $agentnum)
132 ? '<img src="config-image.cgi?key='. $i->key.
133 ';agentnum='. $agentnum. '">'
140 <% $conf->exists($i->key, $agentnum)
141 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
147 % } elsif ( $type eq 'binary' ) {
151 <% $conf->exists($i->key, $agentnum)
152 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
158 % } elsif ( $type eq 'textarea'
159 % || $type eq 'editlist'
160 % || $type eq 'selectmultiple'
165 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
166 <font size="-2"><pre><% encode_entities(join("\n",
167 map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
168 $conf->config($i->key, $agentnum)
174 % } elsif ( $type eq 'checkbox' ) {
177 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
180 % } elsif ( $type eq 'select' && $i->select_hash ) {
183 % if ( ref($i->select_hash) eq 'ARRAY' ) {
184 % tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash };
186 % tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash };
190 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
191 <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
195 % } elsif ( $type eq 'text' || $type eq 'select' ) {
198 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
199 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
203 % } elsif ( $type eq 'select-sub' ) {
206 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
207 <% $conf->config($i->key, $agentnum) %>:
208 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
212 % } elsif ( $type =~ /^select-(part_svc|part_pkg|pkg_class)$/ ) {
215 % my $namecol = $namecol{$table};
216 % my $pkey = dbdef->table($table)->primary_key;
218 % my @keys = $conf->config($i->key, $agentnum);
221 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
225 my $record = qsearchs($table, { $pkey => $key });
226 $record ? "$key: ".$record->$namecol() : $key;
236 <font color="#ff0000">unknown type <% $type %></font>
245 % } # foreach my $agentnum
247 % if ( @add_agents ) {
252 Add <b><% $i->key %></b> override for
253 <% include('/elements/select-agent.html',
254 'agents' => \@add_agents,
255 'empty_label' => 'Select agent',
256 'onchange' => "agent_changed",
257 'id' => 'agent_'. $i->key,
262 % my $agent_el = "document.getElementById('agent_". $i->key. "')";
263 <INPUT TYPE = "button"
265 ID = "add_<% $i->key %>"
268 include('/elements/popup_link_onclick.html',
270 'config.cgi?key='. $i->key.
272 "$agent_el.options[$agent_el.selectedIndex].value".
276 'actionlabel' => 'Enter configuration value',
290 % } # foreach my $nav_section
292 <SCRIPT TYPE="text/javascript">
294 function agent_changed(what) {
295 var key = what.id.substring(6); // trim agent_
296 var button = document.getElementById('add_'+key);
297 if ( what.selectedIndex > 0 ) {
298 button.disabled = false;
300 button.disabled = true;
304 function areyousure(what, href) {
305 if ( confirm("Are you sure you want to " + what + "?") == true )
306 window.location.href = href;
313 #false laziness w/config-process.cgi
317 'pkg_class' => 'classname',
323 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
328 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
329 my $page_agentnum = $1;
330 $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } );
331 die "Agent $page_agentnum not found!" unless $page_agent;
333 push @menubar, 'View all agents' => $p.'browse/agent.cgi';
334 $title = 'Agent Configuration for '. $page_agent->agent;
336 $title = 'Global Configuration';
339 my $conf = new FS::Conf;
341 my @config_items = grep { $page_agent ? $_->per_agent : 1 }
342 grep { $page_agent ? 1 : !$_->agentonly }
345 my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress );
346 my %deleteable = map { $_ => 1 } @deleteable;
348 my @sections = qw(required billing username password UI session shell BIND );
349 push @sections, '', 'deprecated';
351 my %section_items = ();
352 foreach my $section (@sections) {
353 $section_items{$section} = [ grep $_->section eq $section, @config_items ];
356 @sections = grep scalar( @{ $section_items{$_} } ), @sections;
359 if ( $cgi->param('showagent') ) {
360 @all_agents = qsearch('agent', { 'disabled' => '' } );