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);
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 || 'unclassified' %>"></A>
64 % foreach my $nav_section (@sections) {
66 % if ( $section eq $nav_section ) {
67 [<A NAME="not<% $nav_section || 'unclassified' %>" style="background-color: #cccccc"><% ucfirst($nav_section || 'unclassified') %></A>]
69 [<A HREF="#<% $nav_section || 'unclassified' %>"><% ucfirst($nav_section || 'unclassified') %></A>]
75 <TABLE BGCOLOR="#cccccc" BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR="#999999">
77 <th colspan="2" bgcolor="#dcdcdc">
78 <% ucfirst($section || 'unclassified') %>
79 % if ( $curuser->option('show_confitem_counts') ) {
80 (<% scalar( @{ $section_items{$section} } ) %> items)
84 % foreach my $i (@{ $section_items{$section} }) {
85 % my @types = ref($i->type) ? @{$i->type} : ($i->type);
86 %# my( $width, $height ) = ( 522, 336 );
87 % my( $width, $height ) = ( 600, 336 );
88 % if ( grep $_ eq 'textarea', @types ) {
98 % my @add_agents = ();
99 % if ( $page_agent ) {
100 % @agents = ( $page_agent );
103 % if ( $i->per_agent ) {
104 % foreach my $agent (@all_agents) {
105 % if ( defined($conf->conf( $i->key, $agent->agentnum, 1 ) ) ) {
106 % push @agents, $agent;
108 % push @add_agents, $agent;
114 % foreach my $agent ( @agents ) {
115 % my $agentnum = $agent ? $agent->agentnum : '';
117 % next if $section eq 'deprecated' && ! $conf->exists($i->key, $agentnum);
119 % my $label = $i->key;
120 % $label = '['. $agent->agent. "] $label"
121 % if $agent && $cgi->param('showagent');
124 % my $action = 'config.cgi?key=' . $i->key .
125 % ";agentnum=$agentnum" . ($locale ? ";locale=$locale" : '');
128 <td><% include('/elements/popup_link.html',
132 'actionlabel' => 'Enter configuration value',
133 'label' => "<b>$label</b>",
134 'aname' => $i->key, #agentnum
135 # if $cgi->param('showagent')?
137 %>: <% $i->description %>
138 % if ( $agent && $cgi->param('showagent') ) {
139 % my $confnum = $conf->conf( $i->key, $agent->agentnum, 1 )->confnum;
140 (<A HREF="javascript:areyousure('delete this agent override', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view_showagent')">delete agent override</A>)
141 % } elsif ( $i->base_key
142 % || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) {
145 % ? $conf->conf( $i->key, $agent->agentnum, 1 )->confnum
146 % : $conf->conf( $i->key )->confnum;
147 % my $showagent = $cgi->param('showagent') ? '_showagent' : '';
148 (<A HREF="javascript:areyousure('delete this configuration item', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view<%$showagent%>')">delete configuration item</A>)
155 % foreach my $type (@types) {
157 % if ( $type eq '' ) {
160 <td><font color="#ff0000">no type</font></td>
163 % } elsif ( $type eq 'image' ) {
164 % my $args = 'key=' . $i->key . ";agentnum=$agentnum;locale=$locale";
167 <td bgcolor='#ffffff'>
168 <% $conf->exists($i->key, $agentnum)
169 ? '<img src="config-image.cgi?'.$args.'">'
176 <% $conf->exists($i->key, $agentnum)
177 ? '<a href="config-download.cgi?'.$args.'">download</a>'
183 % } elsif ( $type eq 'binary' ) {
184 % my $args = 'key=' . $i->key . ";agentnum=$agentnum;locale=$locale";
188 <% $conf->exists($i->key, $agentnum)
189 ? '<a href="config-download.cgi?'.$args.'">download</a>'
195 % } elsif ( $type eq 'textarea'
196 % || $type eq 'editlist'
197 % || $type eq 'selectmultiple'
202 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
203 <font size="-2"><pre><% encode_entities(join("\n",
204 map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
205 $conf->config($i->key, $agentnum)
211 % } elsif ( $type eq 'checkbox' ) {
214 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->config_bool($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
217 % } elsif ( $type eq 'select' && $i->select_hash ) {
220 % if ( ref($i->select_hash) eq 'ARRAY' ) {
221 % tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash };
223 % tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash };
227 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
228 <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
232 % } elsif ( $type eq 'text' || $type eq 'select' ) {
235 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
236 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
240 % } elsif ( $type eq 'select-sub' ) {
243 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
244 % if ( $i->multiple ) {
246 map { $_ . ": " . &{ $i->option_sub }($_) }
247 $conf->config($i->key,$agentnum)
251 <% $conf->config($i->key, $agentnum) %>:
252 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
257 % } elsif ( $type =~ /^select-(part_svc|part_pkg|pkg_class|agent)$/ ) {
260 % my $namecol = $namecol{$table};
261 % my $pkey = dbdef->table($table)->primary_key;
263 % my @keys = $conf->config($i->key, $agentnum);
266 <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
270 my $record = qsearchs($table, { $pkey => $key });
271 $record ? "$key: ".$record->$namecol() : $key;
281 <font color="#ff0000">unknown type <% $type %></font>
290 % } # foreach my $agentnum
292 % if ( @add_agents ) {
297 Add <b><% $i->key %></b> override for
298 <% include('/elements/select-agent.html',
299 'agents' => \@add_agents,
300 'empty_label' => 'Select agent',
301 'onchange' => "agent_changed",
302 'id' => 'agent_'. $i->key,
307 % my $agent_el = "document.getElementById('agent_". $i->key. "')";
308 <INPUT TYPE = "button"
310 ID = "add_<% $i->key %>"
313 include('/elements/popup_link_onclick.html',
315 'config.cgi?key='. $i->key.
317 "$agent_el.options[$agent_el.selectedIndex].value".
321 'actionlabel' => 'Enter configuration value',
335 % } # foreach my $nav_section
337 <SCRIPT TYPE="text/javascript">
339 function agent_changed(what) {
340 var key = what.id.substring(6); // trim agent_
341 var button = document.getElementById('add_'+key);
342 if ( what.selectedIndex > 0 ) {
343 button.disabled = false;
345 button.disabled = true;
349 function areyousure(what, href) {
350 if ( confirm("Are you sure you want to " + what + "?") == true )
351 window.location.href = href;
358 #false laziness w/config-process.cgi
362 'pkg_class' => 'classname',
368 my $curuser = $FS::CurrentUser::CurrentUser;
370 die "access denied" unless $curuser->access_right('Configuration');
375 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
376 my $page_agentnum = $1;
377 $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } );
378 die "Agent $page_agentnum not found!" unless $page_agent;
380 push @menubar, 'View all agents' => $p.'browse/agent.cgi';
383 my $conf = new FS::Conf;
384 my $conf_global = $conf;
386 my @locales = $conf_global->config('available-locales');
388 # if this is set, we are in locale mode, so limit the displayed items
389 # to those with per_locale.
392 if ( $cgi->param('locale') =~ /^\w+_\w+$/ ) {
393 $locale = $cgi->param('locale');
394 # and set the context on $conf
395 $conf = new FS::Conf { 'locale' => $locale, 'localeonly' => 1 };
396 my %locale_info = FS::Locales->locale_info($locale);
397 $locale_desc = "$locale_info{name} ($locale_info{country})";
399 $title = 'Invoice Configuration'; #for now it is only invoicing
400 $title .= ' for '.$page_agent->agent if $page_agent;
401 $title .= ', '.$locale_desc;
403 } elsif ($page_agent) {
404 $title = 'Agent Configuration for '. $page_agent->agent;
405 $title .= ", $locale_desc" if $locale;
407 $title = 'Global Configuration';
410 my @config_items = grep { !defined($locale) or $_->per_locale }
411 grep { $page_agent ? $_->per_agent : 1 }
412 grep { $page_agent ? 1 : !$_->agentonly }
415 my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress );
416 my %deleteable = map { $_ => 1 } @deleteable;
419 required billing taxation invoicing notification UI API self-service
420 ticketing network_monitoring username password session shell BIND
425 my %section_items = ();
426 foreach my $section (@sections) {
427 $section_items{$section} = [ grep $_->section eq $section, @config_items ];
430 @sections = grep scalar( @{ $section_items{$_} } ), @sections;
433 if ( $cgi->param('showagent') ) {
434 @all_agents = qsearch('agent', { 'disabled' => '' } );