]>
iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Pb/Entry.pm
1 package Gruntmaster
::Page
::Pb
::Entry
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
10 use HTML
::Template
::Compiled
;
11 use POSIX qw
/strftime/;
12 use Gruntmaster
::Page
::Common qw
/cook_templates reload_templates/;
13 use Gruntmaster
::Data qw
/contest_start contest_end problem_name problem_statement/;
15 use constant FORMATS
=> [qw
/CPP/];
17 my %orig_templates = (
22 <h1>Submit solution</h1>
23 <form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data">
24 <input type="hidden" name="problem" value="<tmpl_var id>">
25 <tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
26 <label>File: <input name="prog" required type="file"></label>
28 <label>File format: <select name="prog_format" required>
29 <tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option>
30 </tmpl_loop></select></label>
32 <input type="submit" value="Submit job">
38 my %templates = cook_templates
%orig_templates, pb_entry
=> '<tmpl_var name>';
41 %templates = cook_templates
%orig_templates, pb_entry
=> '<tmpl_var name>' if reload_templates
;
42 $_[0] =~ m
,(?
:ct
/([^/])+/)?pb/(\w
+)\
.html
$,;
44 my ($contest, $id) = ($1, $2);
45 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$templates{$_[1]});
47 $htc->param(cansubmit
=> 1);
48 if (defined $contest) {
49 $htc->param(cansubmit
=> time >= contest_start
$contest && time <= contest_end
$contest);
50 $htc->param(contest
=> $contest);
52 $htc->param(formats
=> FORMATS
);
53 $htc->param(id
=> $id);
54 local $Gruntmaster::Data
::contest
= $contest if $contest;
55 $htc->param(name
=> problem_name
$id);
56 $htc->param(statement
=> problem_statement
$id);
This page took 0.0488 seconds and 5 git commands to generate.