Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
232624b1 | 3 | | CiviCRM version 4.4 | |
6a488035 TO |
4 | +--------------------------------------------------------------------+ |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
6 | +--------------------------------------------------------------------+ | |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | {if $pager and $pager->_response} | |
27 | {if $pager->_response.numPages > 1} | |
28 | <div class="crm-pager"> | |
6a488035 TO |
29 | <span class="element-right"> |
30 | {if $location eq 'top'} | |
d8249fcb | 31 | {$pager->_response.titleTop} |
6a488035 | 32 | {else} |
d8249fcb | 33 | {$pager->_response.titleBottom} |
6a488035 TO |
34 | {/if} |
35 | </span> | |
d8249fcb | 36 | </span> |
6a488035 TO |
37 | <span class="crm-pager-nav"> |
38 | {$pager->_response.first} | |
39 | {$pager->_response.back} | |
40 | {$pager->_response.next} | |
f813f78e | 41 | {$pager->_response.last} |
42 | {$pager->_response.status} | |
6a488035 TO |
43 | </span> |
44 | ||
45 | </div> | |
46 | {/if} | |
f813f78e | 47 | |
6a488035 TO |
48 | {* Controller for 'Rows Per Page' *} |
49 | {if $location eq 'bottom' and $pager->_totalItems > 25} | |
50 | <div class="form-item float-right"> | |
f813f78e | 51 | <label>{ts}Rows per page:{/ts}</label> |
6a488035 TO |
52 | {$pager->_response.twentyfive} | |
53 | {$pager->_response.fifty} | | |
f813f78e | 54 | {$pager->_response.onehundred} |
6a488035 TO |
55 | </div> |
56 | <div class="clear"></div> | |
57 | {/if} | |
58 | ||
d8249fcb CW |
59 | {if $location neq 'top'} |
60 | <script type="text/javascript"> | |
61 | {literal} | |
62 | cj(function($) { | |
63 | {/literal} | |
64 | var $form = $('#{$form.formName}'); | |
65 | var numPages = {$pager->_response.numPages}; | |
66 | var currentPage = {$pager->_response.currentPage}; | |
67 | {literal} | |
68 | function refresh(url) { | |
69 | var options = url ? {url: url} : {}; | |
70 | $form.closest('.crm-ajax-container, #crm-main-content-wrapper').crmSnippet(options).crmSnippet('refresh'); | |
71 | } | |
72 | function page(num) { | |
73 | num = parseInt(num, 10); | |
74 | if (isNaN(num) || num < 1 || num > numPages || num === currentPage) { | |
75 | return; | |
76 | } | |
77 | var url = $('a.crm-pager-link', $form).attr('href'); | |
78 | refresh(url.replace(/crmPID=\d/, 'crmPID=' + num)); | |
79 | } | |
80 | $('input[name^=crmPID]', $form).spinner({ | |
81 | min: 1, | |
82 | max: numPages | |
83 | }) | |
84 | .on('change', function() { | |
85 | page($(this).spinner('value')); | |
86 | }); | |
87 | $form | |
88 | .on('click', 'a.ui-spinner-button', function(e) { | |
89 | page($(this).siblings('input[name^=crmPID]').spinner('value')); | |
90 | }) | |
91 | .on('click', 'a.crm-pager-link, #alpha-filter a', function() { | |
92 | refresh($(this).attr('href')); | |
93 | return false; | |
94 | }); | |
95 | }); | |
96 | {/literal} | |
97 | </script> | |
98 | {/if} | |
99 | ||
6a488035 | 100 | {/if} |