]> iEval git - plack-app-gruntmaster.git/blame - lib/Gruntmaster/Page/Pb/Entry.pm
Heeere's Plack/PSGI!
[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',
7b5883d1 12<tmpl_var ESCAPE=0 statement>
42546e6c 13
fe78f0c1 14<tmpl_if cansubmit>
42546e6c
MG
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>">
fe78f0c1 18<tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
42546e6c
MG
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">
6d28cb38 26</form>
fe78f0c1 27</tmpl_if>
42546e6c 28HTML
bb95f538 29};
42546e6c 30
bb95f538 31sub _generate{
7dc32473
MG
32 my ($self, $htc, $lang, $logger, $contest, $id) = @_;
33 debug $logger => "language is '$lang', contest is '$contest', id is '$id'";
cd9af27e
MG
34
35 $htc->param(cansubmit => 1);
36 if (defined $contest) {
9f8cf806 37 $htc->param(cansubmit => time <= contest_end $contest);
cd9af27e
MG
38 $htc->param(contest => $contest);
39 }
c2a23f84 40 $htc->param(formats => Gruntmaster::Page::Submit::FORMATS);
cd9af27e 41 $htc->param(id => $id);
3da9c3c2 42 local $Gruntmaster::Data::contest = $contest if $contest;
cd9af27e 43 $htc->param(name => problem_name $id);
2ee6edcf
MG
44 $htc->param(author => problem_author $id);
45 $htc->param(owner => problem_owner $id);
3da9c3c2 46 $htc->param(statement => problem_statement $id);
42546e6c
MG
47}
48
491
This page took 0.028599 seconds and 4 git commands to generate.