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 %>">show global configuration</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);
22 % $cgi->delete('locale');
23 <a href="<%$cgi->self_url%>">global settings</a> |
25 <script type='text/javascript'>
26 function changeLocale(what) {
27 //var what = document.getElementById('select-locale');
28 if(what.selectedIndex > 0) {
33 invoice language options:
34 <form action="<% $cgi->self_url %>" method="GET" style="display:inline;">
35 <& /elements/select.html,
37 'options' => [ '', grep { $_ ne 'en_US'} @locales ],
39 my %info = FS::Locales->locale_info($_);
40 $_ => "$info{name} ($info{country})"
41 } grep { $_ ne 'en_US' } @locales },
42 'curr_value' => $locale,
43 'id' => 'select-locale',
44 'onchange' => 'changeLocale'
47 % $cgi->param('locale', $locale);
53 <% include('/elements/init_overlib.html') %>
55 % if ($FS::UID::use_confcompat) {
56 <FONT SIZE="+1" COLOR="#ff0000">CONFIGURATION NOT STORED IN DATABASE -- USING COMPATIBILITY MODE</FONT><BR><BR>
59 % foreach my $section (@sections) {
61 <A NAME="<% $section || 'misc' %>"></A>
64 % foreach my $nav_section (@sections) {
66 % if ( $section eq $nav_section ) {
67 <A NAME="not<% $nav_section || 'misc' %>" style="background-color: #cccccc"><% section_title($nav_section) %></A>
69 <A HREF="#<% $nav_section || 'misc' %>"><% section_title($nav_section) %></A>
72 % unless ( $nav_section eq $sections[-1] ) {
79 <TABLE BGCOLOR="#cccccc" BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR="#999999">
81 <th colspan="2" bgcolor="#dcdcdc">
82 <% section_title($section) %>
83 % if ( $curuser->option('show_confitem_counts') ) {
84 (<% scalar( @{ $section_items{$section} } ) %> items)
88 % foreach my $i (@{ $section_items{$section} }) {
89 % my @types = ref($i->type) ? @{$i->type} : ($i->type);
90 %# my( $width, $height ) = ( 522, 336 );
91 % my( $width, $height ) = ( 600, 336 );
92 % if ( grep $_ eq 'textarea', @types ) {
102 % my @add_agents = ();
103 % if ( $page_agent ) {
104 % @agents = ( $page_agent );
107 % if ( $i->per_agent ) {
108 % foreach my $agent (@all_agents) {
109 % if ( defined($conf->conf( $i->key, $agent->agentnum, 1 ) ) ) {
110 % push @agents, $agent;
112 % push @add_agents, $agent;
118 % foreach my $agent ( @agents ) {
119 % my $agentnum = $agent ? $agent->agentnum : '';
121 % next if $section eq 'deprecated'
122 % && ( ! $conf->exists($i->key, $agentnum)
123 % || $conf->config($i->key, $agentnum) eq ''
126 % my $label = $i->key;
127 % $label = '['. $agent->agent. "] $label"
128 % if $agent && $cgi->param('showagent');
131 % my $action = 'config.cgi?key=' . $i->key .
132 % ";agentnum=$agentnum" . ($locale ? ";locale=$locale" : '');
135 % unless ( $cgi->param('showagent') ) {
137 <% include('/elements/popup_link.html',
141 'actionlabel' => 'Enter configuration value',
142 'html_label' => "<b>$label</b>",
147 <td><b><% $label %></b>:
149 <% $i->description %>
150 % if ( $agent && $cgi->param('showagent') ) {
151 % my $confnum = $conf->conf( $i->key, $agent->agentnum, 1 )->confnum;
152 (<A HREF="javascript:areyousure('delete this agent override', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view_showagent')">delete agent override</A>)
153 % } elsif ( $i->base_key
154 % || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) {
157 % ? $conf->conf( $i->key, $agent->agentnum, 1 )->confnum
158 % : $conf->conf( $i->key )->confnum;
159 % my $showagent = $cgi->param('showagent') ? '_showagent' : '';
160 (<A HREF="javascript:areyousure('delete this configuration item', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view<%$showagent%>')">delete configuration item</A>)
167 % foreach my $type (@types) {
169 % if ( $type eq '' ) {
172 <td><font color="#ff0000">no type</font></td>
175 % } elsif ( $type eq 'image' ) {
176 % my $args = 'key=' . $i->key . ";agentnum=$agentnum;locale=$locale";
179 <td bgcolor='#ffffff'>
180 <% $conf->exists($i->key, $agentnum)
181 ? '<img src="config-image.cgi?'.$args.'">'
188 <% $conf->exists($i->key, $agentnum)
189 ? '<a href="config-download.cgi?'.$args.'">download</a>'
195 % } elsif ( $type eq 'binary' ) {
196 % my $args = 'key=' . $i->key . ";agentnum=$agentnum;locale=$locale";
200 <% $conf->exists($i->key, $agentnum)
201 ? '<a href="config-download.cgi?'.$args.'">download</a>'
207 % } elsif ( $type eq 'textarea'
208 % || $type eq 'editlist'
209 % || $type eq 'selectmultiple'
214 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
215 <font size="-2"><pre><% encode_entities(join("\n",
216 map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
217 $conf->config($i->key, $agentnum)
223 % } elsif ( $type eq 'checkbox' ) {
226 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->config_bool($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
229 % } elsif ( $type eq 'select' && $i->select_hash ) {
232 % if ( ref($i->select_hash) eq 'ARRAY' ) {
233 % tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash };
235 % tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash };
239 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
240 <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
244 % } elsif ( $type eq 'text' || $type eq 'select' ) {
247 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
248 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
252 % } elsif ( $type eq 'select-sub' ) {
255 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
256 % if ( $i->multiple ) {
258 map { $_ . ": " . &{ $i->option_sub }($_) }
259 $conf->config($i->key,$agentnum)
263 <% $conf->config($i->key, $agentnum) %>:
264 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
269 % } elsif ( $type =~ /^select-(part_svc|part_pkg|pkg_class|agent)$/ ) {
272 % my $namecol = $namecol{$table};
273 % my $pkey = dbdef->table($table)->primary_key;
275 % my @keys = $conf->config($i->key, $agentnum);
278 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
282 my $record = qsearchs($table, { $pkey => $key });
283 $record ? "$key: ".$record->$namecol() : $key;
293 <font color="#ff0000">unknown type <% $type %></font>
302 % } # foreach my $agentnum
304 % if ( @add_agents ) {
309 Add <b><% $i->key %></b> override for
310 <% include('/elements/select-agent.html',
311 'agents' => \@add_agents,
312 'empty_label' => 'Select agent',
313 'onchange' => "agent_changed",
314 'id' => 'agent_'. $i->key,
319 % my $agent_el = "document.getElementById('agent_". $i->key. "')";
320 <INPUT TYPE = "button"
322 ID = "add_<% $i->key %>"
325 include('/elements/popup_link_onclick.html',
327 'config.cgi?key='. $i->key.
329 "$agent_el.options[$agent_el.selectedIndex].value".
333 'actionlabel' => 'Enter configuration value',
347 % } # foreach my $nav_section
349 <SCRIPT TYPE="text/javascript">
351 function agent_changed(what) {
352 var key = what.id.substring(6); // trim agent_
353 var button = document.getElementById('add_'+key);
354 if ( what.selectedIndex > 0 ) {
355 button.disabled = false;
357 button.disabled = true;
361 function areyousure(what, href) {
362 if ( confirm("Are you sure you want to " + what + "?") == true )
363 window.location.href = href;
370 #false laziness w/config-process.cgi
374 'pkg_class' => 'classname',
380 my $curuser = $FS::CurrentUser::CurrentUser;
382 die "access denied" unless $curuser->access_right('Configuration');
387 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
388 my $page_agentnum = $1;
389 $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } );
390 die "Agent $page_agentnum not found!" unless $page_agent;
392 push @menubar, 'View all agents' => $p.'browse/agent.cgi';
395 my $conf = new FS::Conf;
396 my $conf_global = $conf;
398 my @locales = $conf_global->config('available-locales');
400 # if this is set, we are in locale mode, so limit the displayed items
401 # to those with per_locale.
404 if ( $cgi->param('locale') =~ /^\w+_\w+$/ ) {
405 $locale = $cgi->param('locale');
406 # and set the context on $conf
407 $conf = new FS::Conf { 'locale' => $locale, 'localeonly' => 1 };
408 my %locale_info = FS::Locales->locale_info($locale);
409 $locale_desc = "$locale_info{name} ($locale_info{country})";
411 $title = 'Invoice Configuration'; #for now it is only invoicing
412 $title .= ' for '.$page_agent->agent if $page_agent;
413 $title .= ', '.$locale_desc;
415 } elsif ($page_agent) {
416 $title = 'Agent Configuration for '. $page_agent->agent;
417 $title .= ", $locale_desc" if $locale;
418 } elsif ( $cgi->param('showagent') ) {
419 $title = 'Agent Configuration Overrides'
421 $title = 'Global Configuration';
424 my $show_over = $page_agent || $cgi->param('showagent');
426 my @config_items = grep { !defined($locale) or $_->per_locale }
427 grep { $show_over ? $_->per_agent : 1 }
428 grep { $show_over ? 1 : !$_->agentonly }
431 my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress );
432 my %deleteable = map { $_ => 1 } @deleteable;
436 billing payments payment_batching credit_cards e-checks taxation
437 packages suspension cancellation
438 printing print_services
439 invoicing invoice_email invoice_balances invoice_templates quotations
440 notification UI addresses customer_number customer_fields reporting
441 localization scalability backup
442 signup self-service self-service_skinning
443 API ticketing appointments network_monitoring
446 telephony RADIUS wireless_broadband shell BIND hosting
447 ), '', qw( development deprecated )
450 my %section_items = ();
451 foreach my $section (@sections) {
452 $section_items{$section} = [ grep $_->section eq $section, @config_items ];
455 @sections = grep scalar( @{ $section_items{$_} } ), @sections;
458 if ( $cgi->param('showagent') ) {
459 @all_agents = qsearch('agent', { 'disabled' => '' } );
463 my $sec = ucfirst(shift || 'misc');