summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/Misc.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-24 14:07:26 +0200
committerYorhel <git@yorhel.nl>2009-09-24 14:09:43 +0200
commitac3b0e35977653d53cb96854986e8fca2b16ca69 (patch)
treeade184fd454f5be2b16693ebd5e38a6a6f55fc06 /lib/VNDB/Handler/Misc.pm
parentdefecb123e03d098283d53af02f2c494f90922aa (diff)
parentd1e395e4197c40b7fd26f1b2dcf75a96d4b2b99e (diff)
Merge branch 'beta'2.7
+ updated changelog
Diffstat (limited to 'lib/VNDB/Handler/Misc.pm')
-rw-r--r--lib/VNDB/Handler/Misc.pm261
1 files changed, 136 insertions, 125 deletions
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index ceae11ce..891a83f0 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -4,8 +4,9 @@ package VNDB::Handler::Misc;
use strict;
use warnings;
-use YAWF ':html', ':xml';
+use YAWF ':html', ':xml', 'xml_escape';
use VNDB::Func;
+use POSIX 'strftime';
YAWF::register(
@@ -36,23 +37,12 @@ YAWF::register(
sub homepage {
my $self = shift;
- $self->htmlHeader(title => $self->{site_title});
+ $self->htmlHeader(title => mt '_site_title');
div class => 'mainbox';
- h1 $self->{site_title};
+ h1 mt '_site_title';
p class => 'description';
- lit qq|
- VNDB.org strives to be a comprehensive database for information about visual novels and
- eroge.<br />
- This website is built as a wiki, meaning that anyone can freely add and contribute information
- to the database, allowing us to create the largest, most accurate and most up-to-date visual novel
- database on the web.<br />
- Registered users are also able to keep track of a personal list of games they want to play or have finished
- and they can vote on all visual novels.<br />
- <br />
- Feel free to <a href="/v/all">browse around</a>, <a href="/u/register">register an account</a>
- or to participate in the discussions about visual novels or VNDB on our <a href="/t">discussion board</a>.
- |;
+ lit mt '_home_intro';
end;
my $scr = $self->dbScreenshotRandom;
@@ -65,104 +55,121 @@ sub homepage {
end;
end;
- # Recent changes
- div class => 'mainbox threelayout';
- h1 'Recent changes';
- my $changes = $self->dbRevisionGet(what => 'item user', results => 10, auto => 1, hidden => 1);
- ul;
- for (@$changes) {
- my $t = (qw|v r p|)[$_->{type}];
- li;
- b "$t:";
- a href => "/$t$_->{iid}.$_->{rev}", title => $_->{ioriginal}||$_->{ititle}, shorten $_->{ititle}, 30;
- txt ' by ';
- a href => "/u$_->{requester}", $_->{username};
- end;
- }
- end;
- end;
+ table class => 'mainbox threelayout';
+ Tr;
- # Announcements
- div class => 'mainbox threelayout';
- my $an = $self->dbThreadGet(type => 'an', order => 't.id DESC', results => 2);
- a class => 'right', href => '/t/an', 'News archive';
- h1 'Announcements';
- for (@$an) {
- my $post = $self->dbPostGet(tid => $_->{id}, num => 1)->[0];
- h2;
- a href => "/t$_->{id}", $_->{title};
+ # Recent changes
+ td;
+ h1;
+ a href => '/hist', mt '_home_recentchanges';
end;
- p;
- lit bb2html $post->{msg}, 150;
+ 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}",
+ xml_escape($_->{ioriginal}||$_->{ititle}), xml_escape shorten $_->{ititle}, 33),
+ $_;
+ end;
+ }
end;
- }
- end;
+ end;
- # Recent posts
- div class => 'mainbox threelayout last';
- h1 'Recent posts';
- my $posts = $self->dbThreadGet(what => 'lastpost boardtitles', results => 10, order => 'tpl.date DESC', notusers => 1);
- ul;
- for (@$posts) {
- my $boards = join ', ', map $self->{discussion_boards}{$_->{type}}.($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}};
- li;
- txt age($_->{ldate}).' ';
- a href => "/t$_->{id}.$_->{count}", title => "Posted in $boards", shorten $_->{title}, 20;
- txt ' by ';
- a href => "/u$_->{luid}", $_->{lusername};
- end;
- }
- end;
- end;
+ # Announcements
+ td;
+ my $an = $self->dbThreadGet(type => 'an', order => 't.id DESC', results => 2);
+ h1;
+ a href => '/t/an', mt '_home_announcements';
+ end;
+ for (@$an) {
+ my $post = $self->dbPostGet(tid => $_->{id}, num => 1)->[0];
+ h2;
+ a href => "/t$_->{id}", $_->{title};
+ end;
+ p;
+ lit bb2html $post->{msg}, 150;
+ end;
+ }
+ end;
- # Random visual novels
- div class => 'mainbox threelayout';
- h1 'Random visual novels';
- my $random = $self->dbVNGet(results => 10, order => 'RANDOM()');
- ul;
- for (@$random) {
- li;
- a href => "/v$_->{id}", title => $_->{original}||$_->{title}, shorten $_->{title}, 40;
- end;
- }
- end;
- end;
+ # Recent posts
+ td;
+ h1;
+ a href => '/t', mt '_home_recentposts';
+ end;
+ my $posts = $self->dbThreadGet(what => 'lastpost boardtitles', results => 10, order => 'tpl.date DESC', notusers => 1);
+ ul;
+ for (@$posts) {
+ my $boards = join ', ', map mt("_dboard_$_->{type}").($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}};
+ li;
+ lit mt '_home_recentposts_item', $_->{ldate},
+ sprintf('<a href="%s" title="%s">%s</a>', "/t$_->{id}.$_->{count}",
+ xml_escape("Posted in $boards"), xml_escape shorten $_->{title}, 25),
+ {uid => $_->{luid}, username => $_->{lusername}};
+ end;
+ }
+ end;
+ end;
- # Upcoming releases
- div class => 'mainbox threelayout';
- h1 'Upcoming releases';
- my $upcoming = $self->dbReleaseGet(results => 10, unreleased => 1, what => 'platforms');
- ul;
- for (@$upcoming) {
- li;
- lit datestr $_->{released};
- txt ' ';
- cssicon $_, $self->{platforms}{$_} for (@{$_->{platforms}});
- txt ' ';
- a href => "/r$_->{id}", title => $_->{original}||$_->{title}, shorten $_->{title}, 30;
- end;
- }
end;
- end;
+ Tr;
+
+ # Random visual novels
+ td;
+ h1 mt '_home_randomvn';
+ my $random = $self->dbVNGet(results => 10, order => 'RANDOM()');
+ ul;
+ for (@$random) {
+ li;
+ a href => "/v$_->{id}", title => $_->{original}||$_->{title}, shorten $_->{title}, 40;
+ end;
+ }
+ end;
+ end;
- # Just released
- div class => 'mainbox threelayout last';
- h1 'Just released';
- my $justrel = $self->dbReleaseGet(results => 10, order => 'rr.released DESC', unreleased => 0, what => 'platforms');
- ul;
- for (@$justrel) {
- li;
- lit datestr $_->{released};
- txt ' ';
- cssicon $_, $self->{platforms}{$_} for (@{$_->{platforms}});
- txt ' ';
- a href => "/r$_->{id}", title => $_->{original}||$_->{title}, shorten $_->{title}, 30;
- end;
- }
- end;
- end;
+ # Upcoming releases
+ td;
+ h1;
+ a href => strftime('/r?mi=%Y%m%d;o=a;s=released', gmtime), mt '_home_upcoming';
+ end;
+ my $upcoming = $self->dbReleaseGet(results => 10, unreleased => 1, what => 'platforms');
+ ul;
+ for (@$upcoming) {
+ li;
+ lit $self->{l10n}->datestr($_->{released});
+ txt ' ';
+ cssicon $_, mt "_plat_$_" for (@{$_->{platforms}});
+ txt ' ';
+ a href => "/r$_->{id}", title => $_->{original}||$_->{title}, shorten $_->{title}, 30;
+ end;
+ }
+ end;
+ end;
+
+ # Just released
+ td;
+ h1;
+ a href => strftime('/r?ma=%Y%m%d;o=d;s=released', gmtime), mt '_home_justreleased';
+ end;
+ my $justrel = $self->dbReleaseGet(results => 10, order => 'rr.released DESC', unreleased => 0, what => 'platforms');
+ ul;
+ for (@$justrel) {
+ li;
+ lit $self->{l10n}->datestr($_->{released});
+ txt ' ';
+ cssicon $_, mt "_plat_$_" for (@{$_->{platforms}});
+ txt ' ';
+ a href => "/r$_->{id}", title => $_->{original}||$_->{title}, shorten $_->{title}, 30;
+ end;
+ }
+ end;
+ end;
+
+ end; # /tr
+ end; # /table
- clearfloat;
$self->htmlFooter;
}
@@ -187,7 +194,7 @@ sub history {
$type eq 'p' ? $self->dbProducerGet(id => $id)->[0] :
$type eq 'r' ? $self->dbReleaseGet(id => $id)->[0] :
$type eq 'v' ? $self->dbVNGet(id => $id)->[0] : undef;
- my $title = $type ? 'Edit history of '.($obj->{title} || $obj->{name} || $obj->{username}) : 'Recent changes';
+ my $title = mt $type ? ('_hist_title_item', $obj->{title} || $obj->{name} || $obj->{username}) : '_hist_title';
return 404 if $type && !$obj->{id};
# get the edit history
@@ -224,33 +231,33 @@ sub history {
h1 $title;
if($type ne 'u') {
p class => 'browseopts';
- a !$f->{m} ? (class => 'optselected') : (), href => $u->(m => 0), 'Show automated edits';
- a $f->{m} ? (class => 'optselected') : (), href => $u->(m => 1), 'Hide automated edits';
+ a !$f->{m} ? (class => 'optselected') : (), href => $u->(m => 0), mt '_hist_filter_showauto';
+ a $f->{m} ? (class => 'optselected') : (), href => $u->(m => 1), mt '_hist_filter_hideauto';
end;
}
if(!$type || $type eq 'u') {
if($self->authCan('del')) {
p class => 'browseopts';
- a $f->{h} == 1 ? (class => 'optselected') : (), href => $u->(h => 1), 'Hide deleted items';
- a $f->{h} == -1 ? (class => 'optselected') : (), href => $u->(h => -1), 'Show deleted items';
+ a $f->{h} == 1 ? (class => 'optselected') : (), href => $u->(h => 1), mt '_hist_filter_hidedel';
+ a $f->{h} == -1 ? (class => 'optselected') : (), href => $u->(h => -1), mt '_hist_filter_showdel';
end;
}
p class => 'browseopts';
- a !$f->{t} ? (class => 'optselected') : (), href => $u->(t => ''), 'Show all items';
- a $f->{t} eq 'v' ? (class => 'optselected') : (), href => $u->(t => 'v'), 'Only visual novels';
- a $f->{t} eq 'r' ? (class => 'optselected') : (), href => $u->(t => 'r'), 'Only releases';
- a $f->{t} eq 'p' ? (class => 'optselected') : (), href => $u->(t => 'p'), 'Only producers';
+ a !$f->{t} ? (class => 'optselected') : (), href => $u->(t => ''), mt '_hist_filter_alltypes';
+ a $f->{t} eq 'v' ? (class => 'optselected') : (), href => $u->(t => 'v'), mt '_hist_filter_onlyvn';
+ a $f->{t} eq 'r' ? (class => 'optselected') : (), href => $u->(t => 'r'), mt '_hist_filter_onlyreleases';
+ a $f->{t} eq 'p' ? (class => 'optselected') : (), href => $u->(t => 'p'), mt '_hist_filter_onlyproducers';
end;
p class => 'browseopts';
- a !$f->{e} ? (class => 'optselected') : (), href => $u->(e => 0), 'Show all changes';
- a $f->{e} == 1 ? (class => 'optselected') : (), href => $u->(e => 1), 'Only edits';
- a $f->{e} == -1 ? (class => 'optselected') : (), href => $u->(e => -1), 'Only newly created pages';
+ a !$f->{e} ? (class => 'optselected') : (), href => $u->(e => 0), mt '_hist_filter_allactions';
+ a $f->{e} == 1 ? (class => 'optselected') : (), href => $u->(e => 1), mt '_hist_filter_onlyedits';
+ a $f->{e} == -1 ? (class => 'optselected') : (), href => $u->(e => -1), mt '_hist_filter_onlynew';
end;
}
if($type eq 'v') {
p class => 'browseopts';
- a !$f->{r} ? (class => 'optselected') : (), href => $u->(r => 0), 'Exclude edits of releases';
- a $f->{r} ? (class => 'optselected') : (), href => $u->(r => 1), 'Include edits of releases';
+ a !$f->{r} ? (class => 'optselected') : (), href => $u->(r => 0), mt '_hist_filter_exrel';
+ a $f->{r} ? (class => 'optselected') : (), href => $u->(r => 1), mt '_hist_filter_increl';
end;
}
end;
@@ -263,7 +270,10 @@ sub history {
sub docpage {
my($self, $did) = @_;
- open my $F, '<', sprintf('%s/data/docs/%d', $VNDB::ROOT, $did) or return 404;
+ my $l = '.'.$self->{l10n}->language_tag();
+ my $f = sprintf('%s/data/docs/%d', $VNDB::ROOT, $did);
+ my $F;
+ open($F, '<:utf8', $f.$l) or open($F, '<:utf8', $f) or return 404;
my @c = <$F>;
close $F;
@@ -277,7 +287,8 @@ sub docpage {
qq|<h3><a href="#$sec" name="$sec">$sec. $1</a></h3>\n|
}eg;
s{^:INC:(.+)\r?\n$}{
- open $F, '<', sprintf('%s/data/docs/%s', $VNDB::ROOT, $1) or die $!;
+ $f = sprintf('%s/data/docs/%s', $VNDB::ROOT, $1);
+ open($F, '<:utf8', $f.$l) or open($F, '<:utf8', $f) or die $!;
my $ii = join('', <$F>);
close $F;
$ii;
@@ -297,13 +308,13 @@ sub docpage {
sub nospam {
my $self = shift;
- $self->htmlHeader(title => 'Could not send form', noindex => 1);
+ $self->htmlHeader(title => mt '_nospam_title', noindex => 1);
div class => 'mainbox';
- h1 'Could not send form';
+ h1 mt '_nospam_title';
div class => 'warning';
- h2 'Error';
- p 'The form could not be sent, please make sure you have Javascript enabled in your browser.';
+ h2 mt '_nospam_subtitle';
+ p mt '_nospam_msg';
end;
end;
@@ -354,7 +365,7 @@ sub ie6message {
end;
body;
div;
- h1 'Oops, we were too lazy support your browser!';
+ h1 'Oops, we were too lazy to support your browser!';
p;
lit qq|We decided to stop supporting Internet Explorer 6, as it's a royal pain in |
.qq|the ass to make our site look good in a browser that doesn't want to cooperate with us.<br />|