]>
iEval git - plack-app-gruntmaster.git/blob - Page/Pb.pm
1 package Gruntmaster
::Page
::Pb
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
11 use HTML
::Template
::Compiled
;
13 use POSIX qw
/strftime/;
14 use Gruntmaster
::Page
::Common qw
/cook_templates reload_templates/;
15 use Gruntmaster
::Data qw
/problem_name problem_level problems/;
17 my %orig_templates = (
22 <tmpl_loop beginner><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
27 <tmpl_loop easy><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
32 <tmpl_loop medium><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
37 <tmpl_loop hard><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
42 <tmpl_loop problems><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
48 my %templates = cook_templates
%orig_templates, pb
=> 'Problems';
51 %templates = cook_templates
%orig_templates, pb
=> 'Problems' if reload_templates
;
52 $_[0] =~ m
,^(?
:ct
/([^/]+)/)?pb/index
.html
$,;
53 local $Gruntmaster::Data
::contest
= $1;
55 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$templates{$_[1]});
56 my @problems = sort { $b->{name
} cmp $a->{name
} } map +{
59 level
=> problem_level
}, problems
;
60 for my $d (qw
/beginner easy medium advanced hard/) {
61 $htc->param($d => [grep {$_->{level
} and $_->{level
} eq $d} @problems]);
63 $htc->param(levels
=> grep { $_->{level
} } @problems);
64 $htc->param(problems
=> \
@problems);
This page took 0.046792 seconds and 4 git commands to generate.