summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB/Handler')
-rw-r--r--lib/VNDB/Handler/Discussions.pm7
-rw-r--r--lib/VNDB/Handler/Misc.pm13
-rw-r--r--lib/VNDB/Handler/Producers.pm160
-rw-r--r--lib/VNDB/Handler/Releases.pm96
-rw-r--r--lib/VNDB/Handler/Tags.pm45
-rw-r--r--lib/VNDB/Handler/ULists.pm20
-rw-r--r--lib/VNDB/Handler/Users.pm6
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm6
-rw-r--r--lib/VNDB/Handler/VNEdit.pm45
-rw-r--r--lib/VNDB/Handler/VNPage.pm71
10 files changed, 314 insertions, 155 deletions
diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm
index 1d74ac6a..12b55029 100644
--- a/lib/VNDB/Handler/Discussions.pm
+++ b/lib/VNDB/Handler/Discussions.pm
@@ -29,6 +29,11 @@ sub thread {
my $p = $self->dbPostGet(tid => $tid, results => 25, page => $page, what => 'user');
return 404 if !$p->[0];
+ # mark as read when this thread is posted in the board of the currently logged in user
+ my $uid = $self->authInfo->{id};
+ $self->dbPostRead($t->{id}, $uid, $p->[$#$p]{num})
+ if $uid && grep $_->{type} eq 'u' && $_->{iid} == $uid, @{$t->{boards}};
+
$self->htmlHeader(title => $t->{title});
div class => 'mainbox';
@@ -293,7 +298,7 @@ sub board {
order => $type eq 'an' ? 't.id DESC' : 'tpl.date DESC',
);
- $self->htmlHeader(title => $title, noindex => !@$list);
+ $self->htmlHeader(title => $title, noindex => !@$list || $type eq 'u');
$self->htmlMainTabs($type, $obj, 'disc') if $iid;
div class => 'mainbox';
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index 80a9e9ea..9625372b 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -66,10 +66,9 @@ sub homepage {
my $changes = $self->dbRevisionGet(what => 'item user', results => 10, auto => 1, hidden => 1);
ul;
for (@$changes) {
- my $t = (qw|v r p|)[$_->{type}];
li;
- lit mt '_home_recentchanges_item', $t,
- sprintf('<a href="%s" title="%s">%s</a>', "/$t$_->{iid}.$_->{rev}",
+ lit mt '_home_recentchanges_item', $_->{type},
+ sprintf('<a href="%s" title="%s">%s</a>', "/$_->{type}$_->{iid}.$_->{rev}",
xml_escape($_->{ioriginal}||$_->{ititle}), xml_escape shorten $_->{ititle}, 33),
$_;
end;
@@ -295,6 +294,12 @@ sub docpage {
close $F;
$ii;
}eg;
+ s{^:TOP5CONTRIB:$}{
+ my $l = $self->dbUserGet(results => 6, order => 'c_changes DESC');
+ '<dl>'.join('', map $_->{id} == 1 ? () :
+ sprintf('<dt><a href="/u%d">%s</a></dt><dd>%d</dd>', $_->{id}, $_->{username}, $_->{c_changes}),
+ @$l).'</dl>';
+ }eg;
}
$self->htmlHeader(title => $title);
@@ -331,7 +336,7 @@ sub itemmod {
my $obj = $type eq 'v' ? $self->dbVNGet(id => $iid)->[0] :
$type eq 'r' ? $self->dbReleaseGet(id => $iid, what => 'vn extended')->[0] :
- $self->dbProducerGet(id => $iid)->[0];
+ $self->dbProducerGet(id => $iid, what => 'extended')->[0];
return 404 if !$obj->{id};
$self->dbItemMod($type, $iid, $act eq 'hide' ? (hidden => !$obj->{hidden}) : (locked => !$obj->{locked}));
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index e6477567..4e75962b 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -3,11 +3,12 @@ package VNDB::Handler::Producers;
use strict;
use warnings;
-use YAWF ':html', ':xml';
+use YAWF ':html', ':xml', 'xml_escape';
use VNDB::Func;
YAWF::register(
+ qr{p([1-9]\d*)/rg} => \&rg,
qr{p([1-9]\d*)(?:\.([1-9]\d*))?} => \&page,
qr{p(?:([1-9]\d*)(?:\.([1-9]\d*))?/edit|/new)}
=> \&edit,
@@ -16,12 +17,34 @@ YAWF::register(
);
+sub rg {
+ my($self, $pid) = @_;
+
+ my $p = $self->dbProducerGet(id => $pid, what => 'relgraph')->[0];
+ return 404 if !$p->{id} || !$p->{rgraph};
+
+ my $title = mt '_prodrg_title', $p->{name};
+ return if $self->htmlRGHeader($title, 'p', $p);
+
+ $p->{svg} =~ s/\$___(_prodrel_[a-z]+)____\$/mt $1/eg;
+ $p->{svg} =~ s/\$(_lang_[a-z]+)_\$/mt $1/eg;
+ $p->{svg} =~ s/\$(_ptype_[a-z]+)_\$/mt $1/eg;
+
+ div class => 'mainbox';
+ h1 $title;
+ p class => 'center';
+ lit $p->{svg};
+ end;
+ end;
+ $self->htmlFooter;
+}
+
sub page {
my($self, $pid, $rev) = @_;
my $p = $self->dbProducerGet(
id => $pid,
- what => 'vn extended'.($rev ? ' changes' : ''),
+ what => 'vn extended relations'.($rev ? ' changes' : ''),
$rev ? ( rev => $rev ) : ()
)->[0];
return 404 if !$p->{id};
@@ -31,7 +54,7 @@ sub page {
return if $self->htmlHiddenMessage('p', $p);
if($rev) {
- my $prev = $rev && $rev > 1 && $self->dbProducerGet(id => $pid, rev => $rev-1, what => 'changes extended')->[0];
+ my $prev = $rev && $rev > 1 && $self->dbProducerGet(id => $pid, rev => $rev-1, what => 'changes extended relations')->[0];
$self->htmlRevision('p', $prev, $p,
[ type => serialize => sub { mt "_ptype_$_[0]" } ],
[ name => diff => 1 ],
@@ -40,6 +63,12 @@ sub page {
[ lang => serialize => sub { "$_[0] (".mt("_lang_$_[0]").')' } ],
[ website => diff => 1 ],
[ desc => diff => 1 ],
+ [ relations => join => '<br />', split => sub {
+ my @r = map sprintf('%s: <a href="/p%d" title="%s">%s</a>',
+ mt("_prodrel_$_->{relation}"), $_->{id}, xml_escape($_->{original}||$_->{name}), xml_escape shorten $_->{name}, 40
+ ), sort { $a->{id} <=> $b->{id} } @{$_[0]};
+ return @r ? @r : (mt '_proddiff_none');
+ }],
);
}
@@ -56,6 +85,23 @@ sub page {
}
end;
+ if(@{$p->{relations}}) {
+ my %rel;
+ push @{$rel{$_->{relation}}}, $_
+ for (sort { $a->{name} cmp $b->{name} } @{$p->{relations}});
+ p class => 'center';
+ txt "\n";
+ for my $r (sort keys %rel) {
+ txt mt("_prodrel_$r").': ';
+ for (@{$rel{$r}}) {
+ a href => "/p$_->{id}", title => $_->{original}||$_->{name}, shorten $_->{name}, 40;
+ txt ', ' if $_ ne $rel{$r}[$#{$rel{$r}}];
+ }
+ txt "\n";
+ }
+ end;
+ }
+
if($p->{desc}) {
p class => 'description';
lit bb2html $p->{desc};
@@ -75,6 +121,8 @@ sub page {
lit $self->{l10n}->datestr($_->{date});
end;
a href => "/v$_->{id}", title => $_->{original}, $_->{title};
+ b class => 'grayedout', ' ('.join(', ',
+ $_->{developer} ? mt '_prodpage_dev' : (), $_->{publisher} ? mt '_prodpage_pub' : ()).')';
end;
}
end;
@@ -89,36 +137,55 @@ sub page {
sub edit {
my($self, $pid, $rev) = @_;
- my $p = $pid && $self->dbProducerGet(id => $pid, what => 'changes extended', $rev ? (rev => $rev) : ())->[0];
+ my $p = $pid && $self->dbProducerGet(id => $pid, what => 'changes extended relations', $rev ? (rev => $rev) : ())->[0];
return 404 if $pid && !$p->{id};
$rev = undef if !$p || $p->{cid} == $p->{latest};
return $self->htmlDenied if !$self->authCan('edit')
|| $pid && ($p->{locked} && !$self->authCan('lock') || $p->{hidden} && !$self->authCan('del'));
- my %b4 = !$pid ? () : map { $_ => $p->{$_} } qw|type name original lang website desc alias|;
+ my %b4 = !$pid ? () : (
+ (map { $_ => $p->{$_} } qw|type name original lang website desc alias|),
+ prodrelations => join('|||', map $_->{relation}.','.$_->{id}.','.$_->{name}, sort { $a->{id} <=> $b->{id} } @{$p->{relations}}),
+ );
my $frm;
if($self->reqMethod eq 'POST') {
$frm = $self->formValidate(
- { name => 'type', enum => $self->{producer_types} },
- { name => 'name', maxlength => 200 },
- { name => 'original', required => 0, maxlength => 200, default => '' },
- { name => 'alias', required => 0, maxlength => 500, default => '' },
- { name => 'lang', enum => $self->{languages} },
- { name => 'website', required => 0, template => 'url', default => '' },
- { name => 'desc', required => 0, maxlength => 5000, default => '' },
- { name => 'editsum', maxlength => 5000 },
+ { name => 'type', enum => $self->{producer_types} },
+ { name => 'name', maxlength => 200 },
+ { name => 'original', required => 0, maxlength => 200, default => '' },
+ { name => 'alias', required => 0, maxlength => 500, default => '' },
+ { name => 'lang', enum => $self->{languages} },
+ { name => 'website', required => 0, template => 'url', default => '' },
+ { name => 'desc', required => 0, maxlength => 5000, default => '' },
+ { name => 'prodrelations', required => 0, maxlength => 5000, default => '' },
+ { name => 'editsum', maxlength => 5000 },
);
if(!$frm->{_err}) {
+ # parse
+ my $relations = [ map { /^([a-z]+),([0-9]+),(.+)$/ && (!$pid || $2 != $pid) ? [ $1, $2, $3 ] : () } split /\|\|\|/, $frm->{prodrelations} ];
+
+ # normalize
+ $frm->{prodrelations} = join '|||', map $_->[0].','.$_->[1].','.$_->[2], sort { $a->[1] <=> $b->[1]} @{$relations};
+
return $self->resRedirect("/p$pid", 'post')
if $pid && !grep $frm->{$_} ne $b4{$_}, keys %b4;
+ $frm->{relations} = $relations;
$rev = 1;
+ my $cid;
if($pid) {
- ($rev) = $self->dbProducerEdit($pid, %$frm);
+ ($rev, $cid) = $self->dbProducerEdit($pid, %$frm);
} else {
- ($pid) = $self->dbProducerAdd(%$frm);
+ ($pid, $cid) = $self->dbProducerAdd(%$frm);
+ }
+
+ # update reverse relations
+ if(!$pid && $#$relations >= 0 || $pid && $frm->{prodrelations} ne $b4{prodrelations}) {
+ my %old = $pid ? (map { $_->{id} => $_->{relation} } @{$p->{relations}}) : ();
+ my %new = map { $_->[1] => $_->[0] } @$relations;
+ _updreverse($self, \%old, \%new, $pid, $cid, $rev);
}
return $self->resRedirect("/p$pid.$rev", 'post');
@@ -133,7 +200,8 @@ sub edit {
$self->htmlHeader(title => $title, noindex => 1);
$self->htmlMainTabs('p', $p, 'edit') if $pid;
$self->htmlEditMessage('p', $p, $title);
- $self->htmlForm({ frm => $frm, action => $pid ? "/p$pid/edit" : '/p/new', editsum => 1 }, 'pedit_geninfo' => [mt('_pedit_form_generalinfo'),
+ $self->htmlForm({ frm => $frm, action => $pid ? "/p$pid/edit" : '/p/new', editsum => 1 },
+ 'pedit_geninfo' => [ mt('_pedit_form_generalinfo'),
[ select => name => mt('_pedit_form_type'), short => 'type',
options => [ map [ $_, mt "_ptype_$_" ], sort @{$self->{producer_types}} ] ],
[ input => name => mt('_pedit_form_name'), short => 'name' ],
@@ -145,10 +213,70 @@ sub edit {
options => [ map [ $_, "$_ (".mt("_lang_$_").')' ], sort @{$self->{languages}} ] ],
[ input => name => mt('_pedit_form_website'), short => 'website' ],
[ text => name => mt('_pedit_form_desc').'<br /><b class="standout">'.mt('_inenglish').'</b>', short => 'desc', rows => 6 ],
+ ], 'pedit_rel' => [ mt('_pedit_form_rel'),
+ [ hidden => short => 'prodrelations' ],
+ [ static => nolabel => 1, content => sub {
+ h2 mt '_pedit_rel_sel';
+ table;
+ tbody id => 'relation_tbl';
+ # to be filled using javascript
+ end;
+ end;
+
+ h2 mt '_pedit_rel_add';
+ table;
+ Tr id => 'relation_new';
+ td class => 'tc_prod';
+ input type => 'text', class => 'text';
+ end;
+ td class => 'tc_rel';
+ Select;
+ option value => $_, mt "_prodrel_$_"
+ for (sort { $self->{prod_relations}{$a}[0] <=> $self->{prod_relations}{$b}[0] } keys %{$self->{prod_relations}});
+ end;
+ end;
+ td class => 'tc_add';
+ a href => '#', mt '_pedit_rel_addbut';
+ end;
+ end;
+ end;
+ }],
]);
$self->htmlFooter;
}
+# !IMPORTANT!: Don't forget to update this function when
+# adding/removing fields to/from producer entries!
+sub _updreverse {
+ my($self, $old, $new, $pid, $cid, $rev) = @_;
+ my %upd;
+
+ # compare %old and %new
+ for (keys %$old, keys %$new) {
+ if(exists $$old{$_} and !exists $$new{$_}) {
+ $upd{$_} = undef;
+ } elsif((!exists $$old{$_} and exists $$new{$_}) || ($$old{$_} ne $$new{$_})) {
+ $upd{$_} = $self->{prod_relations}{$$new{$_}}[1];
+ }
+ }
+
+ return if !keys %upd;
+
+ # edit all related producers
+ for my $i (keys %upd) {
+ my $r = $self->dbProducerGet(id => $i, what => 'extended relations')->[0];
+ my @newrel = map $_->{id} != $pid ? [ $_->{relation}, $_->{id} ] : (), @{$r->{relations}};
+ push @newrel, [ $upd{$i}, $pid ] if $upd{$i};
+ $self->dbProducerEdit($i,
+ relations => \@newrel,
+ editsum => "Reverse relation update caused by revision p$pid.$rev",
+ causedby => $cid,
+ uid => 1, # Multi - hardcoded
+ ( map { $_ => $r->{$_} } qw|type name original lang website desc alias| )
+ );
+ }
+}
+
sub list {
my($self, $char) = @_;
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index d916e056..7365f235 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -54,17 +54,16 @@ sub page {
[ notes => diff => 1 ],
[ platforms => join => ', ', split => sub { map mt("_plat_$_"), @{$_[0]} } ],
[ media => join => ', ', split => sub {
- map {
- my $med = $self->{media}{$_->{medium}};
- $med->[1] ? sprintf('%d %s%s', $_->{qty}, $med->[0], $_->{qty}>1?'s':'') : $med->[0]
- } @{$_[0]};
+ map $self->{media}{$_->{medium}} ? $_->{qty}.' '.mt("_med_$_->{medium}", $_->{qty}) : mt("_med_$_->{medium}",1), @{$_[0]}
} ],
[ resolution => serialize => sub { $self->{resolutions}[$_[0]][0] } ],
[ voiced => serialize => sub { mt '_voiced_'.$_[0] } ],
[ ani_story => serialize => sub { mt '_animated_'.$_[0] } ],
[ ani_ero => serialize => sub { mt '_animated_'.$_[0] } ],
[ producers => join => '<br />', split => sub {
- map sprintf('<a href="/p%d" title="%s">%s</a>', $_->{id}, $_->{original}||$_->{name}, shorten $_->{name}, 50), @{$_[0]};
+ map sprintf('<a href="/p%d" title="%s">%s</a> (%s)', $_->{id}, $_->{original}||$_->{name}, shorten($_->{name}, 50),
+ join(', ', $_->{developer} ? mt '_reldiff_developer' :(), $_->{publisher} ? mt '_reldiff_publisher' :())
+ ), @{$_[0]};
} ],
);
}
@@ -154,11 +153,9 @@ sub _infotable {
if(@{$r->{media}}) {
Tr ++$i % 2 ? (class => 'odd') : ();
td mt '_relinfo_media', scalar @{$r->{media}};
- # TODO: TL the media
- td join ', ', map {
- my $med = $self->{media}{$_->{medium}};
- $med->[1] ? sprintf('%d %s%s', $_->{qty}, $med->[0], $_->{qty}>1?'s':'') : $med->[0]
- } @{$r->{media}};
+ td join ', ', map
+ $self->{media}{$_->{medium}} ? $_->{qty}.' '.mt("_med_$_->{medium}", $_->{qty}) : mt("_med_$_->{medium}",1),
+ @{$r->{media}};
end;
}
@@ -199,16 +196,19 @@ sub _infotable {
end;
}
- if(@{$r->{producers}}) {
- Tr ++$i % 2 ? (class => 'odd') : ();
- td mt '_relinfo_producer', scalar @{$r->{producers}};
- td;
- for (@{$r->{producers}}) {
- a href => "/p$_->{id}", title => $_->{original}||$_->{name}, shorten $_->{name}, 60;
- br if $_ != $r->{producers}[$#{$r->{producers}}];
- }
- end;
- end;
+ for my $t (qw|developer publisher|) {
+ my @prod = grep $_->{$t}, @{$r->{producers}};
+ if(@prod) {
+ Tr ++$i % 2 ? (class => 'odd') : ();
+ td mt "_relinfo_$t", scalar @prod;
+ td;
+ for (@prod) {
+ a href => "/p$_->{id}", title => $_->{original}||$_->{name}, shorten $_->{name}, 60;
+ br if $_ != $prod[$#prod];
+ }
+ end;
+ end;
+ }
}
if($r->{gtin}) {
@@ -241,14 +241,14 @@ sub _infotable {
td;
Select id => 'listsel', name => 'listsel';
option mt !$rl ? '_relinfo_user_notlist' :
- ('_relinfo_user_inlist', $self->{vn_rstat}[$rl->{rstat}], $self->{vn_vstat}[$rl->{vstat}]);
+ ('_relinfo_user_inlist', mt('_rlst_rstat_'.$rl->{rstat}), mt('_rlst_vstat_'.$rl->{vstat}));
optgroup label => mt '_relinfo_user_setr';
- option value => "r$_", $self->{vn_rstat}[$_]
- for (0..$#{$self->{vn_rstat}});
+ option value => "r$_", mt '_rlst_rstat_'.$_
+ for (@{$self->{rlst_rstat}});
end;
optgroup label => mt '_relinfo_user_setv';
- option value => "v$_", $self->{vn_vstat}[$_]
- for (0..$#{$self->{vn_vstat}});
+ option value => "v$_", mt '_rlst_vstat_'.$_
+ for (@{$self->{rlst_vstat}});
end;
option value => 'del', mt '_relinfo_user_del' if $rl;
end;
@@ -289,7 +289,10 @@ sub edit {
(map { $_ => $r->{$_} } qw|type title original gtin catalog languages website released
notes minage platforms patch resolution voiced freeware doujin ani_story ani_ero|),
media => join(',', sort map "$_->{medium} $_->{qty}", @{$r->{media}}),
- producers => join('|||', map "$_->{id},$_->{name}", sort { $a->{id} <=> $b->{id} } @{$r->{producers}}),
+ producers => join('|||', map
+ sprintf('%d,%d,%s', $_->{id}, ($_->{developer}?1:0)+($_->{publisher}?2:0), $_->{name}),
+ sort { $a->{id} <=> $b->{id} } @{$r->{producers}}
+ ),
);
$b4{vn} = join('|||', map "$_->{vid},$_->{title}", @$vn);
my $frm;
@@ -325,7 +328,7 @@ sub edit {
if(!$frm->{_err}) {
# de-serialize
$media = [ map [ split / / ], split /,/, $frm->{media} ];
- $producers = [ map { /^([0-9]+)/ ? $1 : () } split /\|\|\|/, $frm->{producers} ];
+ $producers = [ map { /^([0-9]+),([1-3])/ ? [ $1, $2&1?1:0, $2&2?1:0] : () } split /\|\|\|/, $frm->{producers} ];
$new_vn = [ map { /^([0-9]+)/ ? $1 : () } split /\|\|\|/, $frm->{vn} ];
$frm->{platforms} = [ grep $_, @{$frm->{platforms}} ];
$frm->{$_} = $frm->{$_} ? 1 : 0 for (qw|patch freeware doujin|);
@@ -335,7 +338,7 @@ sub edit {
my $same = $rid &&
(join(',', sort @{$b4{platforms}}) eq join(',', sort @{$frm->{platforms}})) &&
- (join(',', sort @$producers) eq join(',', sort map $_->{id}, @{$r->{producers}})) &&
+ (join(',', map join(' ', @$_), sort { $a->[0] <=> $b->[0] } @$producers) eq join(',', sort map sprintf('%d %d %d',$_->{id}, $_->{developer}?1:0, $_->{publisher}?1:0), sort { $a->{id} <=> $b->{id} } @{$r->{producers}})) &&
(join(',', sort @$new_vn) eq join(',', sort map $_->{vid}, @$vn)) &&
(join(',', sort @{$b4{languages}}) eq join(',', sort @{$frm->{languages}})) &&
!grep !/^(platforms|producers|vn|languages)$/ && $frm->{$_} ne $b4{$_}, keys %b4;
@@ -370,7 +373,7 @@ sub edit {
$frm->{original} = $v->{original} if !defined $frm->{original} && !$r;
my $title = mt $rid ? ($copy ? '_redit_title_copy' : '_redit_title_edit', $r->{title}) : ('_redit_title_add', $v->{title});
- $self->htmlHeader(js => 'forms', title => $title, noindex => 1);
+ $self->htmlHeader(title => $title, noindex => 1);
$self->htmlMainTabs('r', $r, $copy ? 'copy' : 'edit') if $rid;
$self->htmlMainTabs('v', $v, 'edit') if $vid;
$self->htmlEditMessage('r', $r, $title, $copy);
@@ -435,7 +438,7 @@ sub _form {
h2 mt '_redit_form_media';
div id => 'media_div';
Select;
- option value => $_, class => $self->{media}{$_}[1] ? 'qty' : 'noqty', $self->{media}{$_}[0]
+ option value => $_, class => $self->{media}{$_} ? 'qty' : 'noqty', mt "_med_$_", 1
for (sort keys %{$self->{media}});
end;
end;
@@ -446,13 +449,17 @@ sub _form {
[ hidden => short => 'producers' ],
[ static => nolabel => 1, content => sub {
h2 mt('_redit_form_prod_sel');
- div id => 'producerssel';
- end;
+ table; tbody id => 'producer_tbl'; end; end;
h2 mt('_redit_form_prod_add');
- div;
- input type => 'text', class => 'text';
- a href => '#', 'add';
- end;
+ table; Tr;
+ td class => 'tc_name'; input id => 'producer_input', type => 'text', class => 'text'; end;
+ td class => 'tc_role'; Select id => 'producer_role';
+ option value => 1, mt '_redit_form_prod_dev';
+ option value => 2, selected => 'selected', mt '_redit_form_prod_pub';
+ option value => 3, mt '_redit_form_prod_both';
+ end; end;
+ td class => 'tc_add'; a id => 'producer_add', href => '#', mt '_redit_form_prod_addbut'; end;
+ end; end;
}],
],
@@ -460,12 +467,11 @@ sub _form {
[ hidden => short => 'vn' ],
[ static => nolabel => 1, content => sub {
h2 mt('_redit_form_vn_sel');
- div id => 'vnsel';
- end;
+ table; tbody id => 'vn_tbl'; end; end;
h2 mt('_redit_form_vn_add');
div;
- input type => 'text', class => 'text';
- a href => '#', 'add';
+ input id => 'vn_input', type => 'text', class => 'text';
+ a href => '#', id => 'vn_add', mt '_redit_form_vn_addbut';
end;
}],
],
@@ -484,7 +490,7 @@ sub browse {
{ name => 'ln', required => 0, multi => 1, default => '', enum => $self->{languages} },
{ name => 'pl', required => 0, multi => 1, default => '', enum => $self->{platforms} },
{ name => 'me', required => 0, multi => 1, default => '', enum => [ keys %{$self->{media}} ] },
- { name => 'tp', required => 0, default => -1, enum => [ -1, @{$self->{release_types}} ] },
+ { name => 'tp', required => 0, default => '', enum => [ '', @{$self->{release_types}} ] },
{ name => 'pa', required => 0, default => 0, enum => [ 0..2 ] },
{ name => 'fw', required => 0, default => 0, enum => [ 0..2 ] },
{ name => 'do', required => 0, default => 0, enum => [ 0..2 ] },
@@ -503,7 +509,7 @@ sub browse {
$f->{ln}[0] ? (languages => $f->{ln}) : (),
$f->{me}[0] ? (media => $f->{me}) : (),
$f->{re}[0] ? (resolutions => $f->{re} ) : (),
- $f->{tp} >= 0 ? (type => $f->{tp}) : (),
+ $f->{tp} ? (type => $f->{tp}) : (),
$f->{ma_a} || $f->{ma_m} ? (minage => [$f->{ma_m}, $f->{ma_a}]) : (),
$f->{pa} ? (patch => $f->{pa}) : (),
$f->{fw} ? (freeware => $f->{fw}) : (),
@@ -614,7 +620,7 @@ sub _filters {
end;
end;
$self->htmlFormPart($f, [ select => short => 'tp', name => mt('_rbrowse_type'),
- options => [ [-1, mt '_rbrowse_all'], map [ $_, mt "_rtype_$_" ], @{$self->{release_types}} ]]);
+ options => [ ['', mt '_rbrowse_all'], map [ $_, mt "_rtype_$_" ], @{$self->{release_types}} ]]);
$self->htmlFormPart($f, [ select => short => 'pa', name => mt('_rbrowse_patch'),
options => [ [0, mt '_rbrowse_all' ], [1, mt '_rbrowse_patchonly'], [2, mt '_rbrowse_patchnone']]]);
$self->htmlFormPart($f, [ select => short => 'fw', name => mt('_rbrowse_freeware'),
@@ -629,7 +635,7 @@ sub _filters {
txt mt '_rbrowse_languages';
b ' ('.mt('_rbrowse_boolor').')';
end;
- for my $i (sort @{$self->dbLanguages}) {
+ for my $i (@{$self->{languages}}) {
span;
input type => 'checkbox', name => 'ln', value => $i, id => "lang_$i", grep($_ eq $i, @{$f->{ln}}) ? (checked => 'checked') : ();
label for => "lang_$i";
@@ -660,7 +666,7 @@ sub _filters {
for my $i (sort keys %{$self->{media}}) {
span;
input type => 'checkbox', name => 'me', value => $i, id => "med_$i", grep($_ eq $i, @{$f->{me}}) ? (checked => 'checked') : ();
- label for => "med_$i", $self->{media}{$i}[0];
+ label for => "med_$i", mt "_med_$i", 1;
end;
}
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index ae240d38..4c969436 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -36,7 +36,7 @@ sub tagpage {
);
return 404 if $f->{_err};
my $tagspoil = $self->reqCookie('tagspoil');
- $f->{m} = $tagspoil =~ /^[0-2]$/ ? $tagspoil : 1 if $f->{m} == -1;
+ $f->{m} = $tagspoil =~ /^[0-2]$/ ? $tagspoil : 0 if $f->{m} == -1;
my($list, $np) = $t->{meta} || $t->{state} != 2 ? ([],0) : $self->dbTagVNs(
tag => $tag,
@@ -422,7 +422,7 @@ sub vntagmod {
my $frm;
my $title = mt '_tagv_title', $v->{title};
- $self->htmlHeader(title => $title, noindex => 1, js => 'forms');
+ $self->htmlHeader(title => $title, noindex => 1);
$self->htmlMainTabs('v', $v, 'tagmod');
div class => 'mainbox';
h1 $title;
@@ -438,43 +438,44 @@ sub vntagmod {
$self->htmlForm({ frm => $frm, action => "/v$vid/tagmod", nosubmit => 1 }, tagmod => [ mt('_tagv_frm_title'),
[ hidden => short => 'taglinks', value => '' ],
[ static => nolabel => 1, content => sub {
- table id => 'tagtable';
+ table class => 'tgl';
thead;
Tr;
td '';
- td colspan => 2, class => 'tc2_1', mt '_tagv_col_you';
- td colspan => 2, class => 'tc3_1', mt '_tagv_col_others';
+ td colspan => 2, class => 'tc_you', mt '_tagv_col_you';
+ td colspan => 2, class => 'tc_others', mt '_tagv_col_others';
end;
Tr;
- my $i=0;
- td class => 'tc'.++$i, mt '_tagv_col_'.$_ for(qw|tag rating spoiler rating spoiler|);
+ td class => 'tc_tagname', mt '_tagv_col_tag';
+ td class => 'tc_myvote', mt '_tagv_col_rating';
+ td class => 'tc_myspoil', mt '_tagv_col_spoiler';
+ td class => 'tc_allvote', mt '_tagv_col_rating';
+ td class => 'tc_allspoil', mt '_tagv_col_spoiler';
end;
end;
tfoot; Tr;
td colspan => 5;
input type => 'submit', class => 'submit', value => mt('_tagv_save'), style => 'float: right';
- input type => 'text', class => 'text', name => 'addtag', value => '';
- input type => 'button', class => 'submit', value => mt '_tagv_add';
+ input id => 'tagmod_tag', type => 'text', class => 'text', value => '';
+ input id => 'tagmod_add', type => 'button', class => 'submit', value => mt '_tagv_add';
br;
p;
lit mt '_tagv_addmsg';
end;
end;
end; end;
- tbody;
+ tbody id => 'tagtable';
for my $t (sort { $a->{name} cmp $b->{name} } @$tags) {
my $m = (grep $_->{tag} == $t->{id}, @$my)[0] || {};
- Tr;
- td class => 'tc1';
- a href => "/g$t->{id}", $t->{name};
- end;
- td class => 'tc2', $m->{vote}||0;
- td class => 'tc3', defined $m->{spoiler} ? $m->{spoiler} : -1;
- td class => 'tc4';
+ Tr id => "tgl_$t->{id}";
+ td class => 'tc_tagname'; a href => "/g$t->{id}", $t->{name}; end;
+ td class => 'tc_myvote', $m->{vote}||0;
+ td class => 'tc_myspoil', defined $m->{spoiler} ? $m->{spoiler} : -1;
+ td class => 'tc_allvote';
tagscore !$m->{vote} ? $t->{rating} : $t->{cnt} == 1 ? 0 : ($t->{rating}*$t->{cnt} - $m->{vote}) / ($t->{cnt}-1);
i ' ('.($t->{cnt} - ($m->{vote} ? 1 : 0)).')';
end;
- td class => 'tc5', sprintf '%.2f', $t->{spoiler};
+ td class => 'tc_allspoil', sprintf '%.2f', $t->{spoiler};
end;
}
end;
@@ -529,7 +530,7 @@ sub usertags {
header => [
sub {
td class => 'tc1';
- b id => 'relhidall';
+ b id => 'expandall';
lit '<i>&#9656;</i> '.mt('_tagu_col_num').' ';
end;
lit $f->{s} eq 'cnt' && $f->{o} eq 'a' ? "\x{25B4}" : qq|<a href="/u$u->{id}/tags?o=a;s=cnt">\x{25B4}</a>|;
@@ -542,7 +543,7 @@ sub usertags {
row => sub {
my($s, $n, $l) = @_;
Tr $n % 2 ? (class => 'odd') : ();
- td class => 'tc1 relhid_but', id => "tag$l->{id}";
+ td class => 'tc1 collapse_but', id => "tag$l->{id}";
lit "<i>&#9656;</i> $l->{cnt}";
end;
td class => 'tc2', colspan => 2;
@@ -550,7 +551,7 @@ sub usertags {
end;
end;
for(@{$l->{vns}}) {
- Tr class => "relhid tag$l->{id}";
+ Tr class => "collapse collapse_tag$l->{id}";
td class => 'tc1_1';
tagscore $_->{vote};
end;
@@ -652,7 +653,7 @@ sub tagxml {
my($list, $np) = $self->dbTagGet(
$q =~ /^g([1-9]\d*)/ ? (id => $1) : $q =~ /^name:(.+)$/ ? (name => $1) : (search => $q),
- results => 10,
+ results => 15,
page => 1,
);
diff --git a/lib/VNDB/Handler/ULists.pm b/lib/VNDB/Handler/ULists.pm
index 7d1a9304..6a0d6c9e 100644
--- a/lib/VNDB/Handler/ULists.pm
+++ b/lib/VNDB/Handler/ULists.pm
@@ -69,7 +69,7 @@ sub rlist {
return $self->htmlDenied() if !$uid;
my $f = $self->formValidate(
- { name => 'e', required => 1, enum => [ 'del', map("r$_", 0..$#{$self->{vn_rstat}}), map("v$_", 0..$#{$self->{vn_vstat}}) ] },
+ { name => 'e', required => 1, enum => [ 'del', map("r$_", @{$self->{rlst_rstat}}), map("v$_", @{$self->{rlst_vstat}}) ] },
);
return 404 if $f->{_err};
@@ -212,7 +212,7 @@ sub vnlist {
if($own && $self->reqMethod eq 'POST') {
my $frm = $self->formValidate(
{ name => 'sel', required => 0, default => 0, multi => 1, template => 'int' },
- { name => 'batchedit', required => 1, enum => [ 'del', map("r$_", 0..$#{$self->{vn_rstat}}), map("v$_", 0..$#{$self->{vn_vstat}}) ] },
+ { name => 'batchedit', required => 1, enum => [ 'del', map("r$_", @{$self->{rlst_rstat}}), map("v$_", @{$self->{rlst_vstat}}) ] },
);
if(!$frm->{_err} && @{$frm->{sel}} && $frm->{sel}[0]) {
$self->dbVNListDel($uid, $frm->{sel}) if $frm->{batchedit} eq 'del';
@@ -229,7 +229,7 @@ sub vnlist {
uid => $uid,
results => 50,
page => $f->{p},
- order => $f->{s}.' '.($f->{o} eq 'd' ? 'DESC' : 'ASC'),
+ order => $f->{s}.' '.($f->{o} eq 'd' ? 'DESC' : 'ASC').($f->{s} eq 'vote' ? ', title ASC' : ''),
voted => $f->{v},
$f->{c} ne 'all' ? (char => $f->{c}) : (),
);
@@ -285,7 +285,7 @@ sub _vnlist_browse {
pageurl => $url->('page'),
header => [
[ mt('_rlist_col_title') => 'title', 3 ],
- sub { td class => 'tc2', id => 'relhidall'; lit '<i>&#9656;</i>'.mt('_rlist_col_releases').'*'; end; },
+ sub { td class => 'tc2', id => 'expandall'; lit '<i>&#9656;</i>'.mt('_rlist_col_releases').'*'; end; },
[ mt('_rlist_col_vote') => 'vote' ],
],
row => sub {
@@ -294,7 +294,7 @@ sub _vnlist_browse {
td class => 'tc1', colspan => 3;
a href => "/v$i->{vid}", title => $i->{original}||$i->{title}, shorten $i->{title}, 70;
end;
- td class => 'tc2'.(@{$i->{rels}} ? ' relhid_but' : ''), id => 'vid'.$i->{vid};
+ td class => 'tc2'.(@{$i->{rels}} ? ' collapse_but' : ''), id => 'vid'.$i->{vid};
lit '<i>&#9656;</i>';
my $obtained = grep $_->{rstat}==2, @{$i->{rels}};
my $finished = grep $_->{vstat}==2, @{$i->{rels}};
@@ -307,7 +307,7 @@ sub _vnlist_browse {
end;
for (@{$i->{rels}}) {
- Tr class => "relhid vid$i->{vid}";
+ Tr class => "collapse relhid collapse_vid$i->{vid}";
td class => 'tc1'.($own ? ' own' : '');
input type => 'checkbox', name => 'sel', value => $_->{rid}
if $own;
@@ -333,12 +333,12 @@ sub _vnlist_browse {
Select id => 'batchedit', name => 'batchedit';
option mt '_rlist_selection';
optgroup label => mt '_rlist_changerel';
- option value => "r$_", $self->{vn_rstat}[$_]
- for (0..$#{$self->{vn_rstat}});
+ option value => "r$_", mt "_rlst_rstat_$_"
+ for (@{$self->{rlst_rstat}});
end;
optgroup label => mt '_rlist_changeplay';
- option value => "v$_", $self->{vn_vstat}[$_]
- for (0..$#{$self->{vn_vstat}});
+ option value => "v$_", mt "_rlst_vstat_$_"
+ for (@{$self->{rlst_vstat}});
end;
option value => 'del', mt '_rlist_del';
end;
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index d6193ddc..39aecbfc 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -267,7 +267,7 @@ sub edit {
return $self->htmlDenied if !$self->authInfo->{id} || $self->authInfo->{id} != $uid && !$self->authCan('usermod');
# fetch user info (cached if uid == loggedin uid)
- my $u = $self->authInfo->{id} == $uid ? $self->authInfo : $self->dbUserGet(uid => $uid)->[0];
+ my $u = $self->authInfo->{id} == $uid ? $self->authInfo : $self->dbUserGet(uid => $uid, what => 'extended')->[0];
return 404 if !$u->{id};
# check POST data
@@ -386,7 +386,7 @@ sub posts {
[ '' ],
[ '' ],
[ mt '_uposts_col_date' ],
- sub { td; a href => '#', id => 'history_comments', 'expand'; txt mt '_uposts_col_title'; end; }
+ sub { td; a href => '#', id => 'expandlist', mt '_js_expand'; txt mt '_uposts_col_title'; end; }
],
row => sub {
my($s, $n, $l) = @_;
@@ -396,7 +396,7 @@ sub posts {
td class => 'tc3', $self->{l10n}->date($l->{date});
td class => 'tc4'; a href => "/t$l->{tid}.$l->{num}", $l->{title}; end;
end;
- Tr class => $n % 2 ? 'editsum odd hidden' : 'editsum hidden';
+ Tr class => $n % 2 ? 'collapse msgsum odd hidden' : 'collapse msgsum hidden';
td colspan => 4;
lit bb2html $l->{msg}, 150;
end;
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index 2a6d6cd7..bca21151 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -25,7 +25,7 @@ sub list {
{ name => 'pl', required => 0, multi => 1, enum => $self->{platforms}, default => '' },
{ name => 'ti', required => 0, default => '', maxlength => 200 },
{ name => 'te', required => 0, default => '', maxlength => 200 },
- { name => 'sp', required => 0, default => $self->reqCookie('tagspoil') =~ /^([0-2])$/ ? $1 : 1, enum => [0..2] },
+ { name => 'sp', required => 0, default => $self->reqCookie('tagspoil') =~ /^([0-2])$/ ? $1 : 0, enum => [0..2] },
);
return 404 if $f->{_err};
$f->{q} ||= $f->{sq};
@@ -70,7 +70,7 @@ sub list {
$self->resRedirect('/v'.$list->[0]{id}, 'temp')
if $f->{q} && @$list == 1;
- $self->htmlHeader(title => mt('_vnbrowse_title'), search => $f->{q}, js => 'forms');
+ $self->htmlHeader(title => mt('_vnbrowse_title'), search => $f->{q});
_filters($self, $f, $char, \@ignored);
my $url = "/v/$char?q=$f->{q};ti=$f->{ti};te=$f->{te}";
@@ -162,7 +162,7 @@ sub _filters {
txt mt '_vnbrowse_lang';
b ' ('.mt('_vnbrowse_boolor').')';
end;
- for my $i (sort @{$self->dbLanguages}) {
+ for my $i (@{$self->{languages}}) {
span;
input type => 'checkbox', name => 'ln', value => $i, id => "lang_$i",
(scalar grep $_ eq $i, @{$f->{ln}}) ? (checked => 'checked') : ();
diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm
index f09d6ddd..ed7068dc 100644
--- a/lib/VNDB/Handler/VNEdit.pm
+++ b/lib/VNDB/Handler/VNEdit.pm
@@ -28,7 +28,7 @@ sub edit {
my %b4 = !$vid ? () : (
(map { $_ => $v->{$_} } qw|title original desc alias length l_wp l_encubed l_renai l_vnn img_nsfw|),
anime => join(' ', sort { $a <=> $b } map $_->{id}, @{$v->{anime}}),
- relations => join('|||', map $_->{relation}.','.$_->{id}.','.$_->{title}, sort { $a->{id} <=> $b->{id} } @{$v->{relations}}),
+ vnrelations => join('|||', map $_->{relation}.','.$_->{id}.','.$_->{title}, sort { $a->{id} <=> $b->{id} } @{$v->{relations}}),
screenshots => join(' ', map sprintf('%d,%d,%d', $_->{id}, $_->{nsfw}?1:0, $_->{rid}), @{$v->{screenshots}}),
);
@@ -46,7 +46,7 @@ sub edit {
{ name => 'l_vnn', required => 0, default => $b4{l_vnn}||0, template => 'int' },
{ name => 'anime', required => 0, default => '' },
{ name => 'img_nsfw', required => 0, default => 0 },
- { name => 'relations', required => 0, default => '', maxlength => 5000 },
+ { name => 'vnrelations', required => 0, default => '', maxlength => 5000 },
{ name => 'screenshots', required => 0, default => '', maxlength => 1000 },
{ name => 'editsum', maxlength => 5000 },
);
@@ -57,11 +57,11 @@ sub edit {
if(!$frm->{_err}) {
# parse and re-sort fields that have multiple representations of the same information
my $anime = { map +($_=>1), grep /^[0-9]+$/, split /[ ,]+/, $frm->{anime} };
- my $relations = [ map { /^([0-9]+),([0-9]+),(.+)$/ && (!$vid || $2 != $vid) ? [ $1, $2, $3 ] : () } split /\|\|\|/, $frm->{relations} ];
+ my $relations = [ map { /^([a-z]+),([0-9]+),(.+)$/ && (!$vid || $2 != $vid) ? [ $1, $2, $3 ] : () } split /\|\|\|/, $frm->{vnrelations} ];
my $screenshots = [ map /^[0-9]+,[01],[0-9]+$/ ? [split /,/] : (), split / +/, $frm->{screenshots} ];
$frm->{anime} = join ' ', sort { $a <=> $b } keys %$anime;
- $frm->{relations} = join '|||', map $_->[0].','.$_->[1].','.$_->[2], sort { $a->[1] <=> $b->[1]} @{$relations};
+ $frm->{vnrelations} = join '|||', map $_->[0].','.$_->[1].','.$_->[2], sort { $a->[1] <=> $b->[1]} @{$relations};
$frm->{img_nsfw} = $frm->{img_nsfw} ? 1 : 0;
$frm->{screenshots} = join ' ', map sprintf('%d,%d,%d', $_->[0], $_->[1]?1:0, $_->[2]), sort { $a->[0] <=> $b->[0] } @$screenshots;
@@ -83,7 +83,7 @@ sub edit {
($nvid, $cid) = $self->dbVNAdd(%args) if !$vid;
# update reverse relations & relation graph
- if(!$vid && $#$relations >= 0 || $vid && $frm->{relations} ne $b4{relations}) {
+ if(!$vid && $#$relations >= 0 || $vid && $frm->{vnrelations} ne $b4{vnrelations}) {
my %old = $vid ? (map { $_->{id} => $_->{relation} } @{$v->{relations}}) : ();
my %new = map { $_->[1] => $_->[0] } @$relations;
_updreverse($self, \%old, \%new, $nvid, $cid, $nrev);
@@ -97,7 +97,7 @@ sub edit {
$frm->{editsum} = sprintf 'Reverted to revision v%d.%d', $vid, $rev if $rev && !defined $frm->{editsum};
my $title = $vid ? mt('_vnedit_title_edit', $v->{title}) : mt '_vnedit_title_add';
- $self->htmlHeader(js => 'forms', title => $title, noindex => 1);
+ $self->htmlHeader(title => $title, noindex => 1);
$self->htmlMainTabs('v', $v, 'edit') if $vid;
$self->htmlEditMessage('v', $v, $title);
_form($self, $v, $frm);
@@ -183,7 +183,7 @@ sub _form {
],
vn_rel => [ mt('_vnedit_rel'),
- [ hidden => short => 'relations' ],
+ [ hidden => short => 'vnrelations' ],
[ static => nolabel => 1, content => sub {
h2 mt '_vnedit_rel_sel';
table;
@@ -193,22 +193,22 @@ sub _form {
end;
h2 mt '_vnedit_rel_add';
- # TODO: localize JS relartion selector
table;
Tr id => 'relation_new';
- td class => 'tc1';
+ td class => 'tc_vn';
input type => 'text', class => 'text';
end;
- td class => 'tc2';
- txt ' is a ';
+ td class => 'tc_rel';
+ txt mt('_vnedit_rel_isa').' ';
Select;
- option value => $_, $self->{vn_relations}[$_][0] for (0..$#{$self->{vn_relations}});
+ option value => $_, mt "_vnrel_$_"
+ for (sort { $self->{vn_relations}{$a}[0] <=> $self->{vn_relations}{$b}[0] } keys %{$self->{vn_relations}});
end;
- txt ' of';
+ txt ' '.mt '_vnedit_rel_of';
end;
- td class => 'tc3', $v ? $v->{title} : '';
- td class => 'tc4';
- a href => '#', 'add';
+ td class => 'tc_title', $v ? $v->{title} : '';
+ td class => 'tc_add';
+ a href => '#', mt '_vnedit_rel_addbut';
end;
end;
end;
@@ -219,10 +219,9 @@ sub _form {
[ hidden => short => 'screenshots' ],
[ static => nolabel => 1, content => sub {
div class => 'warning';
- lit mt '_vnedit_scr_msg';
+ lit mt '_vnedit_scrmsg';
end;
br;
- # TODO: localize screenshot uploader
table;
tbody id => 'scr_table', '';
end;
@@ -250,11 +249,9 @@ sub _updreverse {
# compare %old and %new
for (keys %$old, keys %$new) {
if(exists $$old{$_} and !exists $$new{$_}) {
- $upd{$_} = -1;
- } elsif((!exists $$old{$_} and exists $$new{$_}) || ($$old{$_} != $$new{$_})) {
- $upd{$_} = $$new{$_};
- if ($self->{vn_relations}[$upd{$_} ][1]) { $upd{$_}-- }
- elsif($self->{vn_relations}[$upd{$_}+1][1]) { $upd{$_}++ }
+ $upd{$_} = undef;
+ } elsif((!exists $$old{$_} and exists $$new{$_}) || ($$old{$_} ne $$new{$_})) {
+ $upd{$_} = $self->{vn_relations}{$$new{$_}}[1];
}
}
@@ -264,7 +261,7 @@ sub _updreverse {
for my $i (keys %upd) {
my $r = $self->dbVNGet(id => $i, what => 'extended relations anime screenshots')->[0];
my @newrel = map $_->{id} != $vid ? [ $_->{relation}, $_->{id} ] : (), @{$r->{relations}};
- push @newrel, [ $upd{$i}, $vid ] if $upd{$i} != -1;
+ push @newrel, [ $upd{$i}, $vid ] if $upd{$i};
$self->dbVNEdit($i,
relations => \@newrel,
editsum => "Reverse relation update caused by revision v$vid.$rev",
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 361963a8..ec5f4afc 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -27,16 +27,17 @@ sub rg {
return 404 if !$v->{id} || !$v->{rgraph};
my $title = mt '_vnrg_title', $v->{title};
- $self->htmlHeader(title => $title);
- $self->htmlMainTabs('v', $v, 'rg');
+ return if $self->htmlRGHeader($title, 'v', $v);
+
+ $v->{svg} =~ s/\$___(_vnrel_[a-z]+)____\$/mt $1/eg;
+
div class => 'mainbox';
h1 $title;
- lit $v->{cmap};
p class => 'center';
- img src => sprintf('%s/rg/%02d/%d.png', $self->{url_static}, $v->{rgraph}%100, $v->{rgraph}),
- alt => $title, usemap => '#rgraph';
+ lit $v->{svg};
end;
end;
+ $self->htmlFooter;
}
@@ -148,15 +149,16 @@ sub page {
my $t = $self->dbTagStats(vid => $v->{id}, order => 'avg(tv.vote) DESC', minrating => 0, results => 999);
if(@$t) {
div id => 'tagops';
- a href => '#', mt '_vnpage_tags_spoil0';
- a href => '#', class => 'tsel', mt '_vnpage_tags_spoil1';
+ # NOTE: order of these links is hardcoded in JS
+ a href => '#', class => 'tsel', mt '_vnpage_tags_spoil0';
+ a href => '#', mt '_vnpage_tags_spoil1';
a href => '#', mt '_vnpage_tags_spoil2';
a href => '#', class => 'sec', mt '_vnpage_tags_summary';
a href => '#', mt '_vnpage_tags_all';
end;
div id => 'vntags';
for (@$t) {
- span class => sprintf 'tagspl%.0f %s', $_->{spoiler}, $_->{spoiler} > 1 ? 'hidden' : '';
+ span class => sprintf 'tagspl%.0f %s', $_->{spoiler}, $_->{spoiler} > 0 ? 'hidden' : '';
a href => "/g$_->{id}", style => sprintf('font-size: %dpx', $_->{rating}*3.5+6), $_->{name};
b class => 'grayedout', sprintf ' %.1f', $_->{rating};
end;
@@ -199,7 +201,7 @@ sub _revision {
}],
[ relations => join => '<br />', split => sub {
my @r = map sprintf('%s: <a href="/v%d" title="%s">%s</a>',
- $self->{vn_relations}[$_->{relation}][0], $_->{id}, xml_escape($_->{original}||$_->{title}), xml_escape shorten $_->{title}, 40
+ mt("_vnrel_$_->{relation}"), $_->{id}, xml_escape($_->{original}||$_->{title}), xml_escape shorten $_->{title}, 40
), sort { $a->{id} <=> $b->{id} } @{$_[0]};
return @r ? @r : (mt '_vndiff_none');
}],
@@ -229,27 +231,42 @@ sub _revision {
sub _producers {
my($self, $i, $r) = @_;
- return if !grep @{$_->{producers}}, @$r;
my %lang;
my @lang = grep !$lang{$_}++, map @{$_->{languages}}, @$r;
- Tr ++$$i % 2 ? (class => 'odd') : ();
- td mt '_vnpage_producers';
- td;
- for my $l (@lang) {
- my %p = map { $_->{id} => $_ } map @{$_->{producers}}, grep grep($_ eq $l, @{$_->{languages}}), @$r;
- my @p = values %p;
- next if !@p;
- cssicon "lang $l", mt "_lang_$l";
- for (@p) {
+ if(grep $_->{developer}, map @{$_->{producers}}, @$r) {
+ my %dev = map $_->{developer} ? ($_->{id} => $_) : (), map @{$_->{producers}}, @$r;
+ my @dev = values %dev;
+ Tr ++$$i % 2 ? (class => 'odd') : ();
+ td mt "_vnpage_developer";
+ td;
+ for (@dev) {
a href => "/p$_->{id}", title => $_->{original}||$_->{name}, shorten $_->{name}, 30;
- txt ' & ' if $_ != $p[$#p];
+ txt ' & ' if $_ != $dev[$#dev];
}
- txt "\n";
- }
- end;
- end;
+ end;
+ end;
+ }
+
+ if(grep $_->{publisher}, map @{$_->{producers}}, @$r) {
+ Tr ++$$i % 2 ? (class => 'odd') : ();
+ td mt "_vnpage_publisher";
+ td;
+ for my $l (@lang) {
+ my %p = map $_->{publisher} ? ($_->{id} => $_) : (), map @{$_->{producers}}, grep grep($_ eq $l, @{$_->{languages}}), @$r;
+ my @p = values %p;
+ next if !@p;
+ cssicon "lang $l", mt "_lang_$l";
+ for (@p) {
+ a href => "/p$_->{id}", title => $_->{original}||$_->{name}, shorten $_->{name}, 30;
+ txt ' & ' if $_ != $p[$#p];
+ }
+ txt "\n";
+ }
+ end;
+ end;
+ }
}
@@ -266,7 +283,7 @@ sub _relations {
td class => 'relations';
dl;
for(sort keys %rel) {
- dt $self->{vn_relations}[$_][0];
+ dt mt "_vnrel_$_";
dd;
for (@{$rel{$_}}) {
a href => "/v$_->{id}", title => $_->{original}||$_->{title}, shorten $_->{title}, 40;
@@ -306,7 +323,7 @@ sub _anime {
txt '] ';
end;
acronym title => $_->{title_kanji}||$_->{title_romaji}, shorten $_->{title_romaji}, 50;
- b ' ('.(defined $_->{type} ? $self->{anime_types}[$_->{type}].', ' : '').$_->{year}.')';
+ b ' ('.(defined $_->{type} ? mt("_animetype_$_->{type}").', ' : '').$_->{year}.')';
txt "\n";
}
}
@@ -395,7 +412,7 @@ sub _releases {
end;
td class => 'tc5';
if($self->authInfo->{id}) {
- a href => "/r$rel->{id}", id => "rlsel_$rel->{id}";
+ a href => "/r$rel->{id}", id => "rlsel_$rel->{id}", class => 'vnrlsel';
lit $rel->{ulist} ? liststat $rel->{ulist} : '--';
end;
} else {