summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-12-01 21:32:01 +0100
committerYorhel <git@yorhel.nl>2008-12-01 21:32:01 +0100
commit531db3e8ddc8523df730a3412fe6ccee21a71259 (patch)
tree939d943c9b2a0cc803a49db52b0e733ed1b1927e /lib/VNDB
parent3f747b5fce24fad0635be727c431e1fb234c3fa6 (diff)
Interface for the advanced VN search feature
We're getting there...
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/DB/Misc.pm17
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm86
2 files changed, 86 insertions, 17 deletions
diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm
index a58534c6..9ebac75f 100644
--- a/lib/VNDB/DB/Misc.pm
+++ b/lib/VNDB/DB/Misc.pm
@@ -6,7 +6,7 @@ use warnings;
use Exporter 'import';
our @EXPORT = qw|
- dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod
+ dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbLanguages
|;
@@ -151,6 +151,21 @@ sub dbItemMod {
}
+# Returns a list of languages actually in use
+sub dbLanguages {
+ my $self = shift;
+ return [
+ map $_->{language}, @{$self->dbAll(q|
+ SELECT DISTINCT rr.language
+ FROM releases r
+ JOIN releases_rev rr ON rr.id = r.latest
+ WHERE r.hidden = FALSE|
+ )}
+ ];
+}
+
+
+
1;
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index 410e5de4..f65132d2 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -72,22 +72,7 @@ sub list {
if $q && @$list == 1;
$self->htmlHeader(title => 'Browse visual novels', search => $f->{q});
-
- div class => 'mainbox';
- h1 'Browse visual novels';
- form class => 'search', action => '/v/all', 'accept-charset' => 'UTF-8', method => 'get';
- fieldset;
- input type => 'text', name => 'q', id => 'q', class => 'text', value => $f->{q};
- input type => 'submit', class => 'submit', value => 'Search!';
- end;
- end;
- p class => 'browseopts';
- for ('all', 'a'..'z', 0) {
- a href => "/v/$_", $_ eq $char ? (class => 'optselected') : (), $_ ? uc $_ : '#';
- }
- end;
- end;
-
+ _filters($self, $f, $char);
$self->htmlBrowse(
class => 'vnbrowse',
items => $list,
@@ -125,5 +110,74 @@ sub list {
}
+sub _filters {
+ my($self, $f, $char) = @_;
+
+ div class => 'mainbox';
+ h1 'Browse visual novels';
+ form class => 'search', action => '/v/all', 'accept-charset' => 'UTF-8', method => 'get';
+ fieldset;
+ input type => 'text', name => 'q', id => 'q', class => 'text', value => $f->{q};
+ input type => 'submit', class => 'submit', value => 'Search!';
+ end;
+ end;
+ p class => 'browseopts';
+ for ('all', 'a'..'z', 0) {
+ a href => "/v/$_", $_ eq $char ? (class => 'optselected') : (), $_ ? uc $_ : '#';
+ }
+ end;
+ a id => 'advselect', href => '#';
+ lit '<i>&#9656;</i> advanced search';
+ end;
+ div id => 'advoptions', class => 'hidden';
+
+ h2;
+ lit 'Categories <p>(boolean and, selecting more gives less results. The categories are explained on <a href="/d1">this page</a>)</p>';
+ end;
+ ul id => 'catselect';
+ for my $c (qw| e g t p h l s |) {
+ $c !~ /[thl]/ ? li : br;
+ txt $self->{categories}{$c}[0];
+ ul;
+ li id => "cat_$c$_", $self->{categories}{$c}[1]{$_}
+ for (sort keys %{$self->{categories}{$c}[1]});
+ end;
+ end if $c !~ /[gph]/;
+ }
+
+ h2;
+ lit 'Languages <p>(boolean or, selecting more gives more results)</p>';
+ end;
+ for(sort @{$self->dbLanguages}) {
+ span;
+ input type => 'checkbox', id => "lang_$_";
+ label for => "lang_$_";
+ acronym class => "icons lang $_", title => $self->{languages}{$_}, ' ';
+ txt $self->{languages}{$_};
+ end;
+ end;
+ }
+
+ h2;
+ lit 'Platforms <p>(boolean or, selecting more gives more results)</p>';
+ end;
+ for(sort keys %{$self->{platforms}}) {
+ next if $_ eq 'oth';
+ span;
+ input type => 'checkbox', id => "plat_$_";
+ label for => "plat_$_";
+ acronym class => "icons $_", title => $self->{platforms}{$_}, ' ';
+ txt $self->{platforms}{$_};
+ end;
+ end;
+ }
+
+ br style => 'clear: left';
+ end;
+ end;
+ end;
+}
+
+
1;