use 5.014000;
use strict;
use warnings;
-use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate/;
+use Gruntmaster::Page::Base ct_entry => '<tmpl_var name>';
+our @ISA = qw/Gruntmaster::Page::Base/;
our $VERSION = '0.001';
-use HTML::Template::Compiled;
-use POSIX qw/strftime/;
-use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
-use Gruntmaster::Data qw/contest_name contest_start contest_end/;
-
-my %orig_templates = (
+use constant TEMPLATES => {
en => <<'HTML',
Contest start time: <tmpl_var start><br>
Contest end time: <tmpl_var end><p>
-<tmpl_if started><a href="pb/">Problems</a><br>
-<a href="log/">Job log</a><br>
-<a href="log/st.var">Standings</a></tmpl_if>
+<tmpl_if started><a href="<tmpl_var id>/pb/">Problems</a><br>
+<a href="<tmpl_var id>/log/">Job log</a><br>
+<a href="<tmpl_var id>/log/st">Standings</a></tmpl_if>
HTML
-);
-
-my %templates = cook_templates %orig_templates, ct_entry => '<tmpl_var name>';
+};
-sub generate{
- %templates = cook_templates %orig_templates, ct_entry => '<tmpl_var name>' if reload_templates;
- 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