]>
Commit | Line | Data |
---|---|---|
42546e6c MG |
1 | package Gruntmaster::Page::Pb::Entry; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
bb95f538 MG |
6 | use Gruntmaster::Page::Base pb_entry => '<tmpl_var name>'; |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
42546e6c MG |
8 | our $VERSION = '0.001'; |
9 | ||
bb95f538 | 10 | use constant TEMPLATES => { |
cd9af27e | 11 | en => <<'HTML', |
a94f8453 MG |
12 | <div class="row"> |
13 | <div class="col-md-9"> | |
7b5883d1 | 14 | <tmpl_var ESCAPE=0 statement> |
a94f8453 | 15 | </div> |
42546e6c | 16 | |
a94f8453 | 17 | <div class="col-md-3"> |
8d29b3b1 | 18 | <dl> |
0a9ccdd8 MG |
19 | <dt>Author</dt> <dd><tmpl_var author></dd> |
20 | <dt>Owner</dt> <dd><tmpl_var owner></dd> | |
21 | </dl> | |
22 | ||
fe78f0c1 | 23 | <tmpl_if cansubmit> |
42546e6c | 24 | <h1>Submit solution</h1> |
8d29b3b1 | 25 | <form action="<tmpl_var id>/submit" method="POST" enctype="multipart/form-data" role="form"> |
42546e6c | 26 | <input type="hidden" name="problem" value="<tmpl_var id>"> |
fe78f0c1 | 27 | <tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined> |
42546e6c | 28 | |
8d29b3b1 | 29 | <div class="form-group"><label for="prog">File:</label><input id="prog" name="prog" type="file"></div> |
a94f8453 MG |
30 | <div class="form-group"><label for="source_code">Source code:</label> <textarea class="form-control" id="source_code" name="source_code"></textarea></div> |
31 | <div class="form-group"><label for="prog_format">File format:</label><select id="prog_format" name="prog_format" class="form-control" required> | |
42546e6c | 32 | <tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option> |
a94f8453 | 33 | </tmpl_loop></select></div> |
42546e6c | 34 | |
a94f8453 | 35 | <input type="submit" value="Submit job" class="btn btn-primary"> |
6d28cb38 | 36 | </form> |
fe78f0c1 | 37 | </tmpl_if> |
a94f8453 | 38 | </div> |
42546e6c | 39 | HTML |
bb95f538 | 40 | }; |
42546e6c | 41 | |
8d29b3b1 MG |
42 | use constant FORMATS => [qw/C CPP MONO JAVA PASCAL PERL PYTHON/]; |
43 | ||
bb95f538 | 44 | sub _generate{ |
191f4979 MG |
45 | my ($self, $htc, $lang, $env, $contest, $id) = @_; |
46 | debug $env => "language is '$lang', contest is '$contest', id is '$id'"; | |
cd9af27e MG |
47 | |
48 | $htc->param(cansubmit => 1); | |
a94f8453 | 49 | if ($contest) { |
9f8cf806 | 50 | $htc->param(cansubmit => time <= contest_end $contest); |
cd9af27e MG |
51 | $htc->param(contest => $contest); |
52 | } | |
8d29b3b1 | 53 | $htc->param(formats => FORMATS); |
cd9af27e | 54 | $htc->param(id => $id); |
3da9c3c2 | 55 | local $Gruntmaster::Data::contest = $contest if $contest; |
cd9af27e | 56 | $htc->param(name => problem_name $id); |
2ee6edcf MG |
57 | $htc->param(author => problem_author $id); |
58 | $htc->param(owner => problem_owner $id); | |
3da9c3c2 | 59 | $htc->param(statement => problem_statement $id); |
42546e6c MG |
60 | } |
61 | ||
62 | 1 |