]> iEval git - plack-app-gruntmaster.git/blame - lib/Gruntmaster/Page/Pb/Entry.pm
Modernize templates
[plack-app-gruntmaster.git] / lib / Gruntmaster / Page / Pb / Entry.pm
CommitLineData
42546e6c
MG
1package Gruntmaster::Page::Pb::Entry;
2
3use 5.014000;
4use strict;
5use warnings;
bb95f538
MG
6use Gruntmaster::Page::Base pb_entry => '<tmpl_var name>';
7our @ISA = qw/Gruntmaster::Page::Base/;
42546e6c
MG
8our $VERSION = '0.001';
9
bb95f538 10use 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">
fe78f0c1 18<tmpl_if cansubmit>
42546e6c 19<h1>Submit solution</h1>
a94f8453 20<form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data" role="form">
42546e6c 21<input type="hidden" name="problem" value="<tmpl_var id>">
fe78f0c1 22<tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
42546e6c 23
a94f8453
MG
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>
42546e6c 27<tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option>
a94f8453 28</tmpl_loop></select></div>
42546e6c 29
a94f8453 30<input type="submit" value="Submit job" class="btn btn-primary">
6d28cb38 31</form>
fe78f0c1 32</tmpl_if>
a94f8453 33</div>
42546e6c 34HTML
bb95f538 35};
42546e6c 36
bb95f538 37sub _generate{
7dc32473
MG
38 my ($self, $htc, $lang, $logger, $contest, $id) = @_;
39 debug $logger => "language is '$lang', contest is '$contest', id is '$id'";
cd9af27e
MG
40
41 $htc->param(cansubmit => 1);
a94f8453 42 if ($contest) {
9f8cf806 43 $htc->param(cansubmit => time <= contest_end $contest);
cd9af27e
MG
44 $htc->param(contest => $contest);
45 }
c2a23f84 46 $htc->param(formats => Gruntmaster::Page::Submit::FORMATS);
cd9af27e 47 $htc->param(id => $id);
3da9c3c2 48 local $Gruntmaster::Data::contest = $contest if $contest;
cd9af27e 49 $htc->param(name => problem_name $id);
2ee6edcf
MG
50 $htc->param(author => problem_author $id);
51 $htc->param(owner => problem_owner $id);
3da9c3c2 52 $htc->param(statement => problem_statement $id);
42546e6c
MG
53}
54
551
This page took 0.037708 seconds and 4 git commands to generate.