]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/kpac/parts/paginate.tt2
Move HTML tags out of translatable strings in toolkit templates.
[Evergreen.git] / Open-ILS / src / templates / kpac / parts / paginate.tt2
1 [%  # paging, weeee
2     page = CGI.param('page');
3     page = page.match('^\d+$') ? page : 0; # verify page is a sane value
4     page_count = ctx.page_size == 0 ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size);
5     ctx.result_start = 1 + ctx.page_size * page;
6     ctx.result_stop = ctx.page_size * (page + 1);
7     IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
8     result_count = ctx.result_start;
9 %]
10
11 <table cellpadding="0" cellspacing="0" border="0" width="100%">
12     <tr>
13         <!-- Next -->
14         <td>
15             [%  class = '';
16                 href = '#';
17                 IF page > 0;
18                     href = mkurl('', {page => page - 1});
19                 ELSE; class = class _ ' invisible'; END %]
20             <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_last.png" /></a>
21         </td>
22
23         <!-- page X of Y -->
24         <td width="100%" class="nav_mid_bg">
25             <table cellpadding="0" cellspacing="0" border="0" align="center">
26                 <tr>
27                     <td>[% l('Page [_1] of [_2]', '</td><td class="current_page">' _ (page + 1) _ '</td><td>', '</td><td class="total_pages">' _ page_count _ '</td>') %]</td>
28                 </tr>
29             </table>
30         </td>
31
32         <!-- Prev -->
33         <td class="to_top_btn">
34             [%  class = '';
35                 href = '#';
36                 IF (page + 1) < page_count;
37                     href = mkurl('', {page => page + 1});
38                 ELSE; class = class _ ' invisible'; END;
39             %]
40             <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_next.png" /></a>
41         </td>
42
43         <!-- Top of page -->
44         [% IF showtop %]
45             <td class="to_top_btn"><a href="[% mkurl('').replace('#.*', '') %]">
46                 <img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png" />
47             </a></td>
48         [% END %]
49     </tr>
50 </table>