Added simple search results page
Rather ugly and rushed, as usual.
This commit is contained in:
parent
4d699d8d47
commit
2d200c35d9
2 changed files with 33 additions and 1 deletions
29
www/index.pl
29
www/index.pl
|
|
@ -40,6 +40,7 @@ TUWF::set(
|
||||||
TUWF::register(
|
TUWF::register(
|
||||||
qr// => \&home,
|
qr// => \&home,
|
||||||
qr{info/about} => \&about,
|
qr{info/about} => \&about,
|
||||||
|
qr{browse/search} => \&browsesearch,
|
||||||
qr{browse/([^/]+)} => \&browsesys,
|
qr{browse/([^/]+)} => \&browsesys,
|
||||||
qr{browse/([^/]+)/([^/]+)(?:/([^/]+))?} => \&browsepkg,
|
qr{browse/([^/]+)/([^/]+)(?:/([^/]+))?} => \&browsepkg,
|
||||||
qr{xml/search\.xml} => \&xmlsearch,
|
qr{xml/search\.xml} => \&xmlsearch,
|
||||||
|
|
@ -208,6 +209,32 @@ sub about {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub browsesearch {
|
||||||
|
my $self = shift;
|
||||||
|
my $q = $self->reqGet('q')||'';
|
||||||
|
my $man = $self->dbSearch($q, 150);
|
||||||
|
|
||||||
|
$self->htmlHeader(title => 'Search results for '.$q);
|
||||||
|
h1 'Search results for '.$q;
|
||||||
|
txt 'Note: This is just a simple case-insensitive prefix match on the man names. In the future we\'ll have more powerful search functionality. Hopefully.';
|
||||||
|
if(@$man) {
|
||||||
|
ul id => 'searchres';
|
||||||
|
for(@$man) {
|
||||||
|
li;
|
||||||
|
a href => "/$_->{name}.".substr($_->{section},0,1), $_->{name};
|
||||||
|
i $_->{section};
|
||||||
|
end;
|
||||||
|
}
|
||||||
|
end;
|
||||||
|
} else {
|
||||||
|
br; br;
|
||||||
|
b 'No results :-(';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->htmlFooter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub browsesys {
|
sub browsesys {
|
||||||
my($self, $short) = @_;
|
my($self, $short) = @_;
|
||||||
|
|
||||||
|
|
@ -502,7 +529,7 @@ sub htmlHeader {
|
||||||
|
|
||||||
div id => 'header';
|
div id => 'header';
|
||||||
a href => '/', 'manned.org';
|
a href => '/', 'manned.org';
|
||||||
form action => '/', method => 'get';
|
form action => '/browse/search', method => 'get';
|
||||||
input type => 'text', name => 'q', id => 'q';
|
input type => 'text', name => 'q', id => 'q';
|
||||||
input type => 'submit', value => ' ';
|
input type => 'submit', value => ' ';
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,11 @@ td { padding: 1px 5px; font-size: 12px; border-left: 1px solid #ccc; }
|
||||||
#packages i { color: #aaa; font-size: 13px; }
|
#packages i { color: #aaa; font-size: 13px; }
|
||||||
#packages a { padding-right: 5px }
|
#packages a { padding-right: 5px }
|
||||||
|
|
||||||
|
#searchres { margin: 20px 0; -webkit-column-width: 300px; -moz-column-width: 300px; column-width: 300px }
|
||||||
|
#searchres li { display: block; }
|
||||||
|
#searchres i { color: #aaa; font-size: 13px; }
|
||||||
|
#searchres a { padding-right: 5px }
|
||||||
|
|
||||||
#manuals { margin: 20px 0; -webkit-column-width: 500px; -moz-column-width: 500px; column-width: 500px }
|
#manuals { margin: 20px 0; -webkit-column-width: 500px; -moz-column-width: 500px; column-width: 500px }
|
||||||
#manuals li { display: block; }
|
#manuals li { display: block; }
|
||||||
#manuals i { color: #aaa; font-size: 13px; }
|
#manuals i { color: #aaa; font-size: 13px; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue