13 |
use JSON; |
use JSON; |
14 |
|
|
15 |
my $range_around = 5; |
my $range_around = 5; |
16 |
my $entries_per_page = 30; |
my @entries_per_page = ( 30, 50, 100, 500 ); |
17 |
my $debug = param('debug'); |
my $debug = param('debug'); |
18 |
|
|
19 |
print header( |
print header( |
136 |
|
|
137 |
foreach ( @{ $db->{input} } ) { |
foreach ( @{ $db->{input} } ) { |
138 |
my $input = $_->{name} || die "no name in ",dump( $_ ); |
my $input = $_->{name} || die "no name in ",dump( $_ ); |
139 |
|
next unless defined $stats->{input}->{$input}; # skip inputs without data |
140 |
if ( ! $only_input->{'-labels'}->{$input} ) { |
if ( ! $only_input->{'-labels'}->{$input} ) { |
141 |
push @{ $only_input->{'-values'} }, $input; |
push @{ $only_input->{'-values'} }, $input; |
142 |
$only_input->{'-labels'}->{$input} = $_->{description} || $input; |
$only_input->{'-labels'}->{$input} = $_->{description} || $input; |
160 |
), |
), |
161 |
textfield( -name => 'search' ), |
textfield( -name => 'search' ), |
162 |
$attr_operators ? popup_menu( -name => 'attr_operator', %$attr_operators ) : '', |
$attr_operators ? popup_menu( -name => 'attr_operator', %$attr_operators ) : '', |
163 |
submit, |
submit( -value => 'Search' ), |
164 |
hidden( -name => 'entries_per_page', -default => $entries_per_page ), |
# hidden( -name => 'entries_per_page', -default => $entries_per_page ), |
165 |
|
popup_menu( -name => 'entries_per_page', -values => [ @entries_per_page ], -title => 'entries per page' ), |
166 |
# we need current_page fixed at 1 so that every submit through form will reset it |
# we need current_page fixed at 1 so that every submit through form will reset it |
167 |
qq|<input type=hidden name=current_page value=1 >|, |
qq|<input type=hidden name=current_page value=1 >|, |
168 |
checkbox( -name => 'debug', -default => 0 ), # FIXME hidden? |
checkbox( -name => 'debug', -default => 0 ), # FIXME hidden? |
282 |
|
|
283 |
while ( my $result = $swish_results->next_result ) { |
while ( my $result = $swish_results->next_result ) { |
284 |
|
|
285 |
my $data = from_json $result->property('data'); |
my $data = from_json( $result->property('data'), {utf8 => 1} ); |
286 |
|
|
287 |
dump_yaml( 'data', $data ); |
dump_yaml( 'data', $data ); |
288 |
|
|
293 |
next unless defined $data->{$attr}; |
next unless defined $data->{$attr}; |
294 |
my $v = $data->{$attr}; |
my $v = $data->{$attr}; |
295 |
if ( $html_markup && ! $html_markup_skip->{$attr} ) { |
if ( $html_markup && ! $html_markup_skip->{$attr} ) { |
296 |
eval "\$v = $html_markup->$attr( \$v );"; |
eval "\$v = $html_markup->$attr( \$v, \$data );"; |
297 |
if ( $@ ) { |
if ( $@ ) { |
298 |
warn "disable html markup for $attr: $@"; |
warn "disable html markup for $attr: $@"; |
299 |
$html_markup_skip->{$attr} = $@; |
$html_markup_skip->{$attr} = $@; |