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') %>
47 % if ( $curuser->option('show_confitem_counts') ) {
48 (<% scalar( @{ $section_items{$section} } ) %> items)
52 % foreach my $i (@{ $section_items{$section} }) {
53 % my @types = ref($i->type) ? @{$i->type} : ($i->type);
54 %# my( $width, $height ) = ( 522, 336 );
55 % my( $width, $height ) = ( 600, 336 );
56 % if ( grep $_ eq 'textarea', @types ) {
66 % my @add_agents = ();
67 % if ( $page_agent ) {
68 % @agents = ( $page_agent );
71 % if ( $i->per_agent ) {
72 % foreach my $agent (@all_agents) {
73 % if ( defined($conf->conf( $i->key, $agent->agentnum, 1 ) ) ) {
74 % push @agents, $agent;
76 % push @add_agents, $agent;
82 % foreach my $agent ( @agents ) {
83 % my $agentnum = $agent ? $agent->agentnum : '';
85 % next if $section eq 'deprecated' && ! $conf->exists($i->key, $agentnum);
87 % my $label = $i->key;
88 % $label = '['. $agent->agent. "] $label"
89 % if $agent && $cgi->param('showagent');
94 <td><% include('/elements/popup_link.html',
95 'action' => 'config.cgi?key='. $i->key.
96 ';agentnum='. $agentnum,
99 'actionlabel' => 'Enter configuration value',
100 'label' => "<b>$label</b>",
101 'aname' => $i->key, #agentnum
102 # if $cgi->param('showagent')?
104 %>: <% $i->description %>
105 % if ( $agent && $cgi->param('showagent') ) {
106 % my $confnum = $conf->conf( $i->key, $agent->agentnum, 1 )->confnum;
107 (<A HREF="javascript:areyousure('delete this agent override', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view_showagent')">delete agent override</A>)
108 % } elsif ( $i->base_key
109 % || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) {
112 % ? $conf->conf( $i->key, $agent->agentnum, 1 )->confnum
113 % : $conf->conf( $i->key )->confnum;
114 % my $showagent = $cgi->param('showagent') ? '_showagent' : '';
115 (<A HREF="javascript:areyousure('delete this configuration item', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view<%$showagent%>')">delete configuration item</A>)
122 % foreach my $type (@types) {
124 % if ( $type eq '' ) {
127 <td><font color="#ff0000">no type</font></td>
130 % } elsif ( $type eq 'image' ) {
133 <td bgcolor='#ffffff'>
134 <% $conf->exists($i->key, $agentnum)
135 ? '<img src="config-image.cgi?key='. $i->key.
136 ';agentnum='. $agentnum. '">'
143 <% $conf->exists($i->key, $agentnum)
144 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
150 % } elsif ( $type eq 'binary' ) {
154 <% $conf->exists($i->key, $agentnum)
155 ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
161 % } elsif ( $type eq 'textarea'
162 % || $type eq 'editlist'
163 % || $type eq 'selectmultiple'
168 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
169 <font size="-2"><pre><% encode_entities(join("\n",
170 map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
171 $conf->config($i->key, $agentnum)
177 % } elsif ( $type eq 'checkbox' ) {
180 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
183 % } elsif ( $type eq 'select' && $i->select_hash ) {
186 % if ( ref($i->select_hash) eq 'ARRAY' ) {
187 % tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash };
189 % tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash };
193 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
194 <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
198 % } elsif ( $type eq 'text' || $type eq 'select' ) {
201 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
202 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
206 % } elsif ( $type eq 'select-sub' ) {
209 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
210 % if ( $i->multiple ) {
212 map { $_ . ": " . &{ $i->option_sub }($_) }
213 $conf->config($i->key,$agentnum)
217 <% $conf->config($i->key, $agentnum) %>:
218 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
223 % } elsif ( $type =~ /^select-(part_svc|part_pkg|pkg_class|agent)$/ ) {
226 % my $namecol = $namecol{$table};
227 % my $pkey = dbdef->table($table)->primary_key;
229 % my @keys = $conf->config($i->key, $agentnum);
232 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
236 my $record = qsearchs($table, { $pkey => $key });
237 $record ? "$key: ".$record->$namecol() : $key;
247 <font color="#ff0000">unknown type <% $type %></font>
256 % } # foreach my $agentnum
258 % if ( @add_agents ) {
263 Add <b><% $i->key %></b> override for
264 <% include('/elements/select-agent.html',
265 'agents' => \@add_agents,
266 'empty_label' => 'Select agent',
267 'onchange' => "agent_changed",
268 'id' => 'agent_'. $i->key,
273 % my $agent_el = "document.getElementById('agent_". $i->key. "')";
274 <INPUT TYPE = "button"
276 ID = "add_<% $i->key %>"
279 include('/elements/popup_link_onclick.html',
281 'config.cgi?key='. $i->key.
283 "$agent_el.options[$agent_el.selectedIndex].value".
287 'actionlabel' => 'Enter configuration value',
301 % } # foreach my $nav_section
303 <SCRIPT TYPE="text/javascript">
305 function agent_changed(what) {
306 var key = what.id.substring(6); // trim agent_
307 var button = document.getElementById('add_'+key);
308 if ( what.selectedIndex > 0 ) {
309 button.disabled = false;
311 button.disabled = true;
315 function areyousure(what, href) {
316 if ( confirm("Are you sure you want to " + what + "?") == true )
317 window.location.href = href;
324 #false laziness w/config-process.cgi
328 'pkg_class' => 'classname',
334 my $curuser = $FS::CurrentUser::CurrentUser;
336 die "access denied" unless $curuser->access_right('Configuration');
341 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
342 my $page_agentnum = $1;
343 $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } );
344 die "Agent $page_agentnum not found!" unless $page_agent;
346 push @menubar, 'View all agents' => $p.'browse/agent.cgi';
347 $title = 'Agent Configuration for '. $page_agent->agent;
349 $title = 'Global Configuration';
352 my $conf = new FS::Conf;
354 my @config_items = grep { $page_agent ? $_->per_agent : 1 }
355 grep { $page_agent ? 1 : !$_->agentonly }
358 my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress );
359 my %deleteable = map { $_ => 1 } @deleteable;
361 my @sections = qw(required billing invoicing notification UI self-service ticketing username password session shell BIND telephony );
362 push @sections, '', 'deprecated';
364 my %section_items = ();
365 foreach my $section (@sections) {
366 $section_items{$section} = [ grep $_->section eq $section, @config_items ];
369 @sections = grep scalar( @{ $section_items{$_} } ), @sections;
372 if ( $cgi->param('showagent') ) {
373 @all_agents = qsearch('agent', { 'disabled' => '' } );