1 package Gruntmaster
::Page
::Log
;
6 use Gruntmaster
::Page
::Base
log => 'Job log';
7 our @ISA = qw
/Gruntmaster::Page::Base/;
8 our $VERSION = '0.001';
10 use constant PAGE_SIZE
=> 10;
12 use constant FORMAT_EXTENSION
=> {
16 use constant TEMPLATES
=> {
20 <tr><th>ID<th>Problem<th>Date<th>Size<th>User<th>Result
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>
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>
33 my ($self, $htc, $path, $lang) = @_;
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;
40 my @log = sort { $b->{id
} <=> $a->{id
} } map +{
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
,
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);