]> iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Pb/Entry.pm
Heeere's Plack/PSGI!
[gruntmaster-page.git] / lib / Gruntmaster / Page / Pb / Entry.pm
1 package Gruntmaster::Page::Pb::Entry;
2
3 use 5.014000;
4 use strict;
5 use warnings;
6 use Gruntmaster::Page::Base pb_entry => '<tmpl_var name>';
7 our @ISA = qw/Gruntmaster::Page::Base/;
8 our $VERSION = '0.001';
9
10 use 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>
28 HTML
29 };
30
31 sub _generate{
32 my ($self, $htc, $lang, $logger, $contest, $id) = @_;
33 debug $logger => "language is '$lang', contest is '$contest', id is '$id'";
34
35 $htc->param(cansubmit => 1);
36 if (defined $contest) {
37 $htc->param(cansubmit => time <= contest_end $contest);
38 $htc->param(contest => $contest);
39 }
40 $htc->param(formats => Gruntmaster::Page::Submit::FORMATS);
41 $htc->param(id => $id);
42 local $Gruntmaster::Data::contest = $contest if $contest;
43 $htc->param(name => problem_name $id);
44 $htc->param(author => problem_author $id);
45 $htc->param(owner => problem_owner $id);
46 $htc->param(statement => problem_statement $id);
47 }
48
49 1
This page took 0.0419580000000001 seconds and 5 git commands to generate.