show labels for select(select_hash) config options, RT#3997
authorivan <ivan>
Fri, 17 Apr 2009 08:02:29 +0000 (08:02 +0000)
committerivan <ivan>
Fri, 17 Apr 2009 08:02:29 +0000 (08:02 +0000)
httemplate/config/config-process.cgi
httemplate/config/config-view.cgi
httemplate/config/config.cgi

index 84bfdef..894dc41 100644 (file)
@@ -87,6 +87,15 @@ $conf->delete($_, $agentnum) foreach @delete;
           configCell.style.backgroundColor = '#ff0000';
           configCell.innerHTML = 'NO';
 %       }
+%     } 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 };
+%       }
+        configCell.innerHTML = <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' |js_string %>;
+
 %     } elsif ( $type eq 'text' || $type eq 'select' ) {
         configCell.innerHTML = <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' |js_string %>;
 %     } elsif ( $type eq 'select-sub' ) {
index f2ae892..41ecfd2 100644 (file)
@@ -66,7 +66,7 @@ Click on a configuration value to change it.
               <td><font color="#ff0000">no type</font></td>
             </tr>
 
-%   } elsif (   $type eq 'image' ) {
+%   } elsif ( $type eq 'image' ) {
 
             <tr>
               <td bgcolor='#ffffff'>
@@ -86,7 +86,7 @@ Click on a configuration value to change it.
               </td>
             </tr>
 
-%   } elsif (   $type eq 'binary' ) {
+%   } elsif ( $type eq 'binary' ) {
 
             <tr>
               <td>
@@ -112,17 +112,36 @@ Click on a configuration value to change it.
 </pre></font>
               </td>
             </tr>
+
 %   } elsif ( $type eq 'checkbox' ) {
 
             <tr>
               <td id="<% $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="<% $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="<% $i->key.$n %>" bgcolor="#ffffff">
                 <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %>
-              </td></tr>
+              </td>
+            </tr>
+
 %   } elsif ( $type eq 'select-sub' ) { 
 
             <tr>
@@ -131,6 +150,7 @@ Click on a configuration value to change it.
                 <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %>
               </td>
             </tr>
+
 %   } else { 
 
             <tr><td>
index f390c64..7f2e667 100644 (file)
@@ -84,11 +84,9 @@ Setting <b><% $key %></b>
 %         '' => '', map { $_ => $_ } @{ $config_item->select_enum };
 %     } elsif ( $config_item->select_hash ) {
 %       if ( ref($config_item->select_hash) eq 'ARRAY' ) {
-%         tie %hash, 'Tie::IxHash',
-%           '' => '', @{ $config_item->select_hash };
+%         tie %hash, 'Tie::IxHash', '' => '', @{ $config_item->select_hash };
 %       } else {
-%         tie %hash, 'Tie::IxHash',
-%           '' => '', %{ $config_item->select_hash };
+%         tie %hash, 'Tie::IxHash', '' => '', %{ $config_item->select_hash };
 %       }
 %     } else {
 %       %hash = ( '' => 'WARNING: neither select_enum nor select_hash specified in Conf.pm for configuration option "'. $key. '"' );