]>
iEval git - plack-app-gruntmaster.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
=> {
14 <table border class="table table-bordered table-striped">
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>"><tmpl_var id></a>
19 <td><a href="../pb/<tmpl_var problem>"><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>
27 <tmpl_if prev><li class="previous"><a href="<tmpl_var prev>">Previous</a></tmpl_if>
28 <tmpl_if next><li class="next"><a href="<tmpl_var next>">Next</a></tmpl_if>
34 my ($self, $htc, $lang, $logger, $ct, $page) = @_;
35 debug
$logger => "language is '$lang', contest is '$ct' and page is '$page'";
36 local $Gruntmaster::Data
::contest
= $ct if $ct;
38 my $pages = POSIX
::floor
(jobcard
/ PAGE_SIZE
);
42 my @log = sort { $b->{id
} <=> $a->{id
} } map +{
44 (job_private
() ?
(private
=> job_private
) : ()),
45 date
=> (job_date
() ? strftime
('%c' => localtime job_date
) : '?'),
46 extension
=> job_extension
,
47 name
=> problem_name job_problem
,
48 problem
=> job_problem
,
50 result_text
=> job_result_text
,
51 size
=> sprintf ("%.2f KiB", job_filesize
() / 1024),
52 user
=> job_user
}, ($page - 1) * PAGE_SIZE
+ 1 .. ($page == $pages ? jobcard
: $page * PAGE_SIZE
);
53 $htc->param(log => \
@log);
54 $htc->param(next => $page + 1) unless $page == $pages;
55 $htc->param(prev
=> $page - 1) unless $page == 1;
This page took 0.045004 seconds and 4 git commands to generate.