summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-21 13:42:10 +0100
committerYorhel <git@yorhel.nl>2008-11-21 13:42:10 +0100
commit9bfabe3e12f754d5d8cf409ffa63706083ebe941 (patch)
tree099bdfee322d7ecb4c9ea85d6edc8f4d46a63128
parentc3c186d61c316a8aa53f4ebb24e3f049f67984dd (diff)
Added htmlHiddenMessage() to hide deleted items
-rw-r--r--lib/VNDB/Handler/Producers.pm15
-rw-r--r--lib/VNDB/Handler/VNPage.pm2
-rw-r--r--lib/VNDB/Util/CommonHTML.pm23
3 files changed, 25 insertions, 15 deletions
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index c770e435..234280b7 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -28,6 +28,7 @@ sub page {
$self->htmlHeader(title => $p->{name});
$self->htmlMainTabs(p => $p);
+ return if $self->htmlHiddenMessage('p', $p);
if($rev) {
my $prev = $rev && $rev > 1 && $self->dbProducerGet(id => $pid, rev => $rev-1, what => 'changes')->[0];
@@ -41,20 +42,6 @@ sub page {
);
}
- if($p->{hidden}) {
- div class => 'mainbox';
- h1 $p->{name};
- div class => 'warning';
- h2 'Item deleted';
- p;
- lit qq|This item has been deleted from the database, File a request on the|
- .qq| <a href="/t/p$pid">discussion board</a> to undelete this page.|;
- end;
- end;
- end;
- return $self->htmlFooter if !$self->authCan('del');
- }
-
div class => 'mainbox producerpage';
p class => 'locked', 'Locked for editing' if $p->{locked};
h1 $p->{name};
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 8ec32143..cb5e5576 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -44,6 +44,8 @@ sub page {
$self->htmlHeader(title => $v->{title});
$self->htmlMainTabs('v', $v);
+ return if $self->htmlHiddenMessage('v', $v);
+
div class => 'mainbox';
h1 $v->{title};
h2 class => 'alttitle', $v->{original} if $v->{original};
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index bf83ff61..04f2d9fa 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -8,7 +8,7 @@ use Exporter 'import';
use Algorithm::Diff 'sdiff';
use VNDB::Func;
-our @EXPORT = qw|htmlMainTabs htmlDenied htmlBrowse htmlBrowseNavigate htmlRevision|;
+our @EXPORT = qw|htmlMainTabs htmlDenied htmlHiddenMessage htmlBrowse htmlBrowseNavigate htmlRevision|;
# generates the "main tabs". These are the commonly used tabs for
@@ -102,6 +102,27 @@ sub htmlDenied {
}
+# Generates message saying that the current item has been deleted,
+# Arguments: [pvr], obj
+# Returns 1 if the use doesn't have access to the page, 0 otherwise
+sub htmlHiddenMessage {
+ my($self, $type, $obj) = @_;
+ return 0 if !$obj->{hidden};
+ div class => 'mainbox';
+ h1 $obj->{title}||$obj->{name};
+ div class => 'warning';
+ h2 'Item deleted';
+ p;
+ lit qq|This item has been deleted from the database, File a request on the|
+ .qq| <a href="/t/$type$obj->{id}">discussion board</a> to undelete this page.|;
+ end;
+ end;
+ end;
+ return $self->htmlFooter() || 1 if !$self->authCan('del');
+ return 0;
+}
+
+
# generates a browse box, arguments:
# items => arrayref with the list items
# options => hashref containing at least the keys s (sort key), o (order) and p (page)