summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/Tags.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-21 16:14:11 +0100
committerYorhel <git@yorhel.nl>2010-12-21 16:14:11 +0100
commite15869b9c0c124d67f5d8ac85ffefad383642672 (patch)
tree53a3fc52e27480792b2f0ba5ab9b9ffdbbbdac6d /lib/VNDB/Handler/Tags.pm
parente77484d81461c322656615759ba77ea25713a8d6 (diff)
Pass VN tag filters by ID rather than name
This makes the UI slightly uglier and less intuitive. I'll see if I can find a way around that. This update is required for the permanent browsing filters to be fast and reliable.
Diffstat (limited to 'lib/VNDB/Handler/Tags.pm')
-rw-r--r--lib/VNDB/Handler/Tags.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index 0567bff6..6e373d04 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -44,7 +44,8 @@ sub tagpage {
results => 50,
page => $f->{p},
sort => $f->{s}, reverse => $f->{o} eq 'd',
- tags_include => [ $f->{m}, [$tag ]],
+ tagspoil => $f->{m},
+ tag_inc => $tag,
);
my $title = mt '_tagp_title', $t->{meta}?0:1, $t->{name};
@@ -668,19 +669,22 @@ sub fulltree {
sub tagxml {
my $self = shift;
- my $q = $self->formValidate({ name => 'q', maxlength => 500 });
- return 404 if $q->{_err};
- $q = $q->{q};
+ my $f = $self->formValidate(
+ { name => 'q', required => 0, maxlength => 500 },
+ { name => 'id', required => 0, multi => 1, template => 'int' },
+ );
+ return 404 if $f->{_err} || (!$f->{q} && !$f->{id} && !$f->{id}[0]);
my($list, $np) = $self->dbTagGet(
- $q =~ /^g([1-9]\d*)/ ? (id => $1) : $q =~ /^name:(.+)$/ ? (name => $1) : (search => $q),
+ !$f->{q} ? () : $f->{q} =~ /^g([1-9]\d*)/ ? (id => $1) : $f->{q} =~ /^name:(.+)$/ ? (name => $1) : (search => $f->{q}),
+ $f->{id} && $f->{id}[0] ? (id => $f->{id}) : (),
results => 15,
page => 1,
);
$self->resHeader('Content-type' => 'text/xml; charset=UTF-8');
xml;
- tag 'tags', more => $np ? 'yes' : 'no', query => $q;
+ tag 'tags', more => $np ? 'yes' : 'no', $f->{q} ? (query => $f->{q}) : ();
for(@$list) {
tag 'item', id => $_->{id}, meta => $_->{meta} ? 'yes' : 'no', state => $_->{state}, $_->{name};
}