X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FSearchView.pm;h=fbef4116e9623f2838f17cf0c4fc31c9ff31acaf;hb=5c5dfb7d5558ff248477fa57aef08e2a8bbd9800;hp=6bc66ceb0ca68d35d9f0a82f29e3771f609d78b6;hpb=501730e6782d3f8839378145f56a53d205838931;p=public-inbox.git diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 6bc66ceb..fbef4116 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -1,19 +1,22 @@ # Copyright (C) 2015 all contributors # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt) +# +# Displays search results for the web interface package PublicInbox::SearchView; use strict; use warnings; use PublicInbox::SearchMsg; -use PublicInbox::Hval; +use PublicInbox::Hval qw/ascii_html/; use PublicInbox::View; -use PublicInbox::MID qw(mid2path mid_clean); +use PublicInbox::MID qw(mid2path mid_mime); use Email::MIME; -use POSIX qw/strftime/; +require PublicInbox::Git; +require PublicInbox::Thread; our $LIM = 50; sub sres_top_html { my ($ctx) = @_; - my $q = PublicInbox::SearchQuery->new($ctx->{cgi}); + my $q = PublicInbox::SearchQuery->new($ctx->{qp}); my $code = 200; # double the limit for expanded views: @@ -30,10 +33,10 @@ sub sres_top_html { $total = $mset->get_matches_estimated; }; my $err = $@; - my $res = html_start($q, $ctx) . PublicInbox::View::PRE_WRAP; + my $res = html_start($q, $ctx) . '
'; if ($err) { $code = 400; - $res .= err_txt($err) . "
" . foot($ctx); + $res .= err_txt($ctx, $err) . "
" . foot($ctx); } elsif ($total == 0) { $code = 404; $res .= "\n\n[No results found]
".foot($ctx); @@ -41,19 +44,21 @@ sub sres_top_html { my $x = $q->{x}; return sub { adump($_[0], $mset, $q, $ctx) } if ($x eq 'A'); - $res .= search_nav_top($mset, $q); + $res .= search_nav_top($mset, $q) . "\n\n"; if ($x eq 't') { return sub { tdump($_[0], $res, $mset, $q, $ctx) }; } - $res .= "\n\n"; dump_mset(\$res, $mset); - $res .= search_nav_bot($mset, $q) . "\n\n" . foot($ctx); + $res .= '' . search_nav_bot($mset, $q) . + "\n\n" . foot($ctx); } $res .= "