]> iEval git - gruntmaster-page.git/blame_incremental - lib/Gruntmaster/Page/Pb/Entry.pm
Add gensrc
[gruntmaster-page.git] / lib / Gruntmaster / Page / Pb / Entry.pm
... / ...
CommitLineData
1package Gruntmaster::Page::Pb::Entry;
2
3use 5.014000;
4use strict;
5use warnings;
6use Gruntmaster::Page::Base pb_entry => '<tmpl_var name>';
7our @ISA = qw/Gruntmaster::Page::Base/;
8our $VERSION = '0.001';
9
10use constant TEMPLATES => {
11 en => <<'HTML',
12<tmpl_var ESCAPE=0 statement>
13
14<tmpl_if cansubmit>
15<h1>Submit solution</h1>
16<form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data">
17<input type="hidden" name="problem" value="<tmpl_var id>">
18<tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
19<label>File: <input name="prog" required type="file"></label>
20
21<label>File format: <select name="prog_format" required>
22<tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option>
23</tmpl_loop></select></label>
24
25<input type="submit" value="Submit job">
26</form>
27</tmpl_if>
28HTML
29};
30
31sub _generate{
32 my ($self, $htc, $path, $lang) = @_;
33
34 $path =~ m,(?:ct/([^/])+/)?pb/(\w+)\.html$,;
35
36 my ($contest, $id) = ($1, $2);
37
38 $htc->param(cansubmit => 1);
39 if (defined $contest) {
40 $htc->param(cansubmit => time >= contest_start $contest && time <= contest_end $contest);
41 $htc->param(contest => $contest);
42 }
43 $htc->param(formats => Gruntmaster::Page::Submit::FORMATS);
44 $htc->param(id => $id);
45 local $Gruntmaster::Data::contest = $contest if $contest;
46 $htc->param(name => problem_name $id);
47 $htc->param(statement => problem_statement $id);
48}
49
501
This page took 0.022441 seconds and 4 git commands to generate.