summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-17 15:14:56 +0100
committerYorhel <git@yorhel.nl>2010-12-17 15:14:56 +0100
commit7849c8aeb4f6e6c829a128d7303f63df999a337f (patch)
tree073ec5a6c751759a57f808d60c31de76621514e8 /lib
parent50cfb305796d1d115c408feefbe39fddf7615166 (diff)
Check for editsum = description and give an easier to understand error
The check is quite basic and you can easily get around it. It's just intended to warn about common mistakes.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/Producers.pm3
-rw-r--r--lib/VNDB/Handler/Releases.pm3
-rw-r--r--lib/VNDB/Handler/VNEdit.pm4
-rw-r--r--lib/VNDB/Util/FormHTML.pm2
4 files changed, 8 insertions, 4 deletions
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index d6308593..f7a46c2d 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -225,10 +225,11 @@ sub edit {
{ name => 'l_wp', required => 0, maxlength => 150, default => '' },
{ name => 'desc', required => 0, maxlength => 5000, default => '' },
{ name => 'prodrelations', required => 0, maxlength => 5000, default => '' },
- { name => 'editsum', maxlength => 5000 },
+ { name => 'editsum', required => 0, maxlength => 5000 },
{ name => 'ihid', required => 0 },
{ name => 'ilock', required => 0 },
);
+ push @{$frm->{_err}}, 'badeditsum' if !$frm->{editsum} || lc($frm->{editsum}) eq lc($frm->{desc});
if(!$frm->{_err}) {
# parse
my $relations = [ map { /^([a-z]+),([0-9]+),(.+)$/ && (!$pid || $2 != $pid) ? [ $1, $2, $3 ] : () } split /\|\|\|/, $frm->{prodrelations} ];
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 218389ee..728a68cb 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -324,11 +324,12 @@ sub edit {
{ name => 'ani_ero', required => 0, default => 0, enum => $self->{animated} },
{ name => 'producers', required => 0, default => '' },
{ name => 'vn', maxlength => 5000 },
- { name => 'editsum', maxlength => 5000 },
+ { name => 'editsum', required => 0, maxlength => 5000 },
{ name => 'ihid', required => 0 },
{ name => 'ilock', required => 0 },
);
+ push @{$frm->{_err}}, 'badeditsum' if !$frm->{editsum} || lc($frm->{editsum}) eq lc($frm->{notes});
push @{$frm->{_err}}, [ 'released', 'required', 1 ] if !$frm->{released};
my($media, $producers, $new_vn);
diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm
index 8ee104af..b93c544d 100644
--- a/lib/VNDB/Handler/VNEdit.pm
+++ b/lib/VNDB/Handler/VNEdit.pm
@@ -52,11 +52,13 @@ sub edit {
{ name => 'img_nsfw', required => 0, default => 0 },
{ name => 'vnrelations', required => 0, default => '', maxlength => 5000 },
{ name => 'screenshots', required => 0, default => '', maxlength => 1000 },
- { name => 'editsum', maxlength => 5000 },
+ { name => 'editsum', required => 0, maxlength => 5000 },
{ name => 'ihid', required => 0 },
{ name => 'ilock', required => 0 },
);
+ push @{$frm->{_err}}, 'badeditsum' if !$frm->{editsum} || lc($frm->{editsum}) eq lc($frm->{desc});
+
# handle image upload
my $image = _uploadimage($self, $v, $frm);
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index d619754a..6cb9f7a2 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -27,7 +27,7 @@ sub htmlFormError {
ul;
for my $e (@{$frm->{_err}}) {
if(!ref $e) {
- li mt '_formerr_e_'.$e;
+ li; lit mt '_formerr_e_'.$e; end;
next;
}
my($field, $type, $rule) = @$e;