diff options
author | Yorhel <git@yorhel.nl> | 2009-01-04 10:09:01 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-01-04 10:09:01 +0100 |
commit | e954078d3e8d26724e07d3275dc789083421bd86 (patch) | |
tree | 7bd156d469f4d01c6f93fc7b6e13fba6ce38a90f /lib | |
parent | 0980838bd848cf5facfed799d7bc86989012a251 (diff) |
Added patch flag to releases
TODO: update d3 and automatically convert all 'patch' media releases
in the DB to use this flag.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 2 | ||||
-rw-r--r-- | lib/VNDB/DB/Releases.pm | 6 | ||||
-rw-r--r-- | lib/VNDB/Handler/Releases.pm | 9 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNPage.pm | 1 |
4 files changed, 13 insertions, 5 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 95131d36..cc00aa08 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,6 +1,8 @@ 2.2 - ? - Additional custom CSS field to user profile - Search dropdown calls the return function automatically on select + - Revised the media list + - Added a checkbox to releases to indicate a patch 2.1 - 2008-12-29 - Skin support diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm index 6af2f736..cf077d0e 100644 --- a/lib/VNDB/DB/Releases.pm +++ b/lib/VNDB/DB/Releases.pm @@ -41,7 +41,7 @@ sub dbReleaseGet { ); my @select = ( - qw|r.id r.locked r.hidden rr.title rr.original rr.gtin rr.language rr.website rr.released rr.notes rr.minage rr.type|, 'rr.id AS cid', + qw|r.id r.locked r.hidden rr.title rr.original rr.gtin rr.language rr.website rr.released rr.notes rr.minage rr.type rr.patch|, 'rr.id AS cid', $o{what} =~ /changes/ ? qw|c.added c.requester c.comments r.latest u.username c.rev| : (), ); @@ -135,9 +135,9 @@ sub insert_rev { my($self, $cid, $rid, $o) = @_; $self->dbExec(q| - INSERT INTO releases_rev (id, rid, title, original, gtin, language, website, released, notes, minage, type) + INSERT INTO releases_rev (id, rid, title, original, gtin, language, website, released, notes, minage, type, patch) VALUES (!l)|, - [ $cid, $rid, @$o{qw| title original gtin language website released notes minage type|} ]); + [ $cid, $rid, @$o{qw| title original gtin language website released notes minage type patch|} ]); $self->dbExec(q| INSERT INTO releases_producers (rid, pid) diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm index ff28c64b..93fae18f 100644 --- a/lib/VNDB/Handler/Releases.pm +++ b/lib/VNDB/Handler/Releases.pm @@ -40,6 +40,7 @@ sub page { map sprintf('<a href="/v%d" title="%s">%s</a>', $_->{vid}, $_->{original}||$_->{title}, shorten $_->{title}, 50), @{$_[0]}; } ], [ type => 'Type', serialize => sub { $self->{release_types}[$_[0]] } ], + [ patch => 'Patch', serialize => sub { $_[0] ? 'Patch' : 'Not a patch' } ], [ title => 'Title (romaji)', diff => 1 ], [ original => 'Original title', diff => 1 ], [ gtin => 'JAN/UPC/EAN', serialize => sub { $_[0]||'[none]' } ], @@ -104,6 +105,7 @@ sub _infotable { my $type = $self->{release_types}[$r->{type}]; cssicon lc(substr $type, 0, 3), $type; txt ' '.$type; + txt ' patch' if $r->{patch}; end; end; @@ -229,7 +231,7 @@ sub edit { my $vn = $rid ? $r->{vn} : [{ vid => $vid, title => $v->{title} }]; my %b4 = !$rid ? () : ( - (map { $_ => $r->{$_} } qw|type title original gtin language website notes minage platforms|), + (map { $_ => $r->{$_} } qw|type title original gtin language website notes minage platforms patch|), released => $r->{released} =~ /^([0-9]{4})([0-9]{2})([0-9]{2})$/ ? [ $1, $2, $3 ] : [ 0, 0, 0 ], media => join(',', sort map "$_->{medium} $_->{qty}", @{$r->{media}}), producers => join('|||', map "$_->{id},$_->{name}", sort { $a->{id} <=> $b->{id} } @{$r->{producers}}), @@ -240,6 +242,7 @@ sub edit { if($self->reqMethod eq 'POST') { $frm = $self->formValidate( { name => 'type', enum => [ 0..$#{$self->{release_types}} ] }, + { name => 'patch', required => 0, default => 0 }, { name => 'title', maxlength => 250 }, { name => 'original', required => 0, default => '', maxlength => 250 }, { name => 'gtin', required => 0, default => '0', @@ -263,6 +266,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; return $self->resRedirect("/r$rid", 'post') if $rid && $released == $r->{released} && @@ -272,7 +276,7 @@ sub edit { !grep !/^(released|platforms|producers|vn)$/ && $frm->{$_} ne $b4{$_}, keys %b4; my %opts = ( - (map { $_ => $frm->{$_} } qw| type title original gtin language website notes minage platforms editsum|), + (map { $_ => $frm->{$_} } qw| type title original gtin language website notes minage platforms editsum patch|), vn => $new_vn, producers => $producers, media => $media, @@ -310,6 +314,7 @@ sub _form { "General info" => [ [ select => short => 'type', name => 'Type', options => [ map [ $_, $self->{release_types}[$_] ], 0..$#{$self->{release_types}} ] ], + [ check => short => 'patch', name => 'This release is a patch to an other release.' ], [ 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.' ], diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index b53b60ee..516979df 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -395,6 +395,7 @@ sub _releases { end; td class => 'tc4'; a href => "/r$rel->{id}", title => $rel->{original}||$rel->{title}, $rel->{title}; + b class => 'patch', ' (patch)' if $rel->{patch}; end; td class => 'tc5'; if($self->authInfo->{id}) { |