summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-09-23 12:41:06 +0200
committerYorhel <git@yorhel.nl>2022-09-28 09:35:55 +0200
commitfc923381de7dfed7de0969c35a5e010bd6055417 (patch)
tree93ddd42ae84a16ad083ca2128a20f5d69496475c /lib
parent2c92964795a54b5e0de0b66b3c1c0bc6a4083555 (diff)
WIP add language-specific titles to releases
Diffstat (limited to 'lib')
-rw-r--r--lib/VNWeb/AdvSearch.pm2
-rw-r--r--lib/VNWeb/Elm.pm2
-rw-r--r--lib/VNWeb/LangPref.pm11
-rw-r--r--lib/VNWeb/Misc/HomePage.pm11
-rw-r--r--lib/VNWeb/Releases/Edit.pm10
-rw-r--r--lib/VNWeb/Releases/Lib.pm24
-rw-r--r--lib/VNWeb/Releases/List.pm4
-rw-r--r--lib/VNWeb/Releases/Page.pm57
-rw-r--r--lib/VNWeb/Releases/VNTab.pm9
-rw-r--r--lib/VNWeb/Reviews/Page.pm8
-rw-r--r--lib/VNWeb/VN/Edit.pm2
-rw-r--r--lib/VNWeb/VN/Length.pm2
-rw-r--r--lib/VNWeb/VN/Page.pm4
13 files changed, 75 insertions, 71 deletions
diff --git a/lib/VNWeb/AdvSearch.pm b/lib/VNWeb/AdvSearch.pm
index 440393fe..4b2dde3f 100644
--- a/lib/VNWeb/AdvSearch.pm
+++ b/lib/VNWeb/AdvSearch.pm
@@ -358,7 +358,7 @@ f v => 6 => 'developer-id', { vndbid => 'p' }, '=' => sub { sql 'v.c_developers
f r => 2 => 'lang', { enum => \%LANGUAGE },
sql_list => sub {
my($neg, $all, $val) = @_;
- sql 'r.id', $neg ? 'NOT' : '', 'IN(SELECT id FROM releases_lang WHERE NOT mtl AND lang IN', $val, $all && @$val > 1 ? ('GROUP BY id HAVING COUNT(lang) =', \scalar @$val) : (), ')';
+ sql 'r.id', $neg ? 'NOT' : '', 'IN(SELECT id FROM releases_titles WHERE NOT mtl AND lang IN', $val, $all && @$val > 1 ? ('GROUP BY id HAVING COUNT(lang) =', \scalar @$val) : (), ')';
};
f r => 4 => 'platform', { required => 0, default => undef, enum => \%PLATFORM },
diff --git a/lib/VNWeb/Elm.pm b/lib/VNWeb/Elm.pm
index 82d2991f..5981138d 100644
--- a/lib/VNWeb/Elm.pm
+++ b/lib/VNWeb/Elm.pm
@@ -62,7 +62,7 @@ our %apis = (
Releases => [ { aoh => { # Response to 'Release'
id => { vndbid => 'r' },
title => {},
- original => { required => 0, default => '' },
+ alttitle => { required => 0, default => '' },
released => { uint => 1 },
rtype => {},
reso_x => { uint => 1 },
diff --git a/lib/VNWeb/LangPref.pm b/lib/VNWeb/LangPref.pm
index a100c268..e5e34256 100644
--- a/lib/VNWeb/LangPref.pm
+++ b/lib/VNWeb/LangPref.pm
@@ -14,6 +14,7 @@ our @EXPORT = qw/
$DEFAULT_TITLE_LANGS
$DEFAULT_ALTTITLE_LANGS
sql_vn_hist
+ sql_releases_hist
/;
TUWF::set('custom_validations')->{langpref} = { type => 'array', maxlength => 5, values => { type => 'hash', keys => {
@@ -59,7 +60,7 @@ sub pref {
sub gen_sql {
- my($tbl_main, $tbl_titles, $join_col) = @_;
+ my($has_official, $tbl_main, $tbl_titles, $join_col) = @_;
my $p = pref;
sub id { ($_[0]{original}?'r':$_[0]{official}?'o':'u').($_[0]{lang}//'') }
@@ -72,7 +73,7 @@ sub gen_sql {
"$joins{$_}.$join_col = x.$join_col",
$_ =~ /^r/ ? "$joins{$_}.lang = x.olang" : (),
length($_) > 1 ? sql("$joins{$_}.lang =", \(''.substr($_,1))) : (),
- $_ =~ /^o./ ? "$joins{$_}.official" : (),
+ $has_official && $_ =~ /^o./ ? "$joins{$_}.official" : (),
), sort keys %joins;
my $title = 'COALESCE('.join(',',
@@ -90,7 +91,8 @@ sub gen_sql {
# Similar to the 'vnt' VIEW, except for vn_hist and it generates a SELECT query for inline use.
-sub sql_vn_hist { gen_sql 'vn_hist', 'vn_titles_hist', 'chid' }
+sub sql_vn_hist { gen_sql 1, 'vn_hist', 'vn_titles_hist', 'chid' }
+sub sql_releases_hist { gen_sql 0, 'releases_hist', 'releases_titles_hist', 'chid' }
# Run the given subroutine with the default language preferences, by
@@ -114,7 +116,8 @@ TUWF::hook before => sub {
my $p = pref;
return if $p->[2] eq $CURRENT_SESSION;
$CURRENT_SESSION = $p->[2];
- tuwf->dbExeci('CREATE OR REPLACE TEMPORARY VIEW vnt AS', gen_sql('vn', 'vn_titles', 'id'));
+ tuwf->dbExeci('CREATE OR REPLACE TEMPORARY VIEW vnt AS', gen_sql(1, 'vn', 'vn_titles', 'id'));
+ tuwf->dbExeci('CREATE OR REPLACE TEMPORARY VIEW releasest AS', gen_sql(0, 'releases', 'releases_titles', 'id'));
};
1;
diff --git a/lib/VNWeb/Misc/HomePage.pm b/lib/VNWeb/Misc/HomePage.pm
index 72645768..81dbaf5a 100644
--- a/lib/VNWeb/Misc/HomePage.pm
+++ b/lib/VNWeb/Misc/HomePage.pm
@@ -173,16 +173,15 @@ sub releases_ {
# Add the release date as filter, we need to construct a filter for the header link anyway
$filt->{query} = [ 'and', [ released => $released ? '<=' : '>', 1 ], $filt->{query} || () ];
- # XXX This query is kinda slow, an index on releases.released would probably help.
my $lst = tuwf->dbAlli('
- SELECT id, title, original, released
- FROM releases r
+ SELECT id, title, alttitle, released
+ FROM releasest r
WHERE NOT hidden AND ', $filt->sql_where(), '
- AND NOT EXISTS(SELECT 1 FROM releases_lang rl WHERE rl.id = r.id AND rl.mtl)
+ AND NOT EXISTS(SELECT 1 FROM releases_titles rt WHERE rt.id = r.id AND rt.mtl)
ORDER BY released', $released ? 'DESC' : '', ', id LIMIT 10'
);
enrich_flatten plat => id => id => 'SELECT id, platform FROM releases_platforms WHERE id IN', $lst;
- enrich_flatten lang => id => id => 'SELECT id, lang FROM releases_lang WHERE id IN', $lst;
+ enrich_flatten lang => id => id => 'SELECT id, lang FROM releases_titles WHERE id IN', $lst;
h1_ sub {
a_ href => '/r?f='.$filt->query_encode().';o=a;s=released', 'Upcoming Releases' if !$released;
@@ -196,7 +195,7 @@ sub releases_ {
platform_ $_ for $_->{plat}->@*;
abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $_->{lang}->@*;
txt_ ' ';
- a_ href => "/$_->{id}", title => $_->{original}||$_->{title}, $_->{title};
+ a_ href => "/$_->{id}", title => $_->{alttitle}||$_->{title}, $_->{title};
}
} for @$lst;
};
diff --git a/lib/VNWeb/Releases/Edit.pm b/lib/VNWeb/Releases/Edit.pm
index 30005150..c2ee566b 100644
--- a/lib/VNWeb/Releases/Edit.pm
+++ b/lib/VNWeb/Releases/Edit.pm
@@ -5,17 +5,18 @@ use VNWeb::Prelude;
my $FORM = {
id => { required => 0, vndbid => 'r' },
- title => { maxlength => 300 },
- original => { required => 0, default => '', maxlength => 250 },
official => { anybool => 1 },
patch => { anybool => 1 },
freeware => { anybool => 1 },
doujin => { anybool => 1 },
has_ero => { anybool => 1 },
- lang => { minlength => 1, sort_keys => 'lang', aoh => {
+ titles => { minlength => 1, sort_keys => 'lang', aoh => {
lang => { enum => \%LANGUAGE },
mtl => { anybool => 1 },
+ title => { maxlength => 300 },
+ latin => { required => 0, default => undef, maxlength => 300 },
} },
+ olang => { enum => \%LANGUAGE, default => 'ja' },
platforms => { aoh => { platform => { enum => \%PLATFORM } } },
media => { aoh => {
medium => { enum => \%MEDIUM },
@@ -75,6 +76,7 @@ TUWF::get qr{/$RE{rrev}/(?<action>edit|copy)} => sub {
$e->{editsum} = $copy ? "Copied from $e->{id}.$e->{chrev}" : $e->{chrev} == $e->{maxrev} ? '' : "Reverted to revision $e->{id}.$e->{chrev}";
$e->{authmod} = auth->permDbmod;
+ $e->{titles} = [ sort { $a->{lang} cmp $b->{lang} } $e->{titles}->@* ];
to_extlinks $e;
enrich_merge vid => 'SELECT id AS vid, title FROM vnt WHERE id IN', $e->{vn};
@@ -162,6 +164,8 @@ elm_api ReleaseEdit => $FORM_OUT, $FORM_IN, sub {
}
ani_compat($data, $e);
+ die "No title in main language" if !grep $_->{lang} eq $data->{olang}, $data->{titles}->@*;
+
$_->{qty} = $MEDIUM{$_->{medium}}{qty} ? $_->{qty}||1 : 0 for $data->{media}->@*;
$data->{notes} = bb_subst_links $data->{notes};
die "No VNs selected" if !$data->{vn}->@*;
diff --git a/lib/VNWeb/Releases/Lib.pm b/lib/VNWeb/Releases/Lib.pm
index 20432c42..ecf643c9 100644
--- a/lib/VNWeb/Releases/Lib.pm
+++ b/lib/VNWeb/Releases/Lib.pm
@@ -9,8 +9,8 @@ our @EXPORT = qw/enrich_release_elm releases_by_vn enrich_release sort_releases
# Enrich a list of releases so that it's suitable as 'Releases' Elm response.
# Given objects must have 'id' and 'rtype' fields (appropriate for the VN in context).
sub enrich_release_elm {
- enrich_merge id => 'SELECT id, title, original, released, reso_x, reso_y FROM releases WHERE id IN', @_;
- enrich_flatten lang => id => id => sub { sql('SELECT id, lang FROM releases_lang WHERE id IN', $_, 'ORDER BY lang') }, @_;
+ enrich_merge id => 'SELECT id, title, alttitle, released, reso_x, reso_y FROM releasest WHERE id IN', @_;
+ enrich_flatten lang => id => id => sub { sql('SELECT id, lang FROM releases_titles WHERE id IN', $_, 'ORDER BY lang') }, @_;
enrich_flatten platforms => id => id => sub { sql('SELECT id, platform FROM releases_platforms WHERE id IN', $_, 'ORDER BY platform') }, @_;
}
@@ -28,13 +28,13 @@ sub releases_by_vn {
sub enrich_release {
my($r) = @_;
enrich_merge id =>
- 'SELECT id, title, original, notes, minage, official, freeware, has_ero, reso_x, reso_y, voiced, uncensored
+ 'SELECT id, title, alttitle, notes, minage, official, freeware, has_ero, reso_x, reso_y, voiced, uncensored
, ani_story, ani_ero, ani_story_sp, ani_story_cg, ani_cutscene, ani_ero_sp, ani_ero_cg, ani_face, ani_bg
- FROM releases WHERE id IN', $r;
+ FROM releasest WHERE id IN', $r;
enrich_merge id => sub { sql 'SELECT id, MAX(rtype) AS rtype FROM releases_vn WHERE id IN', $_, 'GROUP BY id' }, grep !$_->{rtype}, ref $r ? @$r : $r;
enrich_merge id => sql('SELECT rid as id, status as rlist_status FROM rlists WHERE uid =', \auth->uid, 'AND rid IN'), $r if auth;
enrich_flatten platforms => id => id => sub { sql 'SELECT id, platform FROM releases_platforms WHERE id IN', $_, 'ORDER BY id, platform' }, $r;
- enrich lang => id => id => sub { 'SELECT id, lang, mtl FROM releases_lang WHERE id IN', $_, 'ORDER BY id, mtl, lang' }, $r;
+ enrich titles => id => id => sub { 'SELECT id, lang, mtl, title, latin FROM releases_titles WHERE id IN', $_, 'ORDER BY id, mtl, lang' }, $r;
enrich media => id => id => sub { 'SELECT id, medium, qty FROM releases_media WHERE id IN', $_, 'ORDER BY id, medium' }, $r;
}
@@ -90,14 +90,13 @@ sub release_extlinks_ {
# Options
# id: unique identifier if the same release may be listed on a page twice.
-# lang: $lang, whether to display language icons and which language to use for the MTL flag.
+# lang: $lang, whether to display language icons and which language to use for the title and MTL flag.
# prod: 0/1 whether to display Pub/Dev indication
sub release_row_ {
my($r, $opt) = @_;
- my $mtl = $opt->{lang}
- ? [grep $_->{lang} eq $opt->{lang}, $r->{lang}->@*]->[0]{mtl}
- : (grep $_->{mtl}, $r->{lang}->@*) == $r->{lang}->@*;
+ my $lang = $opt->{lang} && (grep $_->{lang} eq $opt->{lang}, $r->{titles}->@*)[0];
+ my $mtl = $lang ? $lang->{mtl} : (grep $_->{mtl}, $r->{titles}->@*) == $r->{titles}->@*;
my $storyani = join "\n", map "$_.",
$r->{ani_story} == 1 ? 'Not animated' :
@@ -141,7 +140,7 @@ sub release_row_ {
}
tr_ $mtl ? (class => 'mtl') : (), sub {
- td_ class => 'tc1', sub { rdate_ [grep $_->{lang} eq $opt->{lang}, $opt->{lang}?$r->{lang}->@*:()]->[0]{released}//$r->{released} };
+ td_ class => 'tc1', sub { rdate_ $r->{released} };
td_ class => 'tc2', sub {
span_ class => 'releaseero releaseero_'.(!$r->{has_ero} ? 'no' : $r->{uncensored} ? 'unc' : defined $r->{uncensored} ? 'cen' : 'yes'),
title => !$r->{has_ero} ? 'No erotic scenes' :
@@ -152,12 +151,13 @@ sub release_row_ {
td_ class => 'tc3', sub {
platform_ $_ for $r->{platforms}->@*;
if(!$opt->{lang}) {
- abbr_ class => "icons lang $_->{lang}".($_->{mtl}?' mtl':''), title => $LANGUAGE{$_->{lang}}, '' for $r->{lang}->@*;
+ abbr_ class => "icons lang $_->{lang}".($_->{mtl}?' mtl':''), title => $LANGUAGE{$_->{lang}}, '' for $r->{titles}->@*;
}
abbr_ class => "icons rt$r->{rtype}", title => $r->{rtype}, '';
};
td_ class => 'tc4', sub {
- a_ href => "/$r->{id}", title => $r->{original}||$r->{title}, $r->{title};
+ # TODO: Read user preferences to see whether to display the 'title' or 'latin' here.
+ a_ href => "/$r->{id}", title => $lang ? $lang->{latin} : $r->{alttitle}||$r->{title}, $lang ? $lang->{title} : $r->{title};
my $note = join ' ', $r->{official} ? () : 'unofficial', $mtl ? 'machine translation' : (), $r->{patch} ? 'patch' : ();
b_ class => 'grayedout', " ($note)" if $note;
};
diff --git a/lib/VNWeb/Releases/List.pm b/lib/VNWeb/Releases/List.pm
index 178fd220..2e25a04d 100644
--- a/lib/VNWeb/Releases/List.pm
+++ b/lib/VNWeb/Releases/List.pm
@@ -62,10 +62,10 @@ TUWF::get qr{/r}, sub {
$count = tuwf->dbVali('SELECT count(*) FROM releases r WHERE', $where);
$list = $count ? tuwf->dbPagei({results => 50, page => $opt->{p}}, '
SELECT r.id, r.patch, r.released, r.gtin, ', sql_extlinks(r => 'r.'), '
- FROM releases r
+ FROM releasest r
WHERE', $where, '
ORDER BY', sprintf {
- title => 'r.title %s, r.released %1$s',
+ title => 'r.sorttitle %s, r.released %1$s',
minage => 'r.minage %s, r.title %1$s, r.released %1$s',
released => 'r.released %s, r.title %1$s, r.id %1$s',
}->{$opt->{s}}, $opt->{o} eq 'a' ? 'ASC' : 'DESC'
diff --git a/lib/VNWeb/Releases/Page.pm b/lib/VNWeb/Releases/Page.pm
index 27b9d4ef..cbbfd4c1 100644
--- a/lib/VNWeb/Releases/Page.pm
+++ b/lib/VNWeb/Releases/Page.pm
@@ -2,6 +2,7 @@ package VNWeb::Releases::Page;
use VNWeb::Prelude;
use VNWeb::Releases::Lib;
+use VNWeb::LangPref 'sql_releases_hist';
sub enrich_item {
@@ -10,7 +11,7 @@ sub enrich_item {
enrich_merge pid => 'SELECT id AS pid, name, original FROM producers WHERE id IN', $r->{producers};
enrich_merge vid => 'SELECT id AS vid, title, alttitle FROM vnt WHERE id IN', $r->{vn};
- $r->{lang} = [ sort { ($a->{mtl}?1:0) <=> ($b->{mtl}?1:0) || $a->{lang} cmp $b->{lang} } $r->{lang}->@* ];
+ $r->{titles} = [ sort { ($a->{mtl}?1:0) <=> ($b->{mtl}?1:0) || $a->{lang} cmp $b->{lang} } $r->{titles}->@* ];
$r->{platforms} = [ sort map $_->{platform}, $r->{platforms}->@* ];
$r->{vn} = [ sort { $a->{title} cmp $b->{title} || idcmp($a->{vid}, $b->{vid}) } $r->{vn}->@* ];
$r->{producers} = [ sort { $a->{name} cmp $b->{name} || idcmp($a->{pid}, $b->{pid}) } $r->{producers}->@* ];
@@ -38,11 +39,12 @@ sub _rev_ {
[ has_ero => 'Has ero', fmt => 'bool' ],
[ doujin => 'Doujin', fmt => 'bool' ],
[ uncensored => 'Uncensored', fmt => 'bool' ],
- [ title => 'Title (Romaji)' ],
- [ original => 'Original title' ],
[ gtin => 'JAN/EAN/UPC', empty => 0 ],
[ catalog => 'Catalog number' ],
- [ lang => 'Languages', fmt => sub { txt_ $LANGUAGE{$_->{lang}}; txt_ ' (machine translation)' if $_->{mtl} } ],
+ [ titles => 'Languages', txt => sub {
+ '['.$_->{lang}.($_->{mtl} ? ' machine translation' : '').'] '.$_->{title}.($_->{latin} ? " / $_->{latin}" : '')
+ }],
+ [ olang => 'Main title', fmt => \%LANGUAGE ],
[ released => 'Release date', fmt => sub { rdate_ $_ } ],
[ minage => 'Age rating', fmt => sub { txt_ minage $_ } ],
[ notes => 'Notes' ],
@@ -137,39 +139,34 @@ sub _infotable_ {
}
};
- tr_ sub {
- td_ 'Title';
- td_ $r->{title};
+ tr_ class => 'titles', sub {
+ td_ $r->{titles}->@* == 1 ? 'Title' : 'Titles';
+ td_ sub {
+ table_ sub {
+ tr_ class => 'nostripe title', sub {
+ td_ sub {
+ abbr_ class => "icons lang $_->{lang}", title => $LANGUAGE{$_->{lang}}, '';
+ };
+ td_ sub {
+ span_ lang_attr($_->{lang}), $_->{title};
+ b_ class => 'grayedout', ' (machine translation)' if $_->{mtl};
+ if($_->{latin}) {
+ br_;
+ txt_ $_->{latin};
+ }
+ }
+ } for $r->{titles}->@*;
+ };
+ };
};
tr_ sub {
- td_ 'Original title';
- td_ lang_attr($r->{lang}), $r->{original};
- } if $r->{original};
-
- tr_ sub {
td_ 'Type';
td_ !$r->{official} && $r->{patch} ? 'Unofficial patch' :
!$r->{official} ? 'Unofficial' : 'Patch';
} if !$r->{official} || $r->{patch};
tr_ sub {
- td_ 'Language';
- td_ sub {
- join_ \&br_, sub {
- abbr_ class => "icons lang $_->{lang}", title => $LANGUAGE{$_->{lang}}, ' ';
- txt_ ' ';
- if($_->{mtl}) {
- b_ class => 'grayedout', $LANGUAGE{$_->{lang}};
- txt_ ' (machine translation)';
- } else {
- txt_ $LANGUAGE{$_->{lang}};
- }
- }, $r->{lang}->@*;
- }
- };
-
- tr_ sub {
td_ 'Publication';
td_ $r->{freeware} ? 'Freeware' : 'Non-free';
};
@@ -271,6 +268,8 @@ TUWF::get qr{/$RE{rrev}} => sub {
my $r = db_entry tuwf->captures('id','rev');
return tuwf->resNotFound if !$r;
+ enrich_merge chid => sql('SELECT chid, x.title, x.alttitle FROM (', sql_releases_hist(), ') x WHERE chid IN'), $r if $r->{chrev} != $r->{maxrev};
+ enrich_merge id => sql('SELECT id, title, alttitle FROM releasest WHERE id IN'), $r if $r->{chrev} == $r->{maxrev};
enrich_item $r;
enrich_extlinks r => $r;
@@ -283,7 +282,7 @@ TUWF::get qr{/$RE{rrev}} => sub {
div_ class => 'mainbox release', sub {
itemmsg_ $r;
h1_ sub { txt_ $r->{title}; debug_ $r };
- h2_ class => 'alttitle', lang_attr($r->{lang}), $r->{original} if length $r->{original};
+ h2_ class => 'alttitle', lang_attr($r->{olang}), $r->{alttitle} if length $r->{alttitle} && $r->{alttitle} ne $r->{title};
_infotable_ $r;
div_ class => 'description', sub { lit_ bb_format $r->{notes} } if $r->{notes};
};
diff --git a/lib/VNWeb/Releases/VNTab.pm b/lib/VNWeb/Releases/VNTab.pm
index dabad6dd..c7408def 100644
--- a/lib/VNWeb/Releases/VNTab.pm
+++ b/lib/VNWeb/Releases/VNTab.pm
@@ -42,8 +42,7 @@ my @rel_cols = (
id => 'lan',
button_string => 'Language',
default => 1,
- has_data => sub { !!@{$_[0]{lang}} },
- draw => sub { join_ \&br_, sub { abbr_ class => "icons lang $_->{lang}", title => $LANGUAGE{$_->{lang}}, ''; }, $_[0]{lang}->@* },
+ draw => sub { join_ \&br_, sub { abbr_ class => "icons lang $_->{lang}", title => $LANGUAGE{$_->{lang}}, ''; }, $_[0]{titles}->@* },
}, { # Publication
id => 'pub',
sort_field => 'publication',
@@ -168,7 +167,7 @@ sub buttons_ {
}
};
pl 'os', \&platform_, map $_->{platforms}->@*, @$r if $opt->{pla};
- pl 'lang', sub { abbr_ class => "icons lang $_[0]", title => $LANGUAGE{$_[0]}, '' }, map $_->{lang}, map $_->{lang}->@*, @$r if $opt->{lan};
+ pl 'lang', sub { abbr_ class => "icons lang $_[0]", title => $LANGUAGE{$_[0]}, '' }, map $_->{lang}, map $_->{titles}->@*, @$r if $opt->{lan};
}
@@ -178,7 +177,7 @@ sub listing_ {
# Apply language and platform filters
my @r = grep +
($opt->{os} eq 'all' || ($_->{platforms} && grep $_ eq $opt->{os}, $_->{platforms}->@*)) &&
- ($opt->{lang} eq 'all' || ($_->{lang} && grep $_ eq $opt->{lang}, map $_->{lang}, $_->{lang}->@*)), @$r;
+ ($opt->{lang} eq 'all' || ($_->{titles} && grep $_ eq $opt->{lang}, map $_->{lang}, $_->{titles}->@*)), @$r;
# Figure out which columns to display
my @col;
@@ -238,7 +237,7 @@ TUWF::get qr{/$RE{vid}/releases} => sub {
my $r = tuwf->dbAlli('
SELECT r.id, rv.rtype, r.patch, r.released, r.gtin
- FROM releases r
+ FROM releasest r
JOIN releases_vn rv ON rv.id = r.id
WHERE NOT hidden AND rv.vid =', \$v->{id}, '
ORDER BY', sprintf(+(grep $opt->{s} eq ($_->{sort_field}//''), @rel_cols)[0]{sort_sql}, $opt->{o} eq 'a' ? 'ASC' : 'DESC')
diff --git a/lib/VNWeb/Reviews/Page.pm b/lib/VNWeb/Reviews/Page.pm
index f5a5f837..769c01d9 100644
--- a/lib/VNWeb/Reviews/Page.pm
+++ b/lib/VNWeb/Reviews/Page.pm
@@ -39,7 +39,7 @@ sub review_ {
platform_ $_ for $w->{platforms}->@*;
abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $w->{lang}->@*;
abbr_ class => "icons rt$w->{rtype}", title => $w->{rtype}, '';
- a_ href => "/$w->{rid}", title => $w->{roriginal}||$w->{rtitle}, $w->{rtitle};
+ a_ href => "/$w->{rid}", title => $w->{ralttitle}||$w->{rtitle}, $w->{rtitle};
}
};
};
@@ -98,11 +98,11 @@ TUWF::get qr{/$RE{wid}(?:(?<sep>[\./])$RE{num})?}, sub {
my($id, $sep, $num) = (tuwf->capture('id'), tuwf->capture('sep')||'', tuwf->capture('num'));
my $w = tuwf->dbRowi(
'SELECT r.id, r.vid, r.rid, r.isfull, r.modnote, r.text, r.spoiler, r.locked, COALESCE(c.count,0) AS count, r.c_flagged, r.c_up, r.c_down, uv.vote, rm.id IS NULL AS can
- , v.title, v.alttitle, rel.title AS rtitle, rel.original AS roriginal, relv.rtype, rv.vote AS my, COALESCE(rv.overrule,false) AS overrule
+ , v.title, v.alttitle, rel.title AS rtitle, rel.alttitle AS ralttitle, relv.rtype, rv.vote AS my, COALESCE(rv.overrule,false) AS overrule
, ', sql_user(), ',', sql_totime('r.date'), 'AS date,', sql_totime('r.lastmod'), 'AS lastmod
FROM reviews r
JOIN vnt v ON v.id = r.vid
- LEFT JOIN releases rel ON rel.id = r.rid
+ LEFT JOIN releasest rel ON rel.id = r.rid
LEFT JOIN releases_vn relv ON relv.id = r.rid AND relv.vid = r.vid
LEFT JOIN users u ON u.id = r.uid
LEFT JOIN ulist_vns uv ON uv.uid = r.uid AND uv.vid = r.vid
@@ -113,7 +113,7 @@ TUWF::get qr{/$RE{wid}(?:(?<sep>[\./])$RE{num})?}, sub {
);
return tuwf->resNotFound if !$w->{id};
- enrich_flatten lang => rid => id => sub { sql 'SELECT id, lang FROM releases_lang WHERE id IN', $_, 'ORDER BY id, lang' }, $w;
+ enrich_flatten lang => rid => id => sub { sql 'SELECT id, lang FROM releases_titles WHERE id IN', $_, 'ORDER BY id, lang' }, $w;
enrich_flatten platforms => rid => id => sub { sql 'SELECT id, platform FROM releases_platforms WHERE id IN', $_, 'ORDER BY id, platform' }, $w;
my $page = $sep eq '/' ? $num||1 : $sep ne '.' ? 1
diff --git a/lib/VNWeb/VN/Edit.pm b/lib/VNWeb/VN/Edit.pm
index 09608ef7..834c8ac8 100644
--- a/lib/VNWeb/VN/Edit.pm
+++ b/lib/VNWeb/VN/Edit.pm
@@ -7,7 +7,7 @@ use VNWeb::Releases::Lib;
my $FORM = {
id => { required => 0, vndbid => 'v' },
- titles => { sort_keys => 'lang', aoh => {
+ titles => { minlength => 1, sort_keys => 'lang', aoh => {
lang => { enum => \%LANGUAGE },
title => { maxlength => 250 },
latin => { required => 0, default => undef, maxlength => 250 },
diff --git a/lib/VNWeb/VN/Length.pm b/lib/VNWeb/VN/Length.pm
index 7f461578..66d76c04 100644
--- a/lib/VNWeb/VN/Length.pm
+++ b/lib/VNWeb/VN/Length.pm
@@ -141,7 +141,7 @@ TUWF::get qr{/(?:(?<thing>$RE{vid}|$RE{uid})/)?lengthvotes}, sub {
'ORDER BY', $opt->{s}->sql_order(),
);
$_->{rel} = [ map +{ id => $_ }, $_->{rel}->@* ] for @$lst;
- enrich_flatten lang => id => id => 'SELECT id, lang FROM releases_lang WHERE id IN', map $_->{rel}, @$lst;
+ enrich_flatten lang => id => id => 'SELECT id, lang FROM releases_titles WHERE id IN', map $_->{rel}, @$lst;
my $title = 'Length votes'.($mode ? ($mode eq 'v' ? ' for ' : ' by ').$o->{title} : '');
framework_ title => $title, dbobj => $o, sub {
diff --git a/lib/VNWeb/VN/Page.pm b/lib/VNWeb/VN/Page.pm
index a58a742c..c08ef170 100644
--- a/lib/VNWeb/VN/Page.pm
+++ b/lib/VNWeb/VN/Page.pm
@@ -249,7 +249,7 @@ sub infobox_producers_ {
SELECT p.id, p.name, p.original, rl.lang, bool_or(rp.developer) as developer, bool_or(rp.publisher) as publisher, min(rv.rtype) as rtype, bool_or(r.official) as official
FROM releases_vn rv
JOIN releases r ON r.id = rv.id
- JOIN releases_lang rl ON rl.id = rv.id
+ JOIN releases_titles rl ON rl.id = rv.id
JOIN releases_producers rp ON rp.id = rv.id
JOIN producers p ON p.id = rp.pid
WHERE NOT r.hidden AND (r.official OR NOT rl.mtl) AND rv.vid =', \$v->{id}, '
@@ -550,7 +550,7 @@ sub releases_ {
my(%lang, %langrel, %langmtl);
for my $r ($v->{releases}->@*) {
- for ($r->{lang}->@*) {
+ for ($r->{titles}->@*) {
push $lang{$_->{lang}}->@*, $r;
$langmtl{$_->{lang}} = ($langmtl{$_->{lang}}//1) && $_->{mtl};
}