X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FCt%2FEntry.pm;h=97089b536852a57fa24243ec9d47578b5672216d;hb=dfe9fad19b62489af03cdd2fd29cc5057536b483;hp=3c336c17bd0939c7b36460194b1a831b76a3972d;hpb=cd9af27e94244e6454c3db787a8ca6811f44fc16;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Ct/Entry.pm b/lib/Gruntmaster/Page/Ct/Entry.pm index 3c336c1..97089b5 100644 --- a/lib/Gruntmaster/Page/Ct/Entry.pm +++ b/lib/Gruntmaster/Page/Ct/Entry.pm @@ -3,43 +3,30 @@ package Gruntmaster::Page::Ct::Entry; use 5.014000; use strict; use warnings; -use parent qw/Exporter/; -our @EXPORT_OK = qw/generate/; +use Gruntmaster::Page::Base ct_entry => ''; +our @ISA = qw/Gruntmaster::Page::Base/; our $VERSION = '0.001'; -use constant TITLE => ''; - -use HTML::Template::Compiled; -use POSIX qw/strftime/; -use Gruntmaster::Page::Common qw/header footer/; -use Gruntmaster::Data qw/contest_name contest_start contest_end/; - -my %templates = ( +use constant TEMPLATES => { en => <<'HTML', Contest start time:
Contest end time:

-Problems
-Job log
-Standings
+Problems
+Job log
+Standings
HTML -); - -$templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; -$templates{$_} .= footer $_ for keys %templates; +}; -sub generate{ - my ($path, $lang) = @_; - $path = ($path =~ m,ct/(.*)/index,)[0]; - my $template = $templates{$lang}; - my $htc = HTML::Template::Compiled->new(scalarref => \$template); +sub _generate{ + my ($self, $htc, $lang, $logger, $id) = @_; + debug $logger => "language is '$lang' and id is '$id'"; - $htc->param(id => $path); - $htc->param(name => contest_name $path); - $htc->param(start => strftime '%c', contest_start); - $htc->param(end => strftime '%c', contest_end); - $htc->param(started => time >= contest_start); - $htc->output + $htc->param(id => $id); + $htc->param(name => contest_name $id); + $htc->param(start => strftime '%c', localtime contest_start $id); + $htc->param(end => strftime '%c', localtime contest_end $id); + $htc->param(started => time >= contest_start $id); } 1