From cc0a6710aba095d4867ef198e3ebefb3176797d3 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 11 Jun 2009 18:58:28 +0000 Subject: [PATCH] show inputs selection only if there are more than one git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1228 07558da8-63fa-0310-ba24-9fe276d99e06 --- vhost/webpac2.cgi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vhost/webpac2.cgi b/vhost/webpac2.cgi index edf595b..45f2ee2 100755 --- a/vhost/webpac2.cgi +++ b/vhost/webpac2.cgi @@ -132,12 +132,14 @@ my @attr = @{ $attr_labels->{'-values'} }; warn dump( $attr_labels, $attr_operators ); my $only_input; +my $inputs_available = 0; foreach ( @{ $db->{input} } ) { my $input = $_->{name} || die "no name in ",dump( $_ ); if ( ! $only_input->{'-labels'}->{$input} ) { push @{ $only_input->{'-values'} }, $input; $only_input->{'-labels'}->{$input} = $_->{description} || $input; + $inputs_available++; } } @@ -163,12 +165,13 @@ sub search_form { qq||, checkbox( -name => 'debug', -default => 0 ), # FIXME hidden? qq|
|, - h2( 'Select input' ), + $inputs_available > 1 ? + h2( 'Select input' ) . checkbox_group( -name => 'only_input', %$only_input, -linebreak=> 'true', - ), + ) : '', qq|
|, end_form, ; -- 2.20.1