summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-11-03 18:33:15 +0100
committerYorhel <git@yorhel.nl>2016-11-03 18:33:15 +0100
commita9df5c8d7e22874d37938b27913f239ce31f9414 (patch)
treecc2fea20d37c4466b27e90564f5002dcdbd16207 /lib/VNDB
parent1e4cdeaca180bdfee0c552c57fccff8570856efd (diff)
List deleted releases when adding a new release
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/DB/Releases.pm11
-rw-r--r--lib/VNDB/Handler/Releases.pm23
2 files changed, 29 insertions, 5 deletions
diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm
index 1c262074..c54ea1a3 100644
--- a/lib/VNDB/DB/Releases.pm
+++ b/lib/VNDB/DB/Releases.pm
@@ -45,7 +45,7 @@ sub dbReleaseFilters {
# Options: id vid pid released page results what med sort reverse date_before date_after
-# plat lang olang type minage search resolution freeware doujin voiced ani_story ani_ero
+# plat lang olang type minage search resolution freeware doujin voiced ani_story ani_ero hidden_only
# What: extended vn producers platforms media affiliates
# Sort: title released minage
sub dbReleaseGet {
@@ -55,10 +55,11 @@ sub dbReleaseGet {
$o{what} ||= '';
my @where = (
- !$o{id} ? ( 'r.hidden = FALSE' => 0 ) : (),
- $o{id} ? ( 'r.id = ?' => $o{id} ) : (),
- $o{vid} ? ( 'rv.vid IN(!l)' => [ ref $o{vid} ? $o{vid} : [$o{vid}] ] ) : (),
- $o{pid} ? ( 'rp.pid = ?' => $o{pid} ) : (),
+ !$o{id} && !$o{hidden_only} ? ( 'r.hidden = FALSE' => 0 ) : (),
+ $o{hidden_only} ? ('r.hidden = TRUE' => 1) : (),
+ $o{id} ? ( 'r.id = ?' => $o{id} ) : (),
+ $o{vid} ? ( 'rv.vid IN(!l)' => [ ref $o{vid} ? $o{vid} : [$o{vid}] ] ) : (),
+ $o{pid} ? ( 'rp.pid = ?' => $o{pid} ) : (),
$self->dbReleaseFilters(%o),
);
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 62ba0c5a..31026efe 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -370,6 +370,7 @@ sub edit {
$self->htmlMainTabs('r', $r, $copy ? 'copy' : 'edit') if $rid;
$self->htmlMainTabs('v', $v, 'edit') if $vid;
$self->htmlEditMessage('r', $r, $title, $copy);
+ _listrel($self, $vid) if $vid && $self->reqMethod ne 'POST';
_form($self, $r, $v, $frm, $copy);
$self->htmlFooter;
}
@@ -467,6 +468,28 @@ sub _form {
);
}
+sub _listrel {
+ my($self, $vid) = @_;
+ my $l = $self->dbReleaseGet(vid => $vid, hidden_only => 1, results => 50);
+ return if !@$l;
+ div class => 'mainbox';
+ h1 'Deleted releases';
+ div class => 'warning';
+ p q{This visual novel has releases that have been deleted before. Please
+ review this list to make sure you're not adding a release that has already
+ been deleted before.};
+ br;
+ ul;
+ for(@$l) {
+ li;
+ txt '['.join(',', @{$_->{languages}}).'] ';
+ a href => "/r$_->{id}", title => $_->{original}||$_->{title}, "$_->{title} (r$_->{id})";
+ end;
+ }
+ end;
+ end;
+ end;
+}
sub browse {
my $self = shift;