X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FCt%2FEntry.pm;h=9414de8465daffd927e3e7125d7c1335b931184e;hb=e9e5c8a440a6e3a088a4b9330650e310561ef518;hp=725e3e9ef9aaf222dfb3973612142fe5764d67e4;hpb=5bbf0128012c09c78462ee49b874f968385b0978;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Ct/Entry.pm b/lib/Gruntmaster/Page/Ct/Entry.pm index 725e3e9..9414de8 100644 --- a/lib/Gruntmaster/Page/Ct/Entry.pm +++ b/lib/Gruntmaster/Page/Ct/Entry.pm @@ -3,23 +3,12 @@ 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 Fcntl qw/:flock/; -use HTML::Template::Compiled; -use IO::File; -use POSIX qw/strftime/; -use YAML::Any qw/LoadFile/; -use File::Basename qw/fileparse/; -use File::Slurp qw/slurp/; -use Gruntmaster::Page::Common qw/header footer/; - -use constant TITLE => ''; - -my %templates = ( - en => <<'HTML', +use constant TEMPLATES => { + en => <<'HTML', Contest start time:
Contest end time:

@@ -27,25 +16,18 @@ Contest end time:

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