summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-10-12 17:31:18 +0200
committerYorhel <git@yorhel.nl>2009-10-12 17:31:18 +0200
commit4f687e4d1e81b665196251bb0cfa48c062357d20 (patch)
tree6f420a7803b0300e9297178f2d92d2878434e26a /lib
parent69d8738688ebb72707fe377b7ce7c717407aea96 (diff)
htmlSearchBox: Copy over search query when switching search type
<@EchoMateria> for example I searched for 'Maika' in Visual Novels <@EchoMateria> then remembered that it was a producer not a game and clicked Producers instead <@EchoMateria> can you set it so that entry in the search field would stay and it would search for it in the producers instead?
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Util/CommonHTML.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index 90c9db13..3d032d37 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -537,13 +537,20 @@ sub htmlHistory {
sub htmlSearchBox {
my($self, $sel, $v) = @_;
+ # escape search query for use as a query string value
+ (my $q = $v||'') =~ s/&/%26/g;
+ $q =~ s/\?/%3F/g;
+ $q =~ s/;/%3B/g;
+ $q =~ s/ /%20/g;
+ $q = "?q=$q" if $q;
+
fieldset class => 'search';
p class => 'searchtabs';
- a href => '/v/all', $sel eq 'v' ? (class => 'sel') : (), mt '_searchbox_vn';
- a href => '/r', $sel eq 'r' ? (class => 'sel') : (), mt '_searchbox_releases';
- a href => '/p/all', $sel eq 'p' ? (class => 'sel') : (), mt '_searchbox_producers';
- a href => '/g', $sel eq 'g' ? (class => 'sel') : (), mt '_searchbox_tags';
- a href => '/u/all', $sel eq 'u' ? (class => 'sel') : (), mt '_searchbox_users';
+ a href => "/v/all$q", $sel eq 'v' ? (class => 'sel') : (), mt '_searchbox_vn';
+ a href => "/r$q", $sel eq 'r' ? (class => 'sel') : (), mt '_searchbox_releases';
+ a href => "/p/all$q", $sel eq 'p' ? (class => 'sel') : (), mt '_searchbox_producers';
+ a href => '/g'.($q?"/list$q":''), $sel eq 'g' ? (class => 'sel') : (), mt '_searchbox_tags';
+ a href => "/u/all$q", $sel eq 'u' ? (class => 'sel') : (), mt '_searchbox_users';
end;
input type => 'text', name => 'q', id => 'q', class => 'text', value => $v;
input type => 'submit', class => 'submit', value => mt '_searchbox_submit';