summaryrefslogtreecommitdiff
path: root/lib/VN3/Release
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VN3/Release')
-rw-r--r--lib/VN3/Release/Edit.pm130
-rw-r--r--lib/VN3/Release/JS.pm32
-rw-r--r--lib/VN3/Release/Page.pm184
3 files changed, 0 insertions, 346 deletions
diff --git a/lib/VN3/Release/Edit.pm b/lib/VN3/Release/Edit.pm
deleted file mode 100644
index 030c0711..00000000
--- a/lib/VN3/Release/Edit.pm
+++ /dev/null
@@ -1,130 +0,0 @@
-package VN3::Release::Edit;
-
-use VN3::Prelude;
-
-my $FORM = {
- hidden => { anybool => 1 },
- locked => { anybool => 1 },
- title => { maxlength => 250 },
- original => { required => 0, default => '', maxlength => 250 },
- rtype => { enum => [ release_types ] }, # This is 'type' in the database, but renamed for Elm compat
- patch => { anybool => 1 },
- freeware => { anybool => 1 },
- doujin => { anybool => 1 },
- lang => { minlength => 1, sort_keys => 'lang', aoh => { lang => { language => 1 } } },
- gtin => { gtin => 1 },
- catalog => { required => 0, default => '', maxlength => 50 },
- website => { required => 0, default => '', weburl => 1 },
- released => { rdate => 1, min => 1 },
- minage => { required => 0, minage => 1 },
- uncensored => { anybool => 1 },
- notes => { required => 0, default => '', maxlength => 10240 },
- resolution => { resolution => 1 },
- voiced => { voiced => 1 },
- ani_story => { animated => 1 },
- ani_ero => { animated => 1 },
- platforms => { sort_keys => 'platform', aoh => { platform => { platform => 1 } } },
- media => { sort_keys => ['media', 'qty'], aoh => {
- medium => { medium => 1 },
- qty => { uint => 1, range => [0,20] },
- } },
- vn => { length => [1,50], sort_keys => 'vid', aoh => {
- vid => { id => 1 }, # X
- title => { _when => 'out' },
- } },
- producers => { maxlength => 50, sort_keys => 'pid', aoh => {
- pid => { id => 1 }, # X
- developer => { anybool => 1 },
- publisher => { anybool => 1 },
- name => { _when => 'out' },
- } },
-
- id => { _when => 'out', required => 0, id => 1 },
- authmod => { _when => 'out', anybool => 1 },
- editsum => { _when => 'in out', editsum => 1 },
-};
-
-my $FORM_OUT = form_compile out => $FORM;
-my $FORM_IN = form_compile in => $FORM;
-my $FORM_CMP = form_compile cmp => $FORM;
-
-elm_form RelEdit => $FORM_OUT, $FORM_IN;
-
-TUWF::get qr{/$RREV_RE/(?<type>edit|copy)}, sub {
- my $r = entry r => tuwf->capture('id'), tuwf->capture('rev') or return tuwf->resNotFound;
- return tuwf->resDenied if !can_edit r => $r;
- my $copy = tuwf->capture('type') eq 'copy';
-
- enrich vid => q{SELECT id AS vid, title FROM vn WHERE id IN} => $r->{vn};
- enrich pid => q{SELECT id AS pid, name FROM producers WHERE id IN} => $r->{producers};
-
- $r->{rtype} = delete $r->{type};
- $r->{authmod} = auth->permDbmod;
- $r->{editsum} = $copy ? "Copied from r$r->{id}.$r->{chrev}" : $r->{chrev} == $r->{maxrev} ? '' : "Reverted to revision r$r->{id}.$r->{chrev}";
-
- my $title = sprintf '%s %s', $copy ? 'Copy' : 'Edit', $r->{title};
- Framework title => $title,
- top => sub {
- Div class => 'col-md', sub {
- EntryEdit r => $r;
- Div class => 'detail-page-title', sub {
- Txt $title;
- Debug $r;
- };
- };
- }, sub {
- FullPageForm module => 'RelEdit.Main', schema => $FORM_OUT, data => { %$r, $copy ? (id => undef) : () }, sections => [
- general => 'General info',
- format => 'Format',
- relations => 'Relations'
- ];
- };
-};
-
-
-TUWF::get qr{/$VID_RE/add}, sub {
- return tuwf->resDenied if !auth->permEdit;
-
- my $vn = tuwf->dbRowi('SELECT id, title, original FROM vn WHERE NOT hidden AND id =', \tuwf->capture('id'));
- return tuwf->resNotFound if !$vn->{id};
-
- Framework index => 0, title => "Add a new release to $vn->{title}", narrow => 1, sub {
- FullPageForm module => 'RelEdit.New', data => $vn, sections => [
- general => 'General info',
- format => 'Format',
- relations => 'Relations'
- ];
- };
-};
-
-
-json_api qr{/(?:$RID_RE/edit|r/add)}, $FORM_IN, sub {
- my $data = shift;
- my $new = !tuwf->capture('id');
- my $rel = $new ? { id => 0 } : entry r => tuwf->capture('id') or return tuwf->resNotFound;
-
- return $elm_Unauth->() if !can_edit r => $rel;
-
- if(!auth->permDbmod) {
- $data->{hidden} = $rel->{hidden}||0;
- $data->{locked} = $rel->{locked}||0;
- }
- $data->{doujin} = $data->{voiced} = $data->{ani_story} = $data->{ani_ero} = 0 if $data->{patch};
- $data->{resolution} = 'unknown' if $data->{patch};
- $data->{uncensored} = 0 if !$data->{minage} || $data->{minage} != 18;
- $_->{qty} = $MEDIUM{$_->{medium}}{qty} ? $_->{qty}||1 : 0 for @{$data->{media}};
-
- validate_dbid 'SELECT id FROM vn WHERE id IN', map $_->{vid}, @{$data->{vn}};
- validate_dbid 'SELECT id FROM producers WHERE id IN', map $_->{pid}, @{$data->{producers}};
-
- $data->{notes} = bb_subst_links $data->{notes};
-
- $rel->{rtype} = delete $rel->{type};
- return $elm_Unchanged() if !$new && !form_changed $FORM_CMP, $data, $rel;
- $data->{type} = delete $data->{rtype};
-
- my($id,undef,$rev) = update_entry r => $rel->{id}, $data;
- $elm_Changed->($id, $rev);
-};
-
-1;
diff --git a/lib/VN3/Release/JS.pm b/lib/VN3/Release/JS.pm
deleted file mode 100644
index 152fd69a..00000000
--- a/lib/VN3/Release/JS.pm
+++ /dev/null
@@ -1,32 +0,0 @@
-package VN3::Release::JS;
-
-use VN3::Prelude;
-
-
-my $elm_ReleaseResult = elm_api ReleaseResult => { aoh => {
- id => { id => 1 },
- title => {},
- lang => { type => 'array', values => {} },
-}};
-
-
-# Fetch all releases assigned to a VN
-json_api '/js/release.json', {
- vid => { id => 1 },
-}, sub {
- my $vid = shift->{vid};
-
- my $r = tuwf->dbAlli(q{
- SELECT r.id, r.title
- FROM releases r
- JOIN releases_vn rv ON rv.id = r.id
- WHERE NOT r.hidden
- AND rv.vid =}, \$vid, q{
- ORDER BY r.id
- });
- enrich_list1 lang => id => id => sub { sql 'SELECT id, lang FROM releases_lang WHERE id IN', $_[0], 'ORDER BY id, lang' }, $r;
-
- $elm_ReleaseResult->($r);
-};
-
-1;
diff --git a/lib/VN3/Release/Page.pm b/lib/VN3/Release/Page.pm
deleted file mode 100644
index 03d3bd5c..00000000
--- a/lib/VN3/Release/Page.pm
+++ /dev/null
@@ -1,184 +0,0 @@
-package VN3::Release::Page;
-
-use VN3::Prelude;
-
-# TODO: Userlist options
-
-
-sub Notes {
- my $e = shift;
-
- Div class => 'row', sub {
- Div class => 'fixed-size-left-sidebar-md', sub {
- H2 class => 'detail-page-sidebar-section-header', 'Notes';
- };
- Div class => 'col-md', sub {
- Div class => 'description serif mb-5', sub {
- P sub { Lit bb2html $e->{notes} };
- };
- };
- } if $e->{notes};
-}
-
-
-sub DetailsTable {
- my $e = shift;
-
- # TODO: Some of these properties could be moved into the title header thing
- # (type and languages, in particular)
- # (Not even sure this table format makes sense for all properties, there's gotta be a nicer way)
- my @list = (
- @{$e->{vn}} ? sub {
- Dt @{$e->{vn}} == 1 ? 'Visual Novel' : 'Visual Novels';
- Dd sub {
- Join \&Br, sub {
- A href => "/v$_[0]{vid}", title => $_[0]{original}||$_[0]{title}, $_[0]{title};
- }, @{$e->{vn}};
- }
- } : (),
-
- sub {
- Dt 'Type';
- Dd sub {
- Txt ucfirst $e->{type};
- Txt ", patch" if $e->{patch};
- }
- },
-
- sub {
- Dt 'Released';
- Dd sub { ReleaseDate $e->{released} };
- },
-
- sub {
- Dt @{$e->{lang}} > 1 ? 'Languages' : 'Language';
- Dd sub {
- Join \&Br, sub {
- Lang $_[0]{lang};
- Txt " $LANGUAGE{$_[0]{lang}}";
- }, @{$e->{lang}};
- }
- },
-
- sub {
- Dt 'Publication';
- Dd join ', ',
- $e->{freeware} ? 'Freeware' : 'Non-free',
- $e->{patch} ? () : ($e->{doujin} ? 'doujin' : 'commercial')
- },
-
- $e->{minage} && $e->{minage} >= 0 ? sub {
- Dt 'Age rating';
- Dd minage_display $e->{minage};
- } : (),
-
- @{$e->{platforms}} ? sub {
- Dt @{$e->{platforms}} == 1 ? 'Platform' : 'Platforms';
- Dd sub {
- Join \&Br, sub {
- Platform $_[0]{platform};
- Txt " $PLATFORM{$_[0]{platform}}";
- }, @{$e->{platforms}};
- }
- } : (),
-
- @{$e->{media}} ? sub {
- Dt @{$e->{media}} == 1 ? 'Medium' : 'Media';
- Dd join ', ', map media_display($_->{medium}, $_->{qty}), @{$e->{media}};
- } : (),
-
- $e->{voiced} ? sub {
- Dt 'Voiced';
- Dd $VOICED{$e->{voiced}}{txt};
- } : (),
-
- $e->{ani_story} ? sub {
- Dt 'Story animation';
- Dd $ANIMATED{$e->{ani_story}}{txt};
- } : (),
-
- $e->{ani_ero} ? sub {
- Dt 'Ero animation';
- Dd $ANIMATED{$e->{ani_ero}}{txt};
- } : (),
-
- $e->{minage} && $e->{minage} == 18 ? sub {
- Dt 'Censoring';
- Dd $e->{uncensored} ? 'No optical censoring (e.g. mosaics)' : 'May include optical censoring (e.g. mosaics)';
- } : (),
-
- $e->{gtin} ? sub {
- Dt gtintype($e->{gtin}) || 'GTIN';
- Dd $e->{gtin};
- } : (),
-
- $e->{catalog} ? sub {
- Dt 'Catalog no.';
- Dd $e->{catalog};
- } : (),
-
- (map {
- my $type = $_;
- my @prod = grep $_->{$type}, @{$e->{producers}};
- @prod ? sub {
- Dt ucfirst($type) . (@prod == 1 ? '' : 's');
- Dd sub {
- Join \&Br, sub {
- A href => "/p$_[0]{pid}", title => $_[0]{original}||$_[0]{name}, $_[0]{name};
- }, @prod;
- }
- } : ()
- } 'developer', 'publisher'),
-
- $e->{website} ? sub {
- Dt 'Links';
- Dd sub {
- A href => $e->{website}, rel => 'nofollow', 'Official website';
- };
- } : (),
- );
-
- Div class => 'row', sub {
- Div class => 'fixed-size-left-sidebar-md', sub {
- H2 class => 'detail-page-sidebar-section-header', 'Details';
- };
- Div class => 'col-md', sub {
- Div class => 'card card--white mb-5', sub {
- Div class => 'card__section fs-medium', sub {
- Div class => 'row', sub {
- Dl class => 'col-md dl--horizontal', sub { $_->() for @list[0..$#list/2] };
- Dl class => 'col-md dl--horizontal', sub { $_->() for @list[$#list/2+1..$#list] };
- }
- }
- }
- }
- } if @list;
-}
-
-
-TUWF::get qr{/$RREV_RE}, sub {
- my $e = entry r => tuwf->capture('id'), tuwf->capture('rev') or return tuwf->resNotFound;
- return tuwf->resNotFound if !$e->{id} || $e->{hidden};
-
- enrich vid => q{SELECT id AS vid, title, original FROM vn WHERE id IN}, $e->{vn};
- enrich pid => q{SELECT id AS pid, name, original FROM producers WHERE id IN}, $e->{producers};
-
- Framework
- title => $e->{title},
- top => sub {
- Div class => 'col-md', sub {
- EntryEdit r => $e;
- Div class => 'detail-page-title', sub {
- Txt $e->{title};
- Debug $e;
- };
- Div class => 'detail-page-subtitle', $e->{original} if $e->{original};
- }
- },
- sub {
- DetailsTable $e;
- Notes $e;
- };
-};
-
-1;