]> iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Pb/Entry.pm
2dd0a7b5674afa577350a7da7551a7eaa61605ca
[gruntmaster-page.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 <tmpl_var ESCAPE=0 statement>
13
14 <tmpl_if cansubmit>
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>">
18 <tmpl_if_defined contest><input type="hidden" name="contest" value="<tmpl_var contest>"></tmpl_if_defined>
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">
26 </form>
27 </tmpl_if>
28 HTML
29 };
30
31 sub _generate{
32 my ($self, $htc, $path, $lang) = @_;
33
34 $path =~ m,(?:ct/([^/]+)/)?pb/(\w+)\.html$,;
35
36 my ($contest, $id) = ($1, $2);
37
38 $htc->param(cansubmit => 1);
39 if (defined $contest) {
40 $htc->param(cansubmit => time <= contest_end $contest);
41 $htc->param(contest => $contest);
42 }
43 $htc->param(formats => Gruntmaster::Page::Submit::FORMATS);
44 $htc->param(id => $id);
45 local $Gruntmaster::Data::contest = $contest if $contest;
46 $htc->param(name => problem_name $id);
47 $htc->param(author => problem_author $id);
48 $htc->param(owner => problem_owner $id);
49 $htc->param(statement => problem_statement $id);
50 }
51
52 1
This page took 0.062146 seconds and 3 git commands to generate.