]> iEval git - gruntmaster-page.git/blame - lib/Gruntmaster/Page/Pb/Entry.pm
Make all generators inherit from a common base
[gruntmaster-page.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
42546e6c 10use constant FORMATS => [qw/CPP/];
42546e6c 11
bb95f538 12use constant TEMPLATES => {
cd9af27e 13 en => <<'HTML',
42546e6c
MG
14<tmpl_var statement>
15
fe78f0c1 16<tmpl_if cansubmit>
42546e6c
MG
17<h1>Submit solution</h1>
18<form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data">
19<input type="hidden" name="problem" value="<tmpl_var id>">
fe78f0c1 20<tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
42546e6c
MG
21<label>File: <input name="prog" required type="file"></label>
22
23<label>File format: <select name="prog_format" required>
24<tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option>
25</tmpl_loop></select></label>
26
27<input type="submit" value="Submit job">
6d28cb38 28</form>
fe78f0c1 29</tmpl_if>
42546e6c 30HTML
bb95f538 31};
42546e6c 32
bb95f538
MG
33sub _generate{
34 my ($self, $htc, $path, $lang) = @_;
42546e6c 35
bb95f538 36 $path =~ m,(?:ct/([^/])+/)?pb/(\w+)\.html$,;
42546e6c 37
cd9af27e 38 my ($contest, $id) = ($1, $2);
cd9af27e
MG
39
40 $htc->param(cansubmit => 1);
41 if (defined $contest) {
42 $htc->param(cansubmit => time >= contest_start $contest && time <= contest_end $contest);
43 $htc->param(contest => $contest);
44 }
45 $htc->param(formats => FORMATS);
46 $htc->param(id => $id);
3da9c3c2 47 local $Gruntmaster::Data::contest = $contest if $contest;
cd9af27e 48 $htc->param(name => problem_name $id);
3da9c3c2 49 $htc->param(statement => problem_statement $id);
42546e6c
MG
50}
51
521
This page took 0.027823 seconds and 4 git commands to generate.