summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-15 13:37:03 +0100
committerYorhel <git@yorhel.nl>2008-11-15 13:37:03 +0100
commit42bddb1cc2df7568c62fe5aa5c2b5b228c208a02 (patch)
tree00049ad571ab0c52d2489946330a3005c1914896 /lib
parentd97f5a7658a7a9029ada1b1d0a3a3bac9d031f6e (diff)
Added edits/newly created pages filter
History browser is now pretty much done
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Misc.pm5
-rw-r--r--lib/VNDB/Handler/Misc.pm23
2 files changed, 21 insertions, 7 deletions
diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm
index 3469dc17..6fb82801 100644
--- a/lib/VNDB/DB/Misc.pm
+++ b/lib/VNDB/DB/Misc.pm
@@ -82,13 +82,14 @@ sub dbItemInsert {
}
-# Options: type, iid, uid, auto, hidden, page, results
+# Options: type, iid, uid, auto, hidden, edit, page, results
sub dbRevisionGet {
my($self, %o) = @_;
$o{results} ||= 10;
$o{page} ||= 1;
$o{auto} ||= 0; # 0:show, -1:only, 1:hide
$o{hidden} ||= 0;
+ $o{edit} ||= 0; # 0:both, -1:new, 1:edits
my %where = (
$o{type} ? (
@@ -104,6 +105,8 @@ sub dbRevisionGet {
) : $o{hidden} == -1 ? (
'(v.hidden IS NOT NULL AND v.hidden = TRUE OR r.hidden IS NOT NULL AND r.hidden = TRUE OR p.hidden IS NOT NULL AND p.hidden = TRUE)' => 1,
) : (),
+ $o{edit} ? (
+ 'c.rev !s 1' => $o{edit} < 0 ? '=' : '>' ) : (),
);
my @join = (
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index 4bbbfb0e..0dd8ff97 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -37,6 +37,7 @@ sub history {
{ name => 'm', required => 0, default => 0, enum => [ 0, 1 ] },
{ name => 'h', required => 0, default => 1, enum => [ -1..1 ] },
{ name => 't', required => 0, default => '', enum => [ 'v', 'r', 'p' ] },
+ { name => 'e', required => 0, default => 0, enum => [ -1..1 ] },
);
return 404 if $f->{_err};
@@ -57,11 +58,13 @@ sub history {
results => 50,
auto => $f->{m},
hidden => $f->{h},
+ edit => $f->{e},
);
$self->htmlHeader(title => $title);
$self->htmlMainTabs($type, $obj, 'hist') if $type;
+ # url generator
my $u = sub {
my($n, $v) = @_;
$n ||= '';
@@ -69,8 +72,10 @@ sub history {
$_ .= '?m='.($n eq 'm' ? $v : $f->{m});
$_ .= '&h='.($n eq 'h' ? $v : $f->{h});
$_ .= '&t='.($n eq 't' ? $v : $f->{t});
+ $_ .= '&e='.($n eq 'e' ? $v : $f->{e});
};
+ # filters
div class => 'mainbox';
h1 $title;
if($type ne 'u') {
@@ -79,22 +84,28 @@ sub history {
a $f->{m} ? (class => 'optselected') : (), href => $u->(m => 1), 'Hide automated edits';
end;
}
- if($self->authCan('del')) {
- p class => 'browseopts';
- a $f->{h} == 1 ? (class => 'optselected') : (), href => $u->(h => 1), 'Hide deleted items';
- a $f->{h} == -1 ? (class => 'optselected') : (), href => $u->(h => -1), 'Show deleted items';
- end;
- }
if(!$type || $type eq 'u') {
+ if($self->authCan('del')) {
+ p class => 'browseopts';
+ a $f->{h} == 1 ? (class => 'optselected') : (), href => $u->(h => 1), 'Hide deleted items';
+ a $f->{h} == -1 ? (class => 'optselected') : (), href => $u->(h => -1), 'Show deleted items';
+ end;
+ }
p class => 'browseopts';
a !$f->{t} ? (class => 'optselected') : (), href => $u->(t => ''), 'Show all items';
a $f->{t} eq 'v' ? (class => 'optselected') : (), href => $u->(t => 'v'), 'Only visual novels';
a $f->{t} eq 'r' ? (class => 'optselected') : (), href => $u->(t => 'r'), 'Only releases';
a $f->{t} eq 'p' ? (class => 'optselected') : (), href => $u->(t => 'p'), 'Only producers';
end;
+ p class => 'browseopts';
+ a !$f->{e} ? (class => 'optselected') : (), href => $u->(e => 0), 'Show all changes';
+ a $f->{e} == 1 ? (class => 'optselected') : (), href => $u->(e => 1), 'Only edits';
+ a $f->{e} == -1 ? (class => 'optselected') : (), href => $u->(e => -1), 'Only newly created pages';
+ end;
}
end;
+ # actual browse box
$self->htmlBrowse(
items => $list,
options => $f,