X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FCt%2FEntry.pm;h=83e270548c11002479eddd89c6845585a15cef64;hb=191f4979def520b8be01554eb954c80ee42df38b;hp=625020d8372e1ee0f01f8cb1e468c1c898c28b43;hpb=fe78f0c128c35e68e65850b02057997bad6717fe;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Ct/Entry.pm b/lib/Gruntmaster/Page/Ct/Entry.pm index 625020d..83e2705 100644 --- a/lib/Gruntmaster/Page/Ct/Entry.pm +++ b/lib/Gruntmaster/Page/Ct/Entry.pm @@ -3,49 +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 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 qw/header footer/; - -use constant TITLE => ''; - -my %templates = ( - en => <<'HTML', +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); - flock my $metafh = IO::File->new(" "language is '$lang' and id is '$id'"; - $htc->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 => $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