]> iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Log.pm
Do not escape problem statement
[gruntmaster-page.git] / lib / Gruntmaster / Page / Log.pm
1 package Gruntmaster::Page::Log;
2
3 use 5.014000;
4 use strict;
5 use warnings;
6 use Gruntmaster::Page::Base log => 'Job log';
7 our @ISA = qw/Gruntmaster::Page::Base/;
8 our $VERSION = '0.001';
9
10 use constant PAGE_SIZE => 10;
11
12 use constant FORMAT_EXTENSION => {
13 CPP => 'cpp',
14 };
15
16 use constant TEMPLATES => {
17 en => <<'HTML',
18 <table border>
19 <thead>
20 <tr><th>ID<th>Problem<th>Date<th>Size<th>User<th>Result
21 <tbody>
22 <tmpl_loop log><tr><td><a href="job/<tmpl_var id>.var"><tmpl_var id></a>
23 <td><a href="../pb/<tmpl_var problem>"><tmpl_var name></a>
24 <td><tmpl_var date>
25 <td><a href="src/<tmpl_var id>.<tmpl_var extension>"<tmpl_if private> data-private</tmpl_if>><tmpl_var size></a></a>
26 <td><tmpl_var user><td class="r<tmpl_var result>"><tmpl_var result_text>
27 </tmpl_loop>
28 </table>
29 HTML
30 };
31
32 sub _generate{
33 my ($self, $htc, $path, $lang) = @_;
34
35 $path =~ m,^(?:ct/([^/]+)/)?log/(\w+)\.html$,;
36 local $Gruntmaster::Data::contest = $1;
37 my $pages = jobcard / PAGE_SIZE;
38 my $page = $2 eq 'index' ? $pages : $2;
39
40 my @log = sort { $b->{id} <=> $a->{id} } map +{
41 id => $_,
42 (job_private() ? (private => job_private) : ()),
43 date => (job_date() ? strftime ('%c' => localtime job_date) : '?'),
44 extension => job_extension,
45 name => problem_name job_problem,
46 problem => job_problem,
47 result => job_result,
48 result_text => job_result_text,
49 size => sprintf ("%.2f KiB", job_filesize() / 1024),
50 user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. $page == $pages ? jobcard : $page * PAGE_SIZE;
51 $htc->param(log => \@log);
52 }
53
54 1
This page took 0.048056 seconds and 4 git commands to generate.