]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Submit.pm
Remove some languages
[gruntmaster-page.git] / lib / Gruntmaster / Page / Submit.pm
index a57b7b177b05d52f27e77eb0aa219f254f77a320..344661b142ee74f0800b1e32d3f89594c1ed01d6 100644 (file)
@@ -3,21 +3,14 @@ package Gruntmaster::Page::Submit;
 use 5.014000;
 use strict;
 use warnings;
-use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate/;
+use Gruntmaster::Page::Base submit => 'Submit job';
+our @ISA = qw/Gruntmaster::Page::Base/;
 our $VERSION = '0.001';
 
-use constant FORMATS => [qw/CPP/];
-use constant TITLE => 'Submit job';
+use constant FORMATS => [qw/C CPP JAVA PERL PYTHON/];
 
-use Fcntl qw/:flock/;
-use HTML::Template::Compiled;
-use IO::File;
-use YAML::Any qw/LoadFile/;
-use Gruntmaster::Page::Common qw/header footer/;
-
-my %templates = (
-  en => <<'HTML',
+use constant TEMPLATES => {
+       en => <<'HTML',
 <form action="https://gm.ieval.ro/action/submit" method="POST" enctype="multipart/form-data">
 <label>Problem:<br>
 <select name="problem" required>
@@ -34,23 +27,14 @@ my %templates = (
 
 <input type="submit" value="Submit job">
 HTML
-);
-
-$templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
-$templates{$_} .= footer $_ for keys %templates;
-
-sub generate{
-  my $template = $templates{$_[1]};
-  my $htc = HTML::Template::Compiled->new(scalarref => \$template);
-  IO::File->new('>meta.yml')->close unless -f 'meta.yml';
-  flock my $metafh = IO::File->new('<meta.yml'), LOCK_SH;
-  my @problems = map {
-       my $meta = LoadFile $_;
-       my $id = (m,^pb/(.*)/meta.yml$,)[0];
-       +{ id => $id, name => $meta->{name} } } <pb/*/meta.yml>;
-  $htc->param(problems => \@problems);
-  $htc->param(formats => FORMATS);
-  $htc->output
+};
+
+sub _generate{
+       my ($self, $htc, $path, $lang) = @_;
+
+       my @problems = map +{ id => $_, name => problem_name }, problems;
+       $htc->param(problems => \@problems);
+       $htc->param(formats => FORMATS);
 }
 
 1
This page took 0.02426 seconds and 4 git commands to generate.