summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-09-12 10:34:49 +0200
committerYorhel <git@yorhel.nl>2019-09-12 10:34:49 +0200
commit08aab1b868280b295150734cdf3841d60b815f96 (patch)
tree050a28b6e5c89d08f8c0153741d481f734a0c48a
parent794806518f18bfb5470a785bb47ca799f11679b3 (diff)
VNDB::Types: Convert producer_types
-rw-r--r--data/global.pl5
-rw-r--r--lib/Multi/API.pm2
-rw-r--r--lib/Multi/RG.pm2
-rw-r--r--lib/VN3/ElmGen.pm2
-rw-r--r--lib/VN3/Producer/Edit.pm2
-rw-r--r--lib/VN3/Producer/Page.pm2
-rw-r--r--lib/VN3/Types.pm8
-rw-r--r--lib/VNDB/Handler/Producers.pm8
-rw-r--r--lib/VNDB/Types.pm8
9 files changed, 17 insertions, 22 deletions
diff --git a/data/global.pl b/data/global.pl
index 2e99d049..2083c5a1 100644
--- a/data/global.pl
+++ b/data/global.pl
@@ -48,11 +48,6 @@ our %S;
permissions => {qw| board 1 boardmod 2 edit 4 tag 16 dbmod 32 tagmod 64 usermod 128 |},
default_perm => 1+4+16, # Keep synchronised with the default value of users.perm
default_tags_cat=> 'cont,tech',
- producer_types => ordhash(
- co => 'Company',
- in => 'Individual',
- ng => 'Amateur group',
- ),
# Some discussion board properties are hardcoded, e.g.:
# - number of rows to show on /t
# - whether it needs mod access
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 28ed8bc2..fdde0e8c 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -777,7 +777,7 @@ my %GET_PRODUCER = (
],
type => [
[ str => 'p.type :op: :value:', {qw|= = != <>|},
- process => sub { !$VNDB::S{producer_types}{$_[0]} ? \'No such producer type' : $_[0] } ],
+ process => sub { !$PRODUCER_TYPE{$_[0]} ? \'No such producer type' : $_[0] } ],
],
language => [
[ str => 'p.lang :op: :value:', {qw|= = != <>|}, process => \'lang' ],
diff --git a/lib/Multi/RG.pm b/lib/Multi/RG.pm
index 9a158f21..0a6039a3 100644
--- a/lib/Multi/RG.pm
+++ b/lib/Multi/RG.pm
@@ -232,7 +232,7 @@ sub gv_prodnode {
q|<TR><TD ALIGN="CENTER"> %s </TD><TD ALIGN="CENTER"> %s </TD></TR>|.
qq|</TABLE>> ]\n|,
$n->{id}, encode_utf8($tooltip), $O{fsize}[2], encode_utf8($name),
- $LANGUAGE{$n->{lang}}, $VNDB::S{producer_types}{$n->{type}};
+ $LANGUAGE{$n->{lang}}, $PRODUCER_TYPE{$n->{type}};
}
diff --git a/lib/VN3/ElmGen.pm b/lib/VN3/ElmGen.pm
index 18f15521..3e3f9faf 100644
--- a/lib/VN3/ElmGen.pm
+++ b/lib/VN3/ElmGen.pm
@@ -173,7 +173,7 @@ def creditType => 'List (String, String)' => list map tuple(string $_, st
def languages => 'List (String, String)' => list map tuple(string $_, string $LANGUAGE{$_}), sort { $LANGUAGE{$a} cmp $LANGUAGE{$b} } keys %LANGUAGE;
def platforms => 'List (String, String)' => list map tuple(string $_, string $PLATFORM{$_}), keys %PLATFORM;
def releaseTypes => 'List String' => list map string($_), release_types;
-def producerTypes => 'List (String, String)' => list map tuple(string $_, string $PRODUCER_TYPES{$_}), keys %PRODUCER_TYPES;
+def producerTypes => 'List (String, String)' => list map tuple(string $_, string $PRODUCER_TYPE{$_}), keys %PRODUCER_TYPE;
def minAges => 'List (Int, String)' => list map tuple($_, string minage_display_full $_), @MINAGE;
def resolutions => 'List (String, String)' => list map tuple(string $_, string resolution_display_full $_), keys %RESOLUTIONS;
def voiced => 'List String' => list map string($_), @VOICED;
diff --git a/lib/VN3/Producer/Edit.pm b/lib/VN3/Producer/Edit.pm
index 1b2fd21d..3643d771 100644
--- a/lib/VN3/Producer/Edit.pm
+++ b/lib/VN3/Producer/Edit.pm
@@ -12,7 +12,7 @@ my $FORM = {
locked => { anybool => 1 },
original => { required => 0, default => '', maxlength => 200 },
name => { maxlength => 200 },
- ptype => { enum => \%PRODUCER_TYPES }, # This is 'type' in the database, but renamed for Elm compat
+ ptype => { enum => \%PRODUCER_TYPE }, # This is 'type' in the database, but renamed for Elm compat
relations => { maxlength => 50, sort_keys => 'pid', aoh => {
pid => { id => 1 }, # X
relation => { producer_relation => 1 },
diff --git a/lib/VN3/Producer/Page.pm b/lib/VN3/Producer/Page.pm
index ba52c8b1..89cd9dd8 100644
--- a/lib/VN3/Producer/Page.pm
+++ b/lib/VN3/Producer/Page.pm
@@ -40,7 +40,7 @@ sub DetailsTable {
sub {
Dt 'Type';
- Dd $PRODUCER_TYPES{$e->{type}};
+ Dd $PRODUCER_TYPE{$e->{type}};
},
sub {
diff --git a/lib/VN3/Types.pm b/lib/VN3/Types.pm
index 18e481b0..fa53ea73 100644
--- a/lib/VN3/Types.pm
+++ b/lib/VN3/Types.pm
@@ -17,7 +17,6 @@ our @EXPORT = qw/
Lang
Platform
%MEDIA media_display
- %PRODUCER_TYPES
ReleaseDate
@VN_LENGTHS vn_length_time vn_length_display
char_roles char_role_display
@@ -91,13 +90,6 @@ sub media_display {
-our %PRODUCER_TYPES;
-tie %PRODUCER_TYPES, 'Tie::IxHash',
- co => 'Company',
- in => 'Individual',
- ng => 'Amateur group';
-
-
sub ReleaseDate {
my $date = sprintf '%08d', shift||0;
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index 75b2a6cd..72da356f 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -63,7 +63,7 @@ sub page {
if($rev) {
my $prev = $rev && $rev > 1 && $self->dbProducerGetRev(id => $pid, rev => $rev-1, what => 'extended relations')->[0];
$self->htmlRevision('p', $prev, $p,
- [ type => 'Type', serialize => sub { $self->{producer_types}{$_[0]} } ],
+ [ type => 'Type', serialize => sub { $PRODUCER_TYPE{$_[0]} } ],
[ name => 'Name (romaji)', diff => 1 ],
[ original => 'Original name', diff => 1 ],
[ alias => 'Aliases', diff => qr/[ ,\n\.]/ ],
@@ -88,7 +88,7 @@ sub page {
h1 $p->{name};
h2 class => 'alttitle', $p->{original} if $p->{original};
p class => 'center';
- txt "$LANGUAGE{$p->{lang}} $self->{producer_types}{$p->{type}}";
+ txt "$LANGUAGE{$p->{lang}} $PRODUCER_TYPE{$p->{type}}";
if($p->{alias}) {
(my $alias = $p->{alias}) =~ s/\n/, /g;
br;
@@ -281,7 +281,7 @@ sub edit {
if($self->reqMethod eq 'POST') {
return if !$nosubmit && !$self->authCheckCode;
$frm = $self->formValidate(
- { post => 'type', required => !$nosubmit, enum => [ keys %{$self->{producer_types}} ] },
+ { post => 'type', required => !$nosubmit, enum => [ keys %PRODUCER_TYPE ] },
{ post => 'name', maxlength => 200 },
{ post => 'original', required => 0, maxlength => 200, default => '' },
{ post => 'alias', required => 0, maxlength => 500, default => '' },
@@ -334,7 +334,7 @@ sub edit {
$self->htmlForm({ frm => $frm, action => $pid ? "/p$pid/edit" : '/p/new', editsum => 1 },
'pedit_geninfo' => [ 'General info',
[ select => name => 'Type', short => 'type',
- options => [ map [ $_, $self->{producer_types}{$_} ], keys %{$self->{producer_types}} ] ],
+ options => [ map [ $_, $PRODUCER_TYPE{$_} ], keys %PRODUCER_TYPE ] ],
[ input => name => 'Name (romaji)', short => 'name' ],
[ input => name => 'Original name', short => 'original' ],
[ static => content => 'The original name of the producer, leave blank if it is already in the Latin alphabet.' ],
diff --git a/lib/VNDB/Types.pm b/lib/VNDB/Types.pm
index 21ef2425..981991e6 100644
--- a/lib/VNDB/Types.pm
+++ b/lib/VNDB/Types.pm
@@ -138,6 +138,14 @@ hash PRODUCER_RELATION =>
+# SQL: ENUM producer_type
+hash PRODUCER_TYPE =>
+ co => 'Company',
+ in => 'Individual',
+ ng => 'Amateur group';
+
+
+
# SQL: ENUM credit_type
hash CREDIT_TYPE =>
scenario => 'Scenario',