- <% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
- my $n = 0; %>
- <% if ( $type eq '' ) { %>
- <tr><td><font color="#ff0000">no type</font></td></tr>
- <% } elsif ( $type eq 'textarea' ) { %>
- <tr><td bgcolor="#ffffff">
- <pre><%= join("\n", $conf->config($i->key) ) %></pre>
- </td></tr>
- <% } elsif ( $type eq 'checkbox' ) { %>
- <tr><td bgcolor="#<%= $conf->exists($i->key) ? '00ff00">YES' : 'ff0000">NO' %></td></tr>
- <% } elsif ( $type eq 'text' ) { %>
- <tr><td bgcolor="#ffffff"><%= $conf->exists($i->key) ? $conf->config($i->key) : '' %></td></tr>
- <% } else { %>
+
+% my $n = 0;
+% foreach my $type (@types) {
+
+% if ( $type eq '' ) {
+
+ <tr>
+ <td><font color="#ff0000">no type</font></td>
+ </tr>
+
+% } elsif ( $type eq 'image' ) {
+% my $args = 'key=' . $i->key . ";agentnum=$agentnum;locale=$locale";
+
+ <tr>
+ <td bgcolor='#ffffff'>
+ <% $conf->exists($i->key, $agentnum)
+ ? '<img src="config-image.cgi?'.$args.'">'
+ : 'empty'
+ %>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <% $conf->exists($i->key, $agentnum)
+ ? '<a href="config-download.cgi?'.$args.'">download</a>'
+ : ''
+ %>
+ </td>
+ </tr>
+
+% } elsif ( $type eq 'binary' ) {
+% my $args = 'key=' . $i->key . ";agentnum=$agentnum;locale=$locale";
+
+ <tr>
+ <td>
+ <% $conf->exists($i->key, $agentnum)
+ ? '<a href="config-download.cgi?'.$args.'">download</a>'
+ : 'empty'
+ %>
+ </td>
+ </tr>
+
+% } elsif ( $type eq 'textarea'
+% || $type eq 'editlist'
+% || $type eq 'selectmultiple'
+% )
+% {
+
+ <tr>
+ <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
+<font size="-2"><pre><% encode_entities(join("\n",
+ map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
+ $conf->config($i->key, $agentnum)
+ ) )
+%></pre></font>
+ </td>
+ </tr>
+
+% } elsif ( $type eq 'checkbox' ) {
+
+ <tr>
+ <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td>
+ </tr>
+
+% } 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 };
+% }
+
+ <tr>
+ <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
+ <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %>
+ </td>
+ </tr>
+
+% } elsif ( $type eq 'text' || $type eq 'select' ) {
+
+ <tr>
+ <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
+ <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
+ </td>
+ </tr>
+
+% } elsif ( $type eq 'select-sub' ) {
+
+ <tr>
+ <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
+% if ( $i->multiple ) {
+ <% join('<BR>',
+ map { $_ . ": " . &{ $i->option_sub }($_) }
+ $conf->config($i->key,$agentnum)
+ )
+ %>
+% } else {
+ <% $conf->config($i->key, $agentnum) %>:
+ <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
+% }
+ </td>
+ </tr>
+
+% } elsif ( $type =~ /^select-(part_svc|part_pkg|pkg_class|agent)$/ ) {
+%
+% my $table = $1;
+% my $namecol = $namecol{$table};
+% my $pkey = dbdef->table($table)->primary_key;
+%
+% my @keys = $conf->config($i->key, $agentnum);
+
+ <tr>
+ <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
+ <% join( '<BR>',
+ map {
+ my $key = $_;
+ my $record = qsearchs($table, { $pkey => $key });
+ $record ? "$key: ".$record->$namecol() : $key;
+ } @keys
+ )
+ %>
+ </td>
+ </tr>
+
+% } else {
+