This commit was generated by cvs2svn to compensate for changes in r6255,
[freeside.git] / httemplate / config / config-view.cgi
1 <% include("/elements/header.html",
2      $title,
3      menubar(
4        'View all agents' => $p.'browse/agent.cgi',
5      )
6    )
7 %>
8
9 Click on a configuration value to change it.
10 <BR><BR>
11
12 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
13 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
14 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_draggable.js"></SCRIPT>
15 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/iframecontentmws.js"></SCRIPT>
16
17 % if ($FS::UID::use_confcompat) {
18
19   <FONT SIZE="+1" COLOR="#ff0000">CONFIGURATION NOT STORED IN DATABASE -- USING COMPATIBILITY MODE</FONT><BR><BR>
20 %}
21 %
22 % foreach my $section ( qw(required billing username password UI session
23 %                            shell BIND
24 %                           ),
25 %                         '', 'deprecated') { 
26
27   <A NAME="<% $section || 'unclassified' %>"></A>
28   <FONT SIZE="-2">
29 % foreach my $nav_section ( qw(required billing username password UI session
30 %                                  shell BIND
31 %                                 ),
32 %                               '', 'deprecated') { 
33 % if ( $section eq $nav_section ) { 
34
35       [<A NAME="not<% $nav_section || 'unclassified' %>" style="background-color: #cccccc"><% ucfirst($nav_section || 'unclassified') %></A>]
36 % } else { 
37
38       [<A HREF="#<% $nav_section || 'unclassified' %>"><% ucfirst($nav_section || 'unclassified') %></A>]
39 % } 
40 % } 
41
42   </FONT><BR>
43   <TABLE BGCOLOR="#cccccc" BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR="#999999">
44   <tr>
45     <th colspan="2" bgcolor="#dcdcdc">
46       <% ucfirst($section || 'unclassified') %> configuration options
47     </th>
48   </tr>
49 % foreach my $i (grep $_->section eq $section, @config_items) { 
50 %   my @types = ref($i->type) ? @{$i->type} : ($i->type);
51 %   my( $width, $height ) = ( 522, 336 );
52 %   if ( grep $_ eq 'textarea', @types ) {
53 %     #800x600
54 %     $width = 763;
55 %     $height = 408;
56 %     #1024x768
57 %     #$width =
58 %     #$height = 
59 %   }
60
61     <tr>
62       <td><a href="javascript:void(0);" onClick="overlib( OLiframeContent('config.cgi?key=<% $i->key %>;agentnum=<% $agentnum %>', <% $width %>, <% $height %>, 'config_popup' ), CAPTION, 'Enter configuration value', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;" name="<% $i->key %>">
63 %#        <b><% $i->key %></b></a>&nbsp;-&nbsp;<% $i->description %>
64         <b><% $i->key %></b></a>: <% $i->description %>
65       </td>
66       <td><table border=0>
67 % foreach my $type (@types) {
68 %             my $n = 0; 
69 % if ( $type eq '' ) { 
70
71             <tr>
72               <td><font color="#ff0000">no type</font></td>
73             </tr>
74 % } elsif (   $type eq 'binary' ) {
75
76             <tr>
77               <% $conf->exists($i->key, $agentnum)
78                    ? qq!<a href="config-download.cgi?key=!. $i->key. ';agentnum='. $agentnum. qq!">download</a>!
79                    : 'empty'
80               %>
81             </tr>
82 % } elsif (   $type eq 'textarea'
83 %                      || $type eq 'editlist'
84 %                      || $type eq 'selectmultiple' ) { 
85
86             <tr>
87               <td bgcolor="#ffffff">
88 <font size="-2"><pre>
89 <% encode_entities(join("\n",
90      map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
91          $conf->config($i->key, $agentnum)
92    ) )
93 %>
94 </pre></font>
95               </td>
96             </tr>
97 % } elsif ( $type eq 'checkbox' ) { 
98
99             <tr>
100               <td bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
101             </tr>
102 % } elsif ( $type eq 'text' || $type eq 'select' )  { 
103
104             <tr>
105               <td bgcolor="#ffffff">
106                 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
107               </td></tr>
108 % } elsif ( $type eq 'select-sub' ) { 
109
110             <tr>
111               <td bgcolor="#ffffff">
112                 <% $conf->config($i->key, $agentnum) %>: 
113                 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
114               </td>
115             </tr>
116 % } else { 
117
118             <tr><td>
119               <font color="#ff0000">unknown type <% $type %></font>
120             </td></tr>
121 % } 
122 % $n++; } 
123
124       </table></td>
125     </tr>
126 % } 
127
128   </table><br><br>
129 % } 
130
131
132 </body></html>
133 <%init>
134
135 die "access denied"
136   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
137
138 my $agentnum = '';
139 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
140   $agentnum = $1;
141 }
142
143 my $title;
144 if ($agentnum) {
145   my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
146   die "Agent $agentnum not found!" unless $agent;
147
148   $title = "Configuration for ". $agent->agent;
149 } else {
150   $title = 'Global Configuration';
151 }
152
153 my $conf = new FS::Conf;
154  
155 my @config_items = grep { $agentnum ? $_->per_agent : 1 }
156                    grep { $_->key != ~/^invoice_(html|latex|template)/ }
157                         $conf->config_items; 
158  
159 </%init>