summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Tags.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-03-14 16:56:02 +0100
committerYorhel <git@yorhel.nl>2009-03-14 16:56:02 +0100
commitb9e28ab961cb432eedc84c261d0137688b696d68 (patch)
tree4d3fffb7abf45a238118cf9c5ce62098937c9bed /lib/VNDB/DB/Tags.pm
parentc83abfe20531a87c16c4d0bd5cb170faed3ca28b (diff)
Added tag list (/g/list) to browse tags by status, mostly for moderator use
Diffstat (limited to 'lib/VNDB/DB/Tags.pm')
-rw-r--r--lib/VNDB/DB/Tags.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm
index 8428c5a6..0268d8de 100644
--- a/lib/VNDB/DB/Tags.pm
+++ b/lib/VNDB/DB/Tags.pm
@@ -8,7 +8,7 @@ use Exporter 'import';
our @EXPORT = qw|dbTagGet dbTagTree dbTagEdit dbTagAdd dbTagDel dbTagLinks dbTagLinkEdit dbTagStats dbTagVNs|;
-# %options->{ id noid name search page results order what }
+# %options->{ id noid name search state page results order what }
# what: parents childs(n) aliases
sub dbTagGet {
my $self = shift;
@@ -21,6 +21,7 @@ sub dbTagGet {
);
$o{search} =~ s/%//g if $o{search};
+ $o{state} = 1 if !defined $o{state} && !$o{id} && !$o{name};
my %where = (
$o{id} ? (
@@ -29,8 +30,8 @@ sub dbTagGet {
't.id <> ?' => $o{noid} ) : (),
$o{name} ? (
't.id = (SELECT id FROM tags LEFT JOIN tags_aliases ON id = tag WHERE lower(name) = ? OR lower(alias) = ? LIMIT 1)' => [ lc $o{name}, lc $o{name} ]) : (),
- !$o{id} && !$o{name} ? (
- 't.state <> 1' => 1 ) : (),
+ defined $o{state} ? (
+ 't.state = ?' => $o{state} ) : (),
$o{search} ? (
't.id IN (SELECT id FROM tags LEFT JOIN tags_aliases ON id = tag WHERE name ILIKE ? OR alias ILIKE ?)' => [ "%$o{search}%", "%$o{search}%" ] ) : (),
);