]> iEval git - gruntmaster-page.git/blame - lib/Gruntmaster/Page/Ct/Entry.pm
Use zeptojs instead of jquery and load form.js
[gruntmaster-page.git] / lib / Gruntmaster / Page / Ct / Entry.pm
CommitLineData
fe78f0c1
MG
1package Gruntmaster::Page::Ct::Entry;
2
3use 5.014000;
4use strict;
5use warnings;
6use parent qw/Exporter/;
7our @EXPORT_OK = qw/generate/;
8our $VERSION = '0.001';
9
cd9af27e
MG
10use constant TITLE => '<tmpl_var name>';
11
fe78f0c1 12use HTML::Template::Compiled;
fe78f0c1 13use POSIX qw/strftime/;
832cb45e 14use Gruntmaster::Page::Common qw/header footer/;
cd9af27e 15use Gruntmaster::Data qw/contest_name contest_start contest_end/;
fe78f0c1
MG
16
17my %templates = (
cd9af27e 18 en => <<'HTML',
fe78f0c1
MG
19Contest start time: <tmpl_var start><br>
20Contest end time: <tmpl_var end><p>
21
22<tmpl_if started><a href="pb/">Problems</a><br>
23<a href="log/">Job log</a><br>
5bbf0128 24<a href="log/st.var">Standings</a></tmpl_if>
fe78f0c1
MG
25HTML
26);
27
28$templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates;
29$templates{$_} .= footer $_ for keys %templates;
30
31sub generate{
cd9af27e
MG
32 my ($path, $lang) = @_;
33 $path = ($path =~ m,ct/(.*)/index,)[0];
34 my $template = $templates{$lang};
35 my $htc = HTML::Template::Compiled->new(scalarref => \$template);
36
37 $htc->param(id => $path);
38 $htc->param(name => contest_name $path);
39 $htc->param(start => strftime '%c', contest_start);
40 $htc->param(end => strftime '%c', contest_end);
41 $htc->param(started => time >= contest_start);
42 $htc->output
fe78f0c1
MG
43}
44
451
This page took 0.026626 seconds and 4 git commands to generate.