View | Details | Raw Unified | Return to bug 18008
Collapse All | Expand All

(-)a/acqui/neworderbiblio.pl (-1 / +7 lines)
Lines 144-149 foreach my $r (@{$budgets}) { Link Here
144
    last;
144
    last;
145
}
145
}
146
146
147
my $pagination = {
148
    base_url     => "/cgi-bin/koha/acqui/neworderbiblio.pl?q=$query&booksellerid=$booksellerid&basketno=$basketno&page=",
149
    pages        => getnbpages( $total_hits, $results_per_page ),
150
    current_page => $page,
151
};
152
147
$template->param(
153
$template->param(
148
    has_budgets          => $has_budgets,
154
    has_budgets          => $has_budgets,
149
    basketno             => $basketno,
155
    basketno             => $basketno,
Lines 152-158 $template->param( Link Here
152
    resultsloop          => \@results,
158
    resultsloop          => \@results,
153
    total                => $total_hits,
159
    total                => $total_hits,
154
    query                => $query,
160
    query                => $query,
155
    pagination_bar       => pagination_bar( "/cgi-bin/koha/acqui/neworderbiblio.pl?q=$query&booksellerid=$booksellerid&basketno=$basketno&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ),
161
    pagination           => $pagination,
156
);
162
);
157
163
158
# BUILD THE TEMPLATE
164
# BUILD THE TEMPLATE
(-)a/authorities/authorities-home.pl (-4 / +7 lines)
Lines 188-198 if ( $op eq "do_search" ) { Link Here
188
188
189
    $template->param( result => $results ) if $results;
189
    $template->param( result => $results ) if $results;
190
190
191
    my $pagination = {
192
        base_url     => "$base_url&startfrom=",
193
        pages        => getnbpages( $total, $resultsperpage ),
194
        current_page => $startfrom,
195
    };
196
191
    $template->param(
197
    $template->param(
192
        pagination_bar => pagination_bar(
198
        pagination => $pagination,
193
            $base_url,  int( $total / $resultsperpage ) + 1,
194
            $startfrom, 'startfrom'
195
        ),
196
        total     => $total,
199
        total     => $total,
197
        from      => $from,
200
        from      => $from,
198
        to        => $to,
201
        to        => $to,
(-)a/cataloguing/addbooks.pl (-1 / +8 lines)
Lines 90-100 if ($query) { Link Here
90
    # SimpleSearch() give the results per page we want, so 0 offet here
90
    # SimpleSearch() give the results per page we want, so 0 offet here
91
    my $total = @{$marcresults};
91
    my $total = @{$marcresults};
92
    my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, $marcresults );
92
    my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, $marcresults );
93
94
    my $pagination = {
95
        base_url     => "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&page=",
96
        pages        => getnbpages( $total_hits, $results_per_page ),
97
        current_page => $page,
98
    };
99
93
    $template->param(
100
    $template->param(
94
        total          => $total_hits,
101
        total          => $total_hits,
95
        query          => $query,
102
        query          => $query,
96
        resultsloop    => \@newresults,
103
        resultsloop    => \@newresults,
97
        pagination_bar => pagination_bar( "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ),
104
        pagination     => $pagination,
98
    );
105
    );
99
}
106
}
100
107
(-)a/cataloguing/value_builder/marc21_linking_section.pl (-8 lines)
Lines 274-287 my $launcher = sub { Link Here
274
        #           foreach my $sort (@sort_by){
274
        #           foreach my $sort (@sort_by){
275
        #             $link.="&sort_by=".$sort."&";
275
        #             $link.="&sort_by=".$sort."&";
276
        #           }
276
        #           }
277
        #           $template->param(
278
        #             pagination_bar => pagination_bar(
279
        #                     $link,
280
        #                     getnbpages($hits, $results_per_page),
281
        #                     $page,
282
        #                     'page'
283
        #             ),
284
        #           );
285
        $template->param(
277
        $template->param(
286
            result         => \@arrayresults,
278
            result         => \@arrayresults,
287
            index          => scalar $query->param('index') . "",
279
            index          => scalar $query->param('index') . "",
(-)a/cataloguing/value_builder/unimarc_field_210c.pl (-6 / +13 lines)
Lines 107-124 my ($input) = @_; Link Here
107
107
108
        $template->param(result => $results) if $results;
108
        $template->param(result => $results) if $results;
109
        $template->param('index' => scalar $query->param('index'));
109
        $template->param('index' => scalar $query->param('index'));
110
111
        my $pagination = {
112
            base_url     => "$link&startfrom=",
113
            pages        => getnbpages($total, $resultsperpage),
114
            current_page => $startfrom,
115
        };
110
        $template->param(
116
        $template->param(
117
                                startfrom=> $startfrom,
118
                                displaynext=> $displaynext,
119
                                displayprev=> $displayprev,
120
                                resultsperpage => $resultsperpage,
121
                                startfromnext => $startfrom+1,
122
                                startfromprev => $startfrom-1,
111
                                total=>$total,
123
                                total=>$total,
112
                                from=>$from,
124
                                from=>$from,
113
                                to=>$to,
125
                                to=>$to,
114
                                authtypecode =>$authtypecode,
126
                                authtypecode =>$authtypecode,
115
                                resultstring =>$value[0],
127
                                resultstring =>$value[0],
116
                                pagination_bar => pagination_bar(
128
                                pagination => $pagination,
117
                                    $link,
118
                                    getnbpages($total, $resultsperpage),
119
                                    $startfrom,
120
                                    'startfrom'
121
                                ),
122
                                );
129
                                );
123
    } else {
130
    } else {
124
        ($template, $loggedinuser, $cookie)
131
        ($template, $loggedinuser, $cookie)
(-)a/cataloguing/value_builder/unimarc_field_4XX.pl (-8 lines)
Lines 476-489 sub plugin { Link Here
476
#           foreach my $sort (@sort_by){
476
#           foreach my $sort (@sort_by){
477
#             $link.="&sort_by=".$sort."&";
477
#             $link.="&sort_by=".$sort."&";
478
#           }
478
#           }
479
#           $template->param(
480
#             pagination_bar => pagination_bar(
481
#                     $link,
482
#                     getnbpages($hits, $results_per_page),
483
#                     $page,
484
#                     'page'
485
#             ),
486
#           );
487
        $template->param(
479
        $template->param(
488
            result         => \@arrayresults,
480
            result         => \@arrayresults,
489
            index          => scalar $query->param('index') . "",
481
            index          => scalar $query->param('index') . "",
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/pagination.inc (+60 lines)
Line 0 Link Here
1
[%# this is template for generating pagination %]
2
[%# it needed an array named "pagination" with this structure: %]
3
[%#     pagination.pages => total number of pages %]
4
[%#     pagination.base_url => url with all needed parameters and with parameter specifiyng page at the end %]
5
[%#     pagination.current_page => number of current active page %]
6
7
[% IF pagination && ( pagination.pages > 1 ) %]
8
9
<nav><ul class="pagination">
10
[% IF pagination.current_page != 1 %]
11
    <li><a href="[% pagination.base_url %][% pagination.current_page - 1 %]">&laquo; Previous</a></li>
12
[% END %]
13
14
[% IF pagination.pages > 8 %]
15
    [% start_page = pagination.current_page - 3 %]
16
    [% end_page = pagination.current_page + 4 %]
17
    [% IF start_page < 1 %]
18
       [% start_page = 1 %]
19
       [% end_page = 8 %]
20
    [% END %]
21
    [% IF end_page > pagination.pages %]
22
        [% start_page = pagination.pages - 7 %]
23
        [% end_page = pagination.pages %]
24
    [% END %]
25
[% ELSE %]
26
    [% start_page = 1 %]
27
    [% end_page = pagination.pages %]
28
[% END %]
29
30
[% IF start_page > 1 %]
31
    <li><a href="[% pagination.base_url %]1">1</a></li>
32
    [% IF start_page != 2 %]
33
      <li class="disabled"><span>&hellip;</span></li>
34
    [% END %]
35
[% END %]
36
37
[% page_number = start_page %]
38
[% WHILE page_number <= end_page %]
39
    [% IF page_number == pagination.current_page %]
40
        <li class="active"><a href="[% pagination.base_url %][% page_number %]">[% page_number %]</a></li>
41
    [% ELSE %]
42
        <li><a href="[% pagination.base_url %][% page_number %]">[% page_number %]</a></li>
43
    [% END %]
44
    [% page_number = page_number + 1  %]
45
[% END %]
46
47
[% IF end_page < pagination.pages %]
48
    [% IF end_page != pagination.pages - 1 %]
49
        <li class="disabled"><span>&hellip;</span></li>
50
    [% END %]
51
    <li><a href="[% pagination.base_url %][% pagination.pages %]">[% pagination.pages %]</a></li>
52
[% END %]
53
54
[% IF pagination.current_page != pagination.pages %]
55
    <li><a href="[% pagination.base_url %][% pagination.current_page + 1 %]">Next &raquo;</a></li>
56
[% END %]
57
58
</ul></nav>
59
60
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt (-2 / +2 lines)
Lines 21-28 Link Here
21
21
22
22
23
[% IF ( total ) %]
23
[% IF ( total ) %]
24
<b>[% total %] results found </b> 
24
    <b>[% total %] results found </b>
25
<div class="pages">[% pagination_bar %]</div>
25
    [% INCLUDE 'pagination.inc' %]
26
[% ELSE %]
26
[% ELSE %]
27
<h3> No results found</h3>
27
<h3> No results found</h3>
28
<p>
28
<p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt (-2 lines)
Lines 465-472 Link Here
465
  [% END %]
465
  [% END %]
466
</table>[% ELSE %]<p>There are no saved matching rules.</p>[% END %]
466
</table>[% ELSE %]<p>There are no saved matching rules.</p>[% END %]
467
467
468
<div class="pages">[% pagination_bar %]</div>
469
470
[% END %]
468
[% END %]
471
 [% IF ( matching_rule_form ) %]
469
 [% IF ( matching_rule_form ) %]
472
<div id="mp_template" class="matchgroup" style="display:none;">
470
<div id="mp_template" class="matchgroup" style="display:none;">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-2 lines)
Lines 287-294 Link Here
287
  <p>There are no saved patron attribute types.</p>
287
  <p>There are no saved patron attribute types.</p>
288
[% END %]
288
[% END %]
289
289
290
<div class="pages">[% pagination_bar %]</div>
291
292
[% END %]
290
[% END %]
293
 
291
 
294
</div>
292
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt (-2 / +2 lines)
Lines 20-26 Link Here
20
20
21
<div id="merge_in_progress"></div>
21
<div id="merge_in_progress"></div>
22
[% IF ( total ) %]
22
[% IF ( total ) %]
23
<div class="pages">[% pagination_bar %]</div>
23
[% INCLUDE 'pagination.inc' %]
24
24
25
<p id="authorities_searchresultlist_current_page_info">
25
<p id="authorities_searchresultlist_current_page_info">
26
  Results [% from %] to [% to %] of [% total %]
26
  Results [% from %] to [% to %] of [% total %]
Lines 70-76 Link Here
70
  </table>
70
  </table>
71
</div>
71
</div>
72
72
73
<div class="pages">[% pagination_bar %]</div>
73
[% INCLUDE 'pagination.inc' %]
74
74
75
[% ELSE %]
75
[% ELSE %]
76
  No results found
76
  No results found
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt (-1 / +1 lines)
Lines 61-67 Link Here
61
    [% total %] result(s) found in catalog,
61
    [% total %] result(s) found in catalog,
62
    <a href="#searchresult-breeding">[% breeding_count %] result(s) found in reservoir</a>
62
    <a href="#searchresult-breeding">[% breeding_count %] result(s) found in reservoir</a>
63
</div>
63
</div>
64
<div class="pages">[% pagination_bar %]</div>
64
[% INCLUDE 'pagination.inc' %]
65
<div class="searchresults">
65
<div class="searchresults">
66
    <table>
66
    <table>
67
        <tr>
67
        <tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt (-6 / +4 lines)
Lines 42-50 Link Here
42
        </form>
42
        </form>
43
            [% IF ( total ) %]
43
            [% IF ( total ) %]
44
            <h3>Authority search results</h3>
44
            <h3>Authority search results</h3>
45
            <div class="pages">
45
            [% INCLUDE 'pagination.inc' %]
46
                          [% pagination_bar %]      
46
            [% END %]
47
                        </div>[% END %]
48
            <p>
47
            <p>
49
                [% IF ( total ) %]
48
                [% IF ( total ) %]
50
                    &nbsp;<b>Results [% from %] to [% to %] of [% total %]</b><br /><br />
49
                    &nbsp;<b>Results [% from %] to [% to %] of [% total %]</b><br /><br />
Lines 75-83 Link Here
75
        </div>
74
        </div>
76
[% END %]
75
[% END %]
77
76
78
            [% IF ( total ) %]<div class="pages">
77
            [% IF ( total ) %]
79
                          [% pagination_bar %]      
78
                [% INCLUDE 'pagination.inc' %]
80
                        </div>
81
            [% END %]
79
            [% END %]
82
80
83
[% MACRO jsinclude BLOCK %]
81
[% MACRO jsinclude BLOCK %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-1 lines)
Lines 713-719 canned reports and writing custom SQL reports.</p> Link Here
713
    </select>
713
    </select>
714
</form>
714
</form>
715
715
716
<div class="pages">[% pagination_bar %]</div>
717
[% UNLESS ( errors ) %]
716
[% UNLESS ( errors ) %]
718
    <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="report_results">
717
    <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="report_results">
719
        <input type="hidden" name="op" value="show" />
718
        <input type="hidden" name="op" value="show" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt (-1 / +3 lines)
Lines 60-72 Link Here
60
    </tr>
60
    </tr>
61
    [% END %]</tbody>
61
    [% END %]</tbody>
62
</table>
62
</table>
63
 <div class="pages">[% pagination_bar %]</div>
63
64
[% ELSE %]
64
[% ELSE %]
65
[% IF ( status ) %]<p><b>No comments have been approved.</b></p>[% ELSE %]<p><b>No comments to moderate.</b></p>[% END %]
65
[% IF ( status ) %]<p><b>No comments have been approved.</b></p>[% ELSE %]<p><b>No comments to moderate.</b></p>[% END %]
66
[% END %]
66
[% END %]
67
</div>
67
</div>
68
</div>
68
</div>
69
69
70
[% INCLUDE 'pagination.inc' %]
71
70
</div>
72
</div>
71
</div>
73
</div>
72
<div class="yui-b">
74
<div class="yui-b">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt (-5 / +1 lines)
Lines 65-75 tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; } Link Here
65
        [% END %]
65
        [% END %]
66
  </div>
66
  </div>
67
  [% END %]
67
  [% END %]
68
  [% IF ( pagination_bar ) %]
68
69
  <div class="pages" id="pagination_top">
70
  	[% pagination_bar %]
71
  </div>
72
  [% END %]
73
  [% IF ( tagloop ) %]
69
  [% IF ( tagloop ) %]
74
  <p class="check"></p>
70
  <p class="check"></p>
75
  <table id="tagst">
71
  <table id="tagst">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-2 / +3 lines)
Lines 129-135 Link Here
129
    [% IF itemsloop %]
129
    [% IF itemsloop %]
130
130
131
    <h3>Contents of <i>[% shelf.shelfname | html %]</i></h3>
131
    <h3>Contents of <i>[% shelf.shelfname | html %]</i></h3>
132
    <div class="pages">[% pagination_bar %]</div>
132
133
    <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post" class="checkboxed">
133
    <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post" class="checkboxed">
134
        <input type="hidden" name="op" value="remove_biblios" />
134
        <input type="hidden" name="op" value="remove_biblios" />
135
        <input type="hidden" name="referer" value="view" />
135
        <input type="hidden" name="referer" value="view" />
Lines 160-165 Link Here
160
    [% END %]
160
    [% END %]
161
</div>
161
</div>
162
162
163
    [% INCLUDE 'pagination.inc' %]
163
    <table id="searchresults">
164
    <table id="searchresults">
164
            <tr>
165
            <tr>
165
                [% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
166
                [% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
Lines 243-249 Link Here
243
			</tr>
244
			</tr>
244
		[% END %]<!-- /itemsloop -->
245
		[% END %]<!-- /itemsloop -->
245
    </table>
246
    </table>
246
    <div class="pages">[% pagination_bar %]</div>
247
    [% INCLUDE 'pagination.inc' %]
247
</form>
248
</form>
248
249
249
	[% END %]
250
	[% END %]
(-)a/reports/guided_reports.pl (-2 / +1 lines)
Lines 813-823 elsif ($phase eq 'Run this report'){ Link Here
813
                }
813
                }
814
            }
814
            }
815
815
816
            my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0);
817
            my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&amp;phase=Run%20this%20report&amp;limit=$limit";
816
            my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&amp;phase=Run%20this%20report&amp;limit=$limit";
818
            if (@sql_params) {
817
            if (@sql_params) {
819
                $url = join('&amp;sql_params=', $url, map { URI::Escape::uri_escape_utf8($_) } @sql_params);
818
                $url = join('&amp;sql_params=', $url, map { URI::Escape::uri_escape_utf8($_) } @sql_params);
820
            }
819
            }
820
821
            $template->param(
821
            $template->param(
822
                'results' => \@rows,
822
                'results' => \@rows,
823
                'sql'     => $sql,
823
                'sql'     => $sql,
Lines 827-833 elsif ($phase eq 'Run this report'){ Link Here
827
                'name'    => $name,
827
                'name'    => $name,
828
                'notes'   => $notes,
828
                'notes'   => $notes,
829
                'errors'  => defined($errors) ? [ $errors ] : undef,
829
                'errors'  => defined($errors) ? [ $errors ] : undef,
830
                'pagination_bar'  => pagination_bar($url, $totpages, scalar $input->param('page')),
831
                'unlimited_total' => $total,
830
                'unlimited_total' => $total,
832
                'sql_params'      => \@sql_params,
831
                'sql_params'      => \@sql_params,
833
            );
832
            );
(-)a/reviews/reviewswaiting.pl (-1 / +8 lines)
Lines 22-27 use C4::Auth; Link Here
22
use C4::Output;
22
use C4::Output;
23
use C4::Context;
23
use C4::Context;
24
use C4::Biblio;
24
use C4::Biblio;
25
use C4::Koha;
25
use Koha::Biblios;
26
use Koha::Biblios;
26
use Koha::Patrons;
27
use Koha::Patrons;
27
use Koha::Reviews;
28
use Koha::Reviews;
Lines 81-90 for my $review ( @$reviews ) { Link Here
81
82
82
my $url = "/cgi-bin/koha/reviews/reviewswaiting.pl?status=$status";
83
my $url = "/cgi-bin/koha/reviews/reviewswaiting.pl?status=$status";
83
84
85
my $pagination = {
86
    base_url     => "$url&page=",
87
    pages        => getnbpages( $total, $count ),
88
    current_page => $page,
89
};
90
84
$template->param(
91
$template->param(
85
    status => $status,
92
    status => $status,
86
    reviews => $reviews,
93
    reviews => $reviews,
87
    pagination_bar => pagination_bar( $url, ( int( $total / $count ) ) + ( ( $total % $count ) > 0 ? 1 : 0 ), $page, "page" )
94
    pagination => $pagination,
88
);
95
);
89
96
90
output_html_with_http_headers $query, $cookie, $template->output;
97
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/tags/review.pl (-5 / +2 lines)
Lines 29-35 use C4::Auth qw(:DEFAULT check_cookie_auth); Link Here
29
use C4::Context;
29
use C4::Context;
30
use Koha::DateUtils;
30
use Koha::DateUtils;
31
# use C4::Koha;
31
# use C4::Koha;
32
use C4::Output qw(:html :ajax pagination_bar);
32
use C4::Output qw(:html :ajax);
33
use C4::Debug;
33
use C4::Debug;
34
use C4::Tags qw(get_tags get_approval_rows approval_counts whitelist blacklist is_approved);
34
use C4::Tags qw(get_tags get_approval_rows approval_counts whitelist blacklist is_approved);
35
35
Lines 210-215 $qstring =~ s/^;+//; # remove leading delims Link Here
210
$qstring = "limit=$pagesize" . ($qstring ? '&amp;' . $qstring : '');
210
$qstring = "limit=$pagesize" . ($qstring ? '&amp;' . $qstring : '');
211
$debug and print STDERR "number of approval_rows: " . scalar(@$tagloop) . "rows\n";
211
$debug and print STDERR "number of approval_rows: " . scalar(@$tagloop) . "rows\n";
212
(scalar @errors) and $template->param(message_loop=>\@errors);
212
(scalar @errors) and $template->param(message_loop=>\@errors);
213
213
$template->param(
214
$template->param(
214
	offset => $offset,	# req'd for EXPR
215
	offset => $offset,	# req'd for EXPR
215
	op => $op,
216
	op => $op,
Lines 217-226 $template->param( Link Here
217
	script_name => $script_name,
218
	script_name => $script_name,
218
	approved => 0,		# dummy value (also EXPR)
219
	approved => 0,		# dummy value (also EXPR)
219
	tagloop => $tagloop,
220
	tagloop => $tagloop,
220
	pagination_bar => pagination_bar(
221
		"$script_name?$qstring\&amp;",
222
		ceil($counts->{approved_total}/$pagesize),	# $page, 'page'
223
	)
224
);
221
);
225
222
226
output_html_with_http_headers $input, $cookie, $template->output;
223
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/virtualshelves/shelves.pl (-5 / +8 lines)
Lines 327-337 if ( $op eq 'view' ) { Link Here
327
            );
327
            );
328
            if ( $page ) {
328
            if ( $page ) {
329
                my $pager = $contents->pager;
329
                my $pager = $contents->pager;
330
331
                my $pagination = {
332
                    base_url     => "?op=view&shelfnumber=" . $shelf->shelfnumber . "&sortfield=$sortfield&direction=$direction&page=",
333
                    pages        => $pager->last_page - $pager->first_page + 1,
334
                    current_page => $page,
335
                };
336
330
                $template->param(
337
                $template->param(
331
                    pagination_bar => pagination_bar(
338
                    pagination => $pagination,
332
                        q||, $pager->last_page - $pager->first_page + 1,
333
                        $page, "page", { op => 'view', shelfnumber => $shelf->shelfnumber, sortfield => $sortfield, direction => $direction, }
334
                    ),
335
                );
339
                );
336
            }
340
            }
337
        } else {
341
        } else {
338
- 

Return to bug 18008