summaryrefslogtreecommitdiff
path: root/data/tpl/vnpage
blob: 2e9fc6aaf026e49697915b4ff68b4de707fbc90e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
[[= ttabs('v', $d{vn}) ]]

<h2>[[: $d{vn}{title} ]]</h2>


[[ if($d{vn}{hidden}) { ]]-
 <span class="warning">
  This item has been deleted from the database. File a request on the
  <a href="/t/v[[= $d{vn}{id} ]]">discussion board</a> to undelete this page.
 </span>
[[ } ]]
[[ if(!$d{vn}{hidden} || $p{Authdel}) { ]]-

-[[ if($p{AuthLoggedin}) { ]]
<p class="mod">&lt; 
  user options -
  <a href="/u[[= $p{AuthId} ]]/list" rel="voteDD" class="dropdown">[[= $d{vote}{vid} ? 'your vote: '.$d{vote}{vote} : 'vote' ]]</a>
  - <a href="/u[[= $p{AuthId} ]]/wish" rel="wishDD" class="dropdown">[[= $d{wlist}{vid} ? 'wishlist: '.lc($$VNDB::WSTAT[$d{wlist}{wstat}]) : 'wishlist' ]]</a>
&gt;</p>
[[ } ]]-



[[ if($d{change}) { ]]
[[= cdiff($d{prev}, $d{vn},
  [ title       => 'Title',          1 ],
  [ alias       => 'Alias',          1, 1 ],
  [ desc        => 'Description',    1, 1 ],
  [ length      => 'Length',         sub { $VNDB::VNLEN->[$_[0] ][0] } ],
  [ l_wp        => 'Wikipedia link', sub { $_[0] ? '<a href="http://en.wikipedia.org/wiki/'.$_[0].'">'.$_[0].'</a>' : 'No link' } ],
  [ l_encubed   => 'Encubed tag',    sub { $_[0] ? '<a href="http://novelnews.net/tag/'._huri($_[0]).'/">'.$_[0].'</a>' : 'No link' } ],
  [ l_renai     => 'Renai.us link',  sub { $_[0] ? '<a href="http://renai.us/game/'._huri($_[0]).'.shtml">'.$_[0].'</a>' : 'No link' } ],
  [ l_vnn       => 'V-N.net link',   sub { $_[0] ? '<a href="http://visual-novels.net/vn/index.php?option=com_content&amp;task=view&amp;id='.$_[0].'">'.$_[0].'</a>' : 'No link' } ], 
  [ anime       => 'Related anime',  sub { join(' ', map qq|<a href="http://anidb.net/a$$_{id}">$$_{id}</a>|, sort { $a->{id} <=> $b->{id} } @{$_[0]}) } ],
  [ categories  => 'Categories',     sub { join(' ', map { my $l=$VNDB::CAT->{substr($_->[0],0,1)}[1]{substr($_->[0],1,2)}; $l?$l.'('.$_->[1].')':() } sort { $a->[0] cmp $b->[0] } @{$_[0]}) || 'No categories selected' }, 1 ],
  [ relations   => 'Relations',      sub { join("<br />\n", map { $VNDB::VREL->[$_->{relation}].': '._hchar($_->{title}) } sort { $a->{id} <=> $b->{id} } @{$_[0]}) } ],
  [ image       => 'Image',          sub { $_[0] > 0 ? sprintf '<img src="%s/cv/%02d/%d.jpg" />', $p{st}, $_[0]%100, $_[0] : $_[0] < 0 ? '[processing]' : 'No image'; } ],
  [ screenshots => 'Screenshots',    sub { join "<br />\n", map sprintf('[%s] <a href="%s/sf/%02d/%d.jpg">%4$d</a> (%s)',$$_{rid}?qq|<a href="/r$$_{rid}">r$$_{rid}</a>|:'no release',$p{st},$$_{id}%100,$$_{id},$$_{nsfw}?'NSFW':'Safe'), @{$_[0]} } ],
  [ img_nsfw    => 'NSFW',           sub { $_[0] ? 'Not safe' : 'Safe' } ]
 ) ]]
[[ } ]]-

[[ 
  my @lang;
  for (@{$d{rel}}) {
    my $l = $_->{language};
    next if grep { $_ eq $l } @lang;
    push @lang, $l;
  }

]] 


<div id="vnheader">
<div>
[[ if($d{vn}{image} > 0) { ]]
 [[ if($d{vn}{img_nsfw} && !$p{AuthNsfw}) { ]]
  <img src="[[: $p{st} ]]/cv/nsfw.png" id="nsfw" class="[[: $p{st} ]]/cv/[[= sprintf '%02d/%d', $d{vn}{image}%100, $d{vn}{image} ]].jpg" />
 [[ } else { ]]
  <img src="[[: $p{st} ]]/cv/[[= sprintf '%02d/%d', $d{vn}{image}%100, $d{vn}{image} ]].jpg" alt="[[: $p{PageTitle} ]]" />
  [[ if($d{vn}{img_nsfw}) { ]]
  <p class="nsfw">[ flagged as NSFW ]</p>
  [[ } ]]
 [[ } ]]
[[ } elsif($d{vn}{image} < 0) { ]]-
 [processing image, please return in a few minutes]
[[ } else { ]]-
 No image uploaded yet...
[[ } ]]-
</div>

-[[ 
  my @links = (
   $d{vn}{l_wp} ?      [ 'Wikipedia', 'http://en.wikipedia.org/wiki/%s', $d{vn}{l_wp} ] : (),
   $d{vn}{l_encubed} ? [ 'Encubed',   'http://novelnews.net/tag/%s/', _huri $d{vn}{l_encubed} ] : (),
   $d{vn}{l_renai} ?   [ 'Renai.us',  'http://renai.us/game/%s.shtml', _huri $d{vn}{l_renai} ] : (),
   $d{vn}{l_vnn}  ?    [ 'V-N.net',   'http://visual-novels.net/vn/index.php?option=com_content&amp;task=view&amp;id=%d', $d{vn}{l_vnn} ] : (),
  );

  my $prod = @lang && grep { @{$_->{producers}} } @{$d{rel}};

if($d{vn}{length} || $d{vn}{alias} || @links || $prod) { ]]
 <h3>General info</h3>
 <dl>
 [[ if($d{vn}{length}) { ]]-
  <dt>Length</dt><dd>[[: $VNDB::VNLEN->[$d{vn}{length}][0] ]]- ([[: $VNDB::VNLEN->[$d{vn}{length}][1] ]])</dd>[[ } ]]-
 [[ if($d{vn}{alias}) { ]]-
  <dt>Aliases</dt><dd>[[: $d{vn}{alias} ]]</dd>[[ } ]]-
 [[ if(@links > 0) { ]]-
  <dt>Links</dt><dd>[[= join(', ', map { '<a href="'.sprintf($_->[1],$_->[2]).'">'.$_->[0].'</a>' } @links) ]]</dd>[[ } ]]-
 [[ if($prod) { ]]-
  <dt>Producers</dt><dd>
   [[ for my $l (@lang) { my %l;
     $_->{language} eq $l && (%l = ( %l, map {
      sprintf('<a href="/p%d" title="%s">%s</a>',
        $_->{id}, _hchar($_->{name}), _hchar shorten $_->{name}, 30) => 1
     } @{$_->{producers}} )) for (@{$d{rel}});
   if(keys %l) { ]]-
    <acronym class="icons lang -[[= $l ]]" title="[[: $VNDB::LANG->{$l} ]]">&nbsp;</acronym>[[= join(' &amp; ', keys %l) ]]<br />
   [[ } } ]]
  </dd>[[ } ]]-
 </dl>
[[ } ]]-

 [[ if(@{$d{vn}{categories}}) { my %nolvl = (map {$_=>1} qw| pli pbr gaa gab hfa hfe lea lfa lsp tfu tpa tpr |); ]]-
 <h3>Categories</h3>
 <dl class="vnrel">
  [[ for (qw|e s g p h|) {
    my $c = $_;
    my @c = map { my $s=$_;
      my ($cs) = grep { $_->[0] eq $c.$s } @{$d{vn}{categories}};
      $cs ? sprintf('<i class="crgn%d">%s</i>', $nolvl{$c.$_}?0:$cs->[1], $VNDB::CAT->{$c}[1]{$s})
          : ()
    } sort keys %{$VNDB::CAT->{$c}[1]};
    if(@c) { ]]-
   <dt>[[: $VNDB::CAT->{$c}[0] ]]</dt><dd>[[= join(', ', @c) ]]</dd>
  [[ } } ]]
  [[ if(grep $_->[0] =~ /^[tl]/, @{$d{vn}{categories}}) { ]]-
   <dt>Place/Time</dt><dd>[[= join ', ', map $VNDB::CAT->{substr($_->[0],0,1)}[1]{substr($_->[0],1,2)},
     sort { $a->[0] cmp $b->[0] } grep $_->[0] =~ /^[tl]/, @{$d{vn}{categories}} ]]</dd>
  [[ } ]]-
 </dl>
 [[ } ]]-

 [[ if($#{$d{vn}{relations}} >= 0) { ]]-
 <h3>[[= $d{page} eq 'rg' ? 'Relations' : '<a href="/v'.$d{vn}{id}.'/rg">Relations</a>' ]]</h3>
 <dl class="vnrel">
  [[ my $lrel = -1; my $i=0; for (sort { $a->{relation} <=> $b->{relation} } @{$d{vn}{relations}}) {
    if($_->{relation} != $lrel) { $lrel=$_->{relation}; if($i) { ]]</dd>[[ } ]]-
    <dt>[[: $VNDB::VREL->[$lrel] ]]</dt><dd><a href="/v[[= $_->{id} ]]">[[: $_->{title} ]]</a>
   [[ } else { ]]<br /><a href="/v[[= $_->{id} ]]" title="[[: $_->{title} ]]">[[: shorten $_->{title}, 40 ]]</a>[[ }
  ++$i;} ]]</dd>
 </dl>
 [[ } ]]-

 [[ if(@{$d{vn}{anime}}) { ]]-
  <h3>Related anime</h3>
  <ul class="vnani">
   [[ for (sort { $a->{year} < 1 ? 1 : $b->{year} < 1 ? -1 : $a->{year} <=> $b->{year} } @{$d{vn}{anime}}) { ]]-
   <li>
   -[[ if($_->{lastfetch} < 1) { ]]
    <b>[[= $_->{lastfetch} < 0 ? '[unknown anidb id: ' : '[no information available at this time: ' ]]<a href="http://anidb.net/a[[= $_->{id} ]]">[[= $_->{id} ]]</a>]</b>
   [[ } else { 
    my $l = join '-', qq|<a href="http://anidb.net/a$_->{id}" title="AniDB">DB</a>|,
      $_->{nfo_id} ? qq|<a href="http://animenfo.com/animetitle,$_->{nfo_id},vndb.html" title="AnimeNFO">NFO</a>| : (),
      $_->{ann_id} ? qq|<a href="http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$_->{ann_id}" title="Anime News Network">ANN</a>| : ();
   ]]
    <b>[-[[= $l ]]-]</b> <acronym title="[[: $_->{title_kanji} ]]">[[: shorten $_->{title_romaji}, 40 ]]</acronym>
     <b>([[: $VNDB::ANITYPE->[$_->{type}][0] eq 'unknown' ? '' : $VNDB::ANITYPE->[$_->{type}][0].', ' ]][[= $_->{year} ]])</b>
   [[ } ]]
   </li>
   [[ } ]]
  </ul>
 [[ } ]]-
</div>

-[[ 
  my @lnks = (
    !$d{page} ? '<b>description &amp; releases</b>' : '<a href="/v'.$d{vn}{id}.'">description &amp; releases</a>',
    $d{page} eq 'stats' ? '<b>stats</b>' : '<a href="/v'.$d{vn}{id}.'/stats">stats</a>',
    @{$d{vn}{screenshots}} ? (
      $d{page} eq 'scr' ? '<b>screenshots</b>' : '<a href="/v'.$d{vn}{id}.'/scr">screenshots</a>',
    ) : (),
    @{$d{vn}{relations}} ? (
      $d{page} eq 'rg' ? '<b>relations</b>' : '<a href="/v'.$d{vn}{id}.'/rg">relations</a>',
    ) : (),
  );
]]
<p class="opts">- -[[= join(' - ', @lnks) ]]- -</p>

[[ if(!$d{page}) {           ]][[+ vnpage_rel   ]][[ } ]]
[[ if($d{page} eq 'stats') { ]][[+ vnpage_stats ]][[ } ]]
[[ if($d{page} eq 'rg') {    ]][[+ vnpage_rg    ]][[ } ]]
[[ if($d{page} eq 'scr') {   ]][[+ vnpage_scr   ]][[ } ]]

[[ if($p{AuthLoggedin}) { ]]-
<div class="dropdown" id="voteDD">
 <ul>
 [[ if($d{vote}{vid}) { ]]-
  <li><a href="/v[[= $d{vn}{id} ]]/vote?v=-1">revoke</a></li>
 [[ } for (reverse 1..10) { ]]-
  <li class="center"><a href="/v[[= $d{vn}{id} ]]/vote?v=[[= $_ ]]" id="dovote_[[= $_ ]]">[[= $_ ]]</a></li>
 [[ } ]]
 </ul>
</div>

<div class="dropdown" id="wishDD">
 <ul>
 [[ for (0..$#$VNDB::WSTAT) {
  if($d{wlist}{vid} && $d{wlist}{wstat} == $_) { ]]-
  <li><b>[[: $$VNDB::WSTAT[$_] ]]</b></li>
  [[ } else { ]]-
  <li><a href="/v[[= $d{vn}{id} ]]/wish?w=[[= $_ ]]">[[: $$VNDB::WSTAT[$_] ]]</a></li>
 [[ } } if($d{wlist}{vid}) { ]]-
  <li><a href="/v[[= $d{vn}{id} ]]/wish?w=-1">remove</a></li>
 [[ } ]]
 </ul>
</div>
[[ } ]]


[[ } ]]