show inputs selection only if there are more than one
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 11 Jun 2009 18:58:28 +0000 (18:58 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 11 Jun 2009 18:58:28 +0000 (18:58 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1228 07558da8-63fa-0310-ba24-9fe276d99e06

vhost/webpac2.cgi

index edf595b..45f2ee2 100755 (executable)
@@ -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|<input type=hidden name=current_page value=1 >|,
                checkbox( -name => 'debug', -default => 0 ), # FIXME hidden?
                qq|<div id=inputs>|,
-               h2( 'Select input' ),
+               $inputs_available > 1 ?
+               h2( 'Select input' ) .
                checkbox_group(
                        -name => 'only_input',
                        %$only_input,
                        -linebreak=> 'true',
-               ),
+               ) : '',
                qq|</div>|,
                end_form,
        ;