summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--lib/VNDB/Util/CommonHTML.pm17
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b29cab16..65a0a89a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@ git - ?
- Display number of unread posts in "My messages" (instead of total threads)
- Optimized dbUserGet (mostly for the user list)
- All languages are listed on /r and /v/all instead of only those in use
+ - Copy over search query when switching search type (htmlSearchBox)
2.7 - 2009-09-24
- Improved styling of the threeboxes layout
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';