]> iEval git - plack-app-gruntmaster.git/blob - lib/Gruntmaster/Page/Pb/Entry.pm
Modernize templates
[plack-app-gruntmaster.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 <div class="row">
13 <div class="col-md-9">
14 <tmpl_var ESCAPE=0 statement>
15 </div>
16
17 <div class="col-md-3">
18 <tmpl_if cansubmit>
19 <h1>Submit solution</h1>
20 <form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data" role="form">
21 <input type="hidden" name="problem" value="<tmpl_var id>">
22 <tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
23
24 <div class="form-group"><label for="prog">File:</label><input id="prog" name="prog" required type="file"></div>
25 <div class="form-group"><label for="source_code">Source code:</label> <textarea class="form-control" id="source_code" name="source_code"></textarea></div>
26 <div class="form-group"><label for="prog_format">File format:</label><select id="prog_format" name="prog_format" class="form-control" required>
27 <tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option>
28 </tmpl_loop></select></div>
29
30 <input type="submit" value="Submit job" class="btn btn-primary">
31 </form>
32 </tmpl_if>
33 </div>
34 HTML
35 };
36
37 sub _generate{
38 my ($self, $htc, $lang, $logger, $contest, $id) = @_;
39 debug $logger => "language is '$lang', contest is '$contest', id is '$id'";
40
41 $htc->param(cansubmit => 1);
42 if ($contest) {
43 $htc->param(cansubmit => time <= contest_end $contest);
44 $htc->param(contest => $contest);
45 }
46 $htc->param(formats => Gruntmaster::Page::Submit::FORMATS);
47 $htc->param(id => $id);
48 local $Gruntmaster::Data::contest = $contest if $contest;
49 $htc->param(name => problem_name $id);
50 $htc->param(author => problem_author $id);
51 $htc->param(owner => problem_owner $id);
52 $htc->param(statement => problem_statement $id);
53 }
54
55 1
This page took 0.043671 seconds and 4 git commands to generate.