X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FCt%2FEntry.pm;h=3c336c17bd0939c7b36460194b1a831b76a3972d;hb=cd9af27e94244e6454c3db787a8ca6811f44fc16;hp=725e3e9ef9aaf222dfb3973612142fe5764d67e4;hpb=6d28cb383168de84cebad84aa43900844341bf5d;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Ct/Entry.pm b/lib/Gruntmaster/Page/Ct/Entry.pm index 725e3e9..3c336c1 100644 --- a/lib/Gruntmaster/Page/Ct/Entry.pm +++ b/lib/Gruntmaster/Page/Ct/Entry.pm @@ -7,19 +7,15 @@ use parent qw/Exporter/; our @EXPORT_OK = qw/generate/; our $VERSION = '0.001'; -use Fcntl qw/:flock/; +use constant TITLE => ''; + 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 => ''; +use Gruntmaster::Data qw/contest_name contest_start contest_end/; my %templates = ( - en => <<'HTML', + en => <<'HTML', Contest start time:
Contest end time:

@@ -33,19 +29,17 @@ $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); - 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 + my ($path, $lang) = @_; + $path = ($path =~ m,ct/(.*)/index,)[0]; + my $template = $templates{$lang}; + my $htc = HTML::Template::Compiled->new(scalarref => \$template); + + $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 } 1