]>
iEval git - plack-app-gruntmaster.git/blob - Gruntmaster/Page/Submit.pm
1 package Gruntmaster
::Page
::Submit
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
10 use constant FORMATS
=> [qw
/CPP/];
11 use constant TITLE
=> 'Submit job';
14 use HTML
::Template
::Compiled
;
16 use YAML
::Any qw
/LoadFile/;
17 use Gruntmaster
::Page qw
/header footer/;
21 <form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data">
23 <select name="problem" required>
24 <tmpl_loop problems><option value="<tmpl_var id>"><tmpl_var name></option>
25 </tmpl_loop></select></label><p>
28 <input name="prog" required type="file"></label><p>
30 <label>File format:<br>
31 <select name="prog_format" required>
32 <tmpl_loop formats><option value="<tmpl_var _>"><tmpl_var _></option>
33 </tmpl_loop></select></label><p>
35 <input type="submit" value="Submit job">
39 $templates{$_} = header
($_, TITLE
) . $templates{$_} for keys %templates;
40 $templates{$_} .= footer
$_ for keys %templates;
43 my $template = $templates{$_[1]};
44 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$template);
45 IO
::File
->new('>meta.yml')->close unless -f
'meta.yml';
46 flock my $metafh = IO
::File
->new('<meta.yml'), LOCK_SH
;
48 my $meta = LoadFile
$_;
49 my $id = (m
,^pb
/(.*)/meta
.yml
$,)[0];
50 +{ id
=> $id, name
=> $meta->{name
} } } <pb
/*/meta
.yml
>;
51 $htc->param(problems
=> \
@problems);
52 $htc->param(formats
=> FORMATS
);
This page took 0.05089 seconds and 4 git commands to generate.