From fbd24e0c11ccd0fae499a38b4c1ab7b971a42094 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 23 May 2009 11:03:02 +0200 Subject: Added freeware and doujin information to releases TODO: - update d3 - filters on /r --- lib/VNDB/DB/Releases.pm | 8 +++++--- lib/VNDB/Handler/Releases.pm | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm index 89b3d671..63c99019 100644 --- a/lib/VNDB/DB/Releases.pm +++ b/lib/VNDB/DB/Releases.pm @@ -72,7 +72,7 @@ sub dbReleaseGet { my @select = ( qw|r.id rr.title rr.original rr.language rr.website rr.released rr.minage rr.type rr.patch|, 'rr.id AS cid', - $o{what} =~ /extended/ ? qw|rr.notes rr.catalog rr.gtin rr.resolution rr.voiced r.hidden r.locked| : (), + $o{what} =~ /extended/ ? qw|rr.notes rr.catalog rr.gtin rr.resolution rr.voiced rr.freeware rr.doujin r.hidden r.locked| : (), $o{what} =~ /changes/ ? qw|c.added c.requester c.comments r.latest u.username c.rev| : (), ); @@ -167,9 +167,11 @@ sub insert_rev { my($self, $cid, $rid, $o) = @_; $self->dbExec(q| - INSERT INTO releases_rev (id, rid, title, original, gtin, catalog, language, website, released, notes, minage, type, patch, resolution, voiced) + INSERT INTO releases_rev (id, rid, title, original, gtin, catalog, language, website, released, + notes, minage, type, patch, resolution, voiced, freeware, doujin) VALUES (!l)|, - [ $cid, $rid, @$o{qw| title original gtin catalog language website released notes minage type patch resolution voiced|} ]); + [ $cid, $rid, @$o{qw| title original gtin catalog language website released + notes minage type patch resolution voiced freeware doujin|} ]); $self->dbExec(q| INSERT INTO releases_producers (rid, pid) diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm index 501c90e9..05c8b161 100644 --- a/lib/VNDB/Handler/Releases.pm +++ b/lib/VNDB/Handler/Releases.pm @@ -41,6 +41,8 @@ sub page { } ], [ type => 'Type', serialize => sub { $self->{release_types}[$_[0]] } ], [ patch => 'Patch', serialize => sub { $_[0] ? 'Patch' : 'Not a patch' } ], + [ freeware => 'Freeware', serialize => sub { $_[0] ? 'yes' : 'nope' } ], + [ doujin => 'Non-commercial', serialize => sub { $_[0] ? 'yups' : 'nope' } ], [ title => 'Title (romaji)', diff => 1 ], [ original => 'Original title', diff => 1 ], [ gtin => 'JAN/UPC/EAN', serialize => sub { $_[0]||'[none]' } ], @@ -128,6 +130,11 @@ sub _infotable { end; end; + Tr ++$i % 2 ? (class => 'odd') : (); + td 'Publication'; + td ''.($r->{freeware} ? 'Freeware' : 'Non-free').', '.($r->{doujin} ? 'non-commercial' : 'commercial'); + end; + if(@{$r->{platforms}}) { Tr ++$i % 2 ? (class => 'odd') : (); td 'Platform'.($#{$r->{platforms}} ? 's' : ''); @@ -263,7 +270,8 @@ sub edit { my $vn = $rid ? $r->{vn} : [{ vid => $vid, title => $v->{title} }]; my %b4 = !$rid ? () : ( - (map { $_ => $r->{$_} } qw|type title original gtin catalog language website released notes minage platforms patch resolution voiced|), + (map { $_ => $r->{$_} } qw|type title original gtin catalog language website released + notes minage platforms patch resolution voiced freeware doujin|), media => join(',', sort map "$_->{medium} $_->{qty}", @{$r->{media}}), producers => join('|||', map "$_->{id},$_->{name}", sort { $a->{id} <=> $b->{id} } @{$r->{producers}}), ); @@ -274,6 +282,8 @@ sub edit { $frm = $self->formValidate( { name => 'type', enum => [ 0..$#{$self->{release_types}} ] }, { name => 'patch', required => 0, default => 0 }, + { name => 'freeware', required => 0, default => 0 }, + { name => 'doujin', required => 0, default => 0 }, { name => 'title', maxlength => 250 }, { name => 'original', required => 0, default => '', maxlength => 250 }, { name => 'gtin', required => 0, default => '0', @@ -298,7 +308,7 @@ sub edit { my $producers = [ map { /^([0-9]+)/ ? $1 : () } split /\|\|\|/, $frm->{producers} ]; my $new_vn = [ map { /^([0-9]+)/ ? $1 : () } split /\|\|\|/, $frm->{vn} ]; $frm->{platforms} = [ grep $_, @{$frm->{platforms}} ]; - $frm->{patch} = $frm->{patch} ? 1 : 0; + $frm->{$_} = $frm->{$_} ? 1 : 0 for (qw|patch freeware doujin|); return $self->resRedirect("/r$rid", 'post') if $rid && @@ -308,7 +318,8 @@ sub edit { !grep !/^(platforms|producers|vn)$/ && $frm->{$_} ne $b4{$_}, keys %b4; my %opts = ( - (map { $_ => $frm->{$_} } qw| type title original gtin catalog language website released notes minage platforms resolution editsum patch voiced |), + (map { $_ => $frm->{$_} } qw| type title original gtin catalog language website released + notes minage platforms resolution editsum patch voiced freeware doujin|), vn => $new_vn, producers => $producers, media => $media, @@ -346,6 +357,8 @@ sub _form { [ select => short => 'type', name => 'Type', options => [ map [ $_, $self->{release_types}[$_] ], 0..$#{$self->{release_types}} ] ], [ check => short => 'patch', name => 'This release is a patch to another release.' ], + [ check => short => 'freeware', name => 'Freeware (i.e. available at no cost)' ], + [ check => short => 'doujin', name => 'Non-commercial (released without the intent of making money. e.g. as a doujin group)' ], [ input => short => 'title', name => 'Title (romaji)', width => 300 ], [ input => short => 'original', name => 'Original title', width => 300 ], [ static => content => 'The original title of this release, leave blank if it already is in the Latin alphabet.' ], -- cgit v1.2.3