]>
iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Log.pm
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 TEMPLATES
=> {
16 <tr><th>ID<th>Problem<th>Date<th>Size<th>User<th>Result
18 <tmpl_loop log><tr><td><a href="job/<tmpl_var id>.var"><tmpl_var id></a>
19 <td><a href="/pb/<tmpl_var problem>.var"><tmpl_var name></a>
21 <td><a href="src/<tmpl_var id>.<tmpl_var extension>"<tmpl_if private> data-private</tmpl_if>><tmpl_var size></a>
22 <td><tmpl_var user><td class="r<tmpl_var result>"><tmpl_var result_text>
26 <tmpl_if prev><a href="<tmpl_var prev>.var">Prev page</a></tmpl_if>
27 <tmpl_if next><a href="<tmpl_var next>.var">Next page</a></tmpl_if>
32 my ($self, $htc, $path, $lang) = @_;
34 $path =~ m
,^(?
:ct
/([^/]+)/)?log/(\w
+)\
.html
$,;
35 local $Gruntmaster::Data
::contest
= $1 if $1;
36 my $pages = POSIX
::floor
(jobcard
/ PAGE_SIZE
);
37 my $page = $2 eq 'index' ?
$pages : $2;
39 my @log = sort { $b->{id
} <=> $a->{id
} } map +{
41 (job_private
() ?
(private
=> job_private
) : ()),
42 date
=> (job_date
() ? strftime
('%c' => localtime job_date
) : '?'),
43 extension
=> job_extension
,
44 name
=> problem_name job_problem
,
45 problem
=> job_problem
,
47 result_text
=> job_result_text
,
48 size
=> sprintf ("%.2f KiB", job_filesize
() / 1024),
49 user
=> job_user
}, ($page - 1) * PAGE_SIZE
+ 1 .. ($page == $pages ? jobcard
: $page * PAGE_SIZE
);
50 $htc->param(log => \
@log);
51 $htc->param(next => $page + 1) unless $page == $pages;
52 $htc->param(prev
=> $page - 1) unless $page == 1;
This page took 0.050043 seconds and 4 git commands to generate.