From 6a1d3fe46f65b0a24ec025c22afcdb75af3c9e9a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 08:02:29 +0000 Subject: [PATCH] show labels for select(select_hash) config options, RT#3997 --- httemplate/config/config-process.cgi | 9 +++++++++ httemplate/config/config-view.cgi | 26 +++++++++++++++++++++++--- httemplate/config/config.cgi | 6 ++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 84bfdefcb..894dc41b2 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -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' ) { diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index f2ae892a6..41ecfd268 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -66,7 +66,7 @@ Click on a configuration value to change it. no type -% } elsif ( $type eq 'image' ) { +% } elsif ( $type eq 'image' ) { @@ -86,7 +86,7 @@ Click on a configuration value to change it. -% } elsif ( $type eq 'binary' ) { +% } elsif ( $type eq 'binary' ) { @@ -112,17 +112,36 @@ Click on a configuration value to change it. + % } elsif ( $type eq 'checkbox' ) { YES' : 'ff0000">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 }; +% } + + + + <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %> + + + % } elsif ( $type eq 'text' || $type eq 'select' ) { <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %> - + + + % } elsif ( $type eq 'select-sub' ) { @@ -131,6 +150,7 @@ Click on a configuration value to change it. <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %> + % } else { diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index f390c64a3..7f2e6670d 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -84,11 +84,9 @@ Setting <% $key %> % '' => '', 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. '"' ); -- 2.11.0