push @style, "../../$path/$path.css" if -e "$dir/$path/$path.css";
dump_yaml( 'style', \@style );
-print
- start_html(
- -title => $db->{name},
- -style => [ @style ],
- ),
- h1( $db->{name} ),
- qq|<div id=description>|, $db->{description}, qq|</div>|,
+sub search_form {
+ qq|<a name="form"></a>|,
start_form( -action => self_url( query => 0 ) ),
radio_group(
-name => 'attr',
-linebreak=> 'true',
),
qq|</div>|,
+ end_form,
+ ;
+}
-;
-print end_form;
+print
+ start_html(
+ -title => $db->{name},
+ -style => [ @style ],
+ ),
+ h1( $db->{name} ),
+ qq|<div id=description>|, $db->{description}, qq|</div>|,
+;
if ( my $search = param('search') ) {
- print qq|<div id="results">|;
+ print qq|
+ <a href="#form" class="skip" title="skip to search form">#</a>
+ <div id="results">
+ |;
my $swish = SWISH::API->new( "$dir/../var/swish/$database" );
$swish->abort_last_error if $swish->Error;
$attr . '="' . $template . '"';
;
};
- $v =~ s{(\s*)(\S+)}{rewrite($1,$2)}ge;
+ if ( $op =~ m{\s} ) {
+ my $template = $op;
+ $template =~ s{Q}{$v};
+ $v = $attr . '="' . $template . '"';
+ } else {
+ $v =~ s{(\s*)(\S+)}{rewrite($1,$2)}ge;
+ }
push @search, $v;
my @only_input = param('only_input');
- push @search, '(' . join(') OR (', map { "input=$_" } @only_input) . ')' if @only_input;
+ push @search, '((' . join(') OR (', map { "input=\"$_\"" } @only_input) . '))' if @only_input;
} else {
push @search, "all=\"$search\"";
}
my $limit = $pager->entries_on_this_page;
+ my $nr = 1;
+
while ( my $result = $swish_results->next_result ) {
my $data = from_json $result->property('data');
dump_yaml( 'data', $data );
- print qq|<li>|;
+ my $li_class = '';
+ $li_class = qq| class="z"| if $nr % 2 == 0;
+ print qq|<li$li_class>|;
foreach my $attr ( @attr ) {
next unless defined $data->{$attr};
my $v = $data->{$attr};
}
+print search_form;
+
dump_yaml( "config databases $database", $db );
dump_yaml( 'html_markup_skip', $html_markup_skip );