X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fconfig%2Fconfig-view.cgi;h=41ecfd2686cfce2c42ab3a228259c59d7ee5a7dc;hb=cf4ffd334502af562e924c24376333200073ccb8;hp=09e535b2f5e407bcbc27435776b1dd8322a3ec2e;hpb=e6b57805f6b3e76448ab9b6d280f2c53bc1410f3;p=freeside.git diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 09e535b2f..41ecfd268 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -1,46 +1,207 @@ -<%= header('View Configuration', menubar( 'Main Menu' => $p, - 'Edit Configuration' => 'config.cgi' ) ) %> +<% include("/elements/header.html", $title, menubar(@menubar)) %> -<% my $conf = new FS::Conf; my @config_items = $conf->config_items; %> +Click on a configuration value to change it. +

-<% foreach my $section ( qw(required billing username password UI session - apache BIND shell - ), - '', 'depreciated') { %> - <%= table("#cccccc", 2) %> +<% include('/elements/init_overlib.html') %> + +% if ($FS::UID::use_confcompat) { + CONFIGURATION NOT STORED IN DATABASE -- USING COMPATIBILITY MODE

+%} + +% foreach my $section (@sections) { + + + + +% foreach my $nav_section (@sections) { +% +% if ( $section eq $nav_section ) { + [<% ucfirst($nav_section || 'unclassified') %>] +% } else { + [<% ucfirst($nav_section || 'unclassified') %>] +% } +% +% } + +
+ - <% foreach my $i (grep $_->section eq $section, @config_items) { %> +% foreach my $i (@{ $section_items{$section} }) { +% my @types = ref($i->type) ? @{$i->type} : ($i->type); +% my( $width, $height ) = ( 522, 336 ); +% if ( grep $_ eq 'textarea', @types ) { +% #800x600 +% $width = 763; +% $height = 408; +% #1024x768 +% #$width = +% #$height = +% } + - + - <% } %> +% } +
- <%= ucfirst($section || 'unclassified') %> configuration options + <% ucfirst($section || 'unclassified') %> configuration options
- <%= $i->key %> - <%= $i->description %> - <% include('/elements/popup_link.html', + 'action' => 'config.cgi?key='. $i->key. + ';agentnum='. $agentnum, + 'width' => $width, + 'height' => $height, + 'actionlabel' => 'Enter configuration value', + 'label' => ''. $i->key. '', + 'aname' => $i->key, + ) + %>: <% $i->description %> + - <% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { - my $n = 0; %> - <% if ( $type eq '' ) { %> - - <% } elsif ( $type eq 'textarea' ) { %> - - <% } elsif ( $type eq 'checkbox' ) { %> - - <% } elsif ( $type eq 'text' ) { %> - - <% } else { %> + +% my $n = 0; +% foreach my $type (@types) { + +% if ( $type eq '' ) { + + + + + +% } elsif ( $type eq 'image' ) { + + + + + + + + +% } elsif ( $type eq 'binary' ) { + + + + + +% } elsif ( $type eq 'textarea' +% || $type eq 'editlist' +% || $type eq 'selectmultiple' ) { + + + + + +% } elsif ( $type eq 'checkbox' ) { + + + + + +% } elsif ( $type eq 'select' && $i->select_hash ) { +% +% my %hash; +% if ( ref($i->select_hash) eq 'ARRAY' ) { +% tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash }; +% } else { +% tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash }; +% } + + + + + +% } elsif ( $type eq 'text' || $type eq 'select' ) { + + + + + +% } elsif ( $type eq 'select-sub' ) { + + + + + +% } else { + - <% } %> - <% $n++; } %> +% } +% $n++; +% } +
no type
-
<%= join("\n", $conf->config($i->key) ) %>
-
YES' : 'ff0000">NO' %>
<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>
no type
+ <% $conf->exists($i->key, $agentnum) + ? '' + : 'empty' + %> +
+ <% $conf->exists($i->key, $agentnum) + ? qq!download! + : '' + %> +
+ <% $conf->exists($i->key, $agentnum) + ? qq!download! + : 'empty' + %> +
+
+<% encode_entities(join("\n",
+     map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
+         $conf->config($i->key, $agentnum)
+   ) )
+%>
+
+
YES' : 'ff0000">NO' %>
+ <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %> +
+ <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %> +
+ <% $conf->config($i->key, $agentnum) %>: + <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %> +
- unknown type <%= $type %> + unknown type <% $type %>


-<% } %> +% } + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $agentnum = ''; +my $title; +my @menubar = (); +if ($cgi->param('agentnum') =~ /^(\d+)$/) { + $agentnum = $1; + my $agent = qsearchs('agent', { 'agentnum' => $agentnum } ); + die "Agent $agentnum not found!" unless $agent; + + push @menubar, 'View all agents' => $p.'browse/agent.cgi'; + $title = 'Agent Configuration for '. $agent->agent; +} else { + $title = 'Global Configuration'; +} + +my $conf = new FS::Conf; + +my @config_items = grep { $agentnum ? $_->per_agent : 1 } + grep { $_->key != ~/^invoice_(html|latex|template)/ } + $conf->config_items; + +my @sections = qw(required billing username password UI session shell BIND ); +push @sections, '', 'deprecated'; + +my %section_items = (); +foreach my $section (@sections) { + $section_items{$section} = [ grep $_->section eq $section, @config_items ]; +} + +@sections = grep scalar( @{ $section_items{$_} } ), @sections; + +