12f5e747bebc7452d25060b7a84c739204120b8b
[gruntmaster-page.git] / lib / Gruntmaster / Page / Pb / Entry.pm
1 package Gruntmaster::Page::Pb::Entry;
2
3 use Gruntmaster::Page::Base pb_entry => '<tmpl_var name>';
4
5 use constant FORMATS => [qw/C CPP JAVA PERL PYTHON/];
6
7 sub _generate{
8 my ($self, $htc, $lang, $env, $contest, $id) = @_;
9 debug $env => "language is '$lang', contest is '$contest', id is '$id'";
10 my $user = $env->{REMOTE_USER};
11 if ($contest && $user && time >= contest_start $contest) {
12 local $Gruntmaster::Data::contest = $contest;
13 mark_open $id, $user;
14 debug $env => "Marking problem $id of contest $contest open by $user";
15 }
16
17 $htc->param(cansubmit => 1);
18 if ($contest) {
19 $htc->param(cansubmit => time <= contest_end $contest);
20 $htc->param(contest => $contest);
21 }
22 $htc->param(formats => FORMATS);
23 $htc->param(id => $id);
24 local $Gruntmaster::Data::contest = $contest if $contest;
25 $htc->param(name => problem_name $id);
26 $htc->param(author => problem_author $id);
27 $htc->param(owner => problem_owner $id);
28 $htc->param(owner_name => do{ local $Gruntmaster::Data::contest; user_name $htc->param('owner')} );
29 $htc->param(statement => problem_statement $id);
30 }
31
32 sub vary { 'Authorization' }
33 sub max_age { 600 }
34
35 1
This page took 0.023296 seconds and 3 git commands to generate.