summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorkt <>2015-02-16 17:22:24 +0100
committerYorhel <git@yorhel.nl>2015-02-16 17:22:24 +0100
commit4b1b212bd1f9b01ed101795c93f20a6c6c6eb78b (patch)
treea29c7680146d08315937fb688b5269e618174725
parent430e17b85c65b54d5a24292a7182701b232574bf (diff)
Various staff improvements
(Quoting mail:) - character list is sorted by name in cast edit form (managing of the huge lists like v6458 becomes slightly easier); - display number of characters voiced on seiyuu page; - display a notice in staff edit form when primary name could be changed.
-rw-r--r--data/lang.txt14
-rw-r--r--data/script.js11
-rw-r--r--lib/VNDB/DB/Staff.pm3
-rw-r--r--lib/VNDB/Handler/Staff.pm5
4 files changed, 30 insertions, 3 deletions
diff --git a/data/lang.txt b/data/lang.txt
index 6a808c23..63a22da2 100644
--- a/data/lang.txt
+++ b/data/lang.txt
@@ -5772,7 +5772,7 @@ uk*:
it*:
:_staff_voiced
-en : Voiced characters
+en : Voiced characters ([_1])
ru*:
cs*:
hu*:
@@ -6049,6 +6049,18 @@ tr*:
uk*:
it*:
+:_staffe_form_different
+en : You may choose a different primary name.
+ru*:
+cs*:
+hu*:
+nl*:
+de*:
+es*:
+tr*:
+uk*:
+it*:
+
:_staffe_form_names
en : Names
ru*:
diff --git a/data/script.js b/data/script.js
index 74a1f1e2..396d8ded 100644
--- a/data/script.js
+++ b/data/script.js
@@ -2263,6 +2263,17 @@ var vncImportData = [];
function vncLoad() {
var cast = jsonParse(byId('seiyuu').value) || [];
+ var copt = byId('cast_chars').options;
+ var chars = {};
+ for(var i = 0; i < copt.length; i++) {
+ if(copt[i].value)
+ chars[copt[i].value] = copt[i].text;
+ }
+ cast.sort(function(a, b) {
+ if(chars[a.cid] < chars[b.cid]) return -1;
+ if(chars[a.cid] > chars[b.cid]) return 1;
+ return 0;
+ });
for(var i = 0; i < cast.length; i++) {
var aid = cast[i].aid;
if(vnsStaffData[aid]) // vnsStaffData is filled by vnsLoad()
diff --git a/lib/VNDB/DB/Staff.pm b/lib/VNDB/DB/Staff.pm
index 73be2f41..1b9a10da 100644
--- a/lib/VNDB/DB/Staff.pm
+++ b/lib/VNDB/DB/Staff.pm
@@ -7,7 +7,7 @@ use Exporter 'import';
our @EXPORT = qw|dbStaffGet dbStaffRevisionInsert dbStaffAliasIds|;
-# options: results, page, id, aid, search, rev, truename, role, gender
+# options: results, page, id, aid, search, exact, rev, truename, role, gender
# what: extended changes roles aliases
sub dbStaffGet {
my $self = shift;
@@ -42,6 +42,7 @@ sub dbStaffGet {
$seiyuu ? ( 'EXISTS(SELECT 1 FROM vn_seiyuu vsy JOIN vn v ON v.latest = vsy.vid WHERE vsy.aid = sa.id AND NOT v.hidden)' ) : ()
).')' => ( @roles ? [ \@roles ] : 1 ),
) : (),
+ $o{exact} ? ( '(sa.name = ? OR sa.original = ?)' => [ ($o{exact}) x 2 ] ) : (),
$o{search} ?
$o{search} =~ /[\x{3000}-\x{9fff}\x{ff00}-\x{ff9f}]/ ?
# match against 'original' column only if search string contains any
diff --git a/lib/VNDB/Handler/Staff.pm b/lib/VNDB/Handler/Staff.pm
index b697af53..bab324b6 100644
--- a/lib/VNDB/Handler/Staff.pm
+++ b/lib/VNDB/Handler/Staff.pm
@@ -159,7 +159,7 @@ sub page {
br;
}
if (@{$s->{cast}}) {
- h2 mt '_staff_voiced';
+ h2 mt('_staff_voiced', scalar @{$s->{cast}});
my $has_notes = first { $_->{note} || $_->{name} ne $s->{name} } @{$s->{cast}};
table class => 'stripe staffroles';
thead;
@@ -287,6 +287,8 @@ sub edit {
[ hidden => short => 'original' ],
[ hidden => short => 'primary' ],
[ hidden => short => 'aliases' ],
+ $sid && @{$s->{aliases}} ?
+ [ static => content => mt('_staffe_form_different') ] : (),
[ static => label => mt('_staffe_form_names'), content => sub {
table id => 'names';
thead; Tr;
@@ -401,6 +403,7 @@ sub staffxml {
my($list, $np) = $self->dbStaffGet(
@{$q->{s}} ? (id => $q->{s}) :
@{$q->{a}} ? (aid => $q->{a}) :
+ $q->{q} =~ /^=(.+)/ ? (exact => $1) :
$q->{q} =~ /^s([1-9]\d*)/ ? (id => $1) :
(search => $q->{q}),
results => 10,