@@ -, +, @@ should return just C4/Output.pm and opac templates (I'll deal with it on another bugs) --- acqui/neworderbiblio.pl | 8 ++- authorities/authorities-home.pl | 11 ++-- cataloguing/addbooks.pl | 9 +++- .../value_builder/marc21_linking_section.pl | 8 --- cataloguing/value_builder/unimarc_field_210c.pl | 19 ++++--- cataloguing/value_builder/unimarc_field_4XX.pl | 8 --- .../intranet-tmpl/prog/en/includes/pagination.inc | 60 ++++++++++++++++++++++ .../prog/en/modules/acqui/neworderbiblio.tt | 4 +- .../prog/en/modules/admin/matching-rules.tt | 2 - .../prog/en/modules/admin/patron-attr-types.tt | 2 - .../en/modules/authorities/searchresultlist.tt | 4 +- .../prog/en/modules/cataloguing/addbooks.tt | 2 +- .../value_builder/unimarc_field_210c.tt | 10 ++-- .../en/modules/reports/guided_reports_start.tt | 1 - .../prog/en/modules/reviews/reviewswaiting.tt | 4 +- .../intranet-tmpl/prog/en/modules/tags/review.tt | 6 +-- .../prog/en/modules/virtualshelves/shelves.tt | 5 +- reports/guided_reports.pl | 3 +- reviews/reviewswaiting.pl | 9 +++- tags/review.pl | 7 +-- virtualshelves/shelves.pl | 12 +++-- 21 files changed, 130 insertions(+), 64 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/pagination.inc --- a/acqui/neworderbiblio.pl +++ a/acqui/neworderbiblio.pl @@ -144,6 +144,12 @@ foreach my $r (@{$budgets}) { last; } +my $pagination = { + base_url => "/cgi-bin/koha/acqui/neworderbiblio.pl?q=$query&booksellerid=$booksellerid&basketno=$basketno&page=", + pages => getnbpages( $total_hits, $results_per_page ), + current_page => $page, +}; + $template->param( has_budgets => $has_budgets, basketno => $basketno, @@ -152,7 +158,7 @@ $template->param( resultsloop => \@results, total => $total_hits, query => $query, - pagination_bar => pagination_bar( "/cgi-bin/koha/acqui/neworderbiblio.pl?q=$query&booksellerid=$booksellerid&basketno=$basketno&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ), + pagination => $pagination, ); # BUILD THE TEMPLATE --- a/authorities/authorities-home.pl +++ a/authorities/authorities-home.pl @@ -188,11 +188,14 @@ if ( $op eq "do_search" ) { $template->param( result => $results ) if $results; + my $pagination = { + base_url => "$base_url&startfrom=", + pages => getnbpages( $total, $resultsperpage ), + current_page => $startfrom, + }; + $template->param( - pagination_bar => pagination_bar( - $base_url, int( $total / $resultsperpage ) + 1, - $startfrom, 'startfrom' - ), + pagination => $pagination, total => $total, from => $from, to => $to, --- a/cataloguing/addbooks.pl +++ a/cataloguing/addbooks.pl @@ -90,11 +90,18 @@ if ($query) { # SimpleSearch() give the results per page we want, so 0 offet here my $total = @{$marcresults}; my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, $marcresults ); + + my $pagination = { + base_url => "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&page=", + pages => getnbpages( $total_hits, $results_per_page ), + current_page => $page, + }; + $template->param( total => $total_hits, query => $query, resultsloop => \@newresults, - pagination_bar => pagination_bar( "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ), + pagination => $pagination, ); } --- a/cataloguing/value_builder/marc21_linking_section.pl +++ a/cataloguing/value_builder/marc21_linking_section.pl @@ -274,14 +274,6 @@ my $launcher = sub { # foreach my $sort (@sort_by){ # $link.="&sort_by=".$sort."&"; # } - # $template->param( - # pagination_bar => pagination_bar( - # $link, - # getnbpages($hits, $results_per_page), - # $page, - # 'page' - # ), - # ); $template->param( result => \@arrayresults, index => scalar $query->param('index') . "", --- a/cataloguing/value_builder/unimarc_field_210c.pl +++ a/cataloguing/value_builder/unimarc_field_210c.pl @@ -107,18 +107,25 @@ my ($input) = @_; $template->param(result => $results) if $results; $template->param('index' => scalar $query->param('index')); + + my $pagination = { + base_url => "$link&startfrom=", + pages => getnbpages($total, $resultsperpage), + current_page => $startfrom, + }; $template->param( + startfrom=> $startfrom, + displaynext=> $displaynext, + displayprev=> $displayprev, + resultsperpage => $resultsperpage, + startfromnext => $startfrom+1, + startfromprev => $startfrom-1, total=>$total, from=>$from, to=>$to, authtypecode =>$authtypecode, resultstring =>$value[0], - pagination_bar => pagination_bar( - $link, - getnbpages($total, $resultsperpage), - $startfrom, - 'startfrom' - ), + pagination => $pagination, ); } else { ($template, $loggedinuser, $cookie) --- a/cataloguing/value_builder/unimarc_field_4XX.pl +++ a/cataloguing/value_builder/unimarc_field_4XX.pl @@ -476,14 +476,6 @@ sub plugin { # foreach my $sort (@sort_by){ # $link.="&sort_by=".$sort."&"; # } -# $template->param( -# pagination_bar => pagination_bar( -# $link, -# getnbpages($hits, $results_per_page), -# $page, -# 'page' -# ), -# ); $template->param( result => \@arrayresults, index => scalar $query->param('index') . "", --- a/koha-tmpl/intranet-tmpl/prog/en/includes/pagination.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/pagination.inc @@ -0,0 +1,60 @@ +[%# this is template for generating pagination %] +[%# it needed an array named "pagination" with this structure: %] +[%# pagination.pages => total number of pages %] +[%# pagination.base_url => url with all needed parameters and with parameter specifiyng page at the end %] +[%# pagination.current_page => number of current active page %] + +[% IF pagination && ( pagination.pages > 1 ) %] + + + +[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt @@ -21,8 +21,8 @@ [% IF ( total ) %] -[% total %] results found -
[% pagination_bar %]
+ [% total %] results found + [% INCLUDE 'pagination.inc' %] [% ELSE %]

No results found

--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt @@ -465,8 +465,6 @@ [% END %] [% ELSE %]

There are no saved matching rules.

[% END %] -
[% pagination_bar %]
- [% END %] [% IF ( matching_rule_form ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -20,7 +20,7 @@
[% IF ( total ) %] -
[% pagination_bar %]
+[% INCLUDE 'pagination.inc' %]

Results [% from %] to [% to %] of [% total %] @@ -70,7 +70,7 @@ -

[% pagination_bar %]
+[% INCLUDE 'pagination.inc' %] [% ELSE %] No results found --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -61,7 +61,7 @@ [% total %] result(s) found in catalog, [% breeding_count %] result(s) found in reservoir -
[% pagination_bar %]
+[% INCLUDE 'pagination.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt @@ -42,9 +42,8 @@ [% IF ( total ) %]

Authority search results

-
- [% pagination_bar %] -
[% END %] + [% INCLUDE 'pagination.inc' %] + [% END %]

[% IF ( total ) %]  Results [% from %] to [% to %] of [% total %]

@@ -75,9 +74,8 @@ [% END %] - [% IF ( total ) %]

- [% pagination_bar %] -
+ [% IF ( total ) %] + [% INCLUDE 'pagination.inc' %] [% END %] [% MACRO jsinclude BLOCK %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -713,7 +713,6 @@ canned reports and writing custom SQL reports.

-
[% pagination_bar %]
[% UNLESS ( errors ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt @@ -60,13 +60,15 @@ [% END %]
-
[% pagination_bar %]
+ [% ELSE %] [% IF ( status ) %]

No comments have been approved.

[% ELSE %]

No comments to moderate.

[% END %] [% END %]
+[% INCLUDE 'pagination.inc' %] +
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt @@ -65,11 +65,7 @@ tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; } [% END %]
[% END %] - [% IF ( pagination_bar ) %] -
- [% pagination_bar %] -
- [% END %] + [% IF ( tagloop ) %]

--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -129,7 +129,7 @@ [% IF itemsloop %]

Contents of [% shelf.shelfname | html %]

-
[% pagination_bar %]
+ @@ -160,6 +160,7 @@ [% END %] + [% INCLUDE 'pagination.inc' %]
[% IF ( itemsloop ) %][% END %] @@ -243,7 +244,7 @@ [% END %]
 
-
[% pagination_bar %]
+ [% INCLUDE 'pagination.inc' %] [% END %] --- a/reports/guided_reports.pl +++ a/reports/guided_reports.pl @@ -813,11 +813,11 @@ elsif ($phase eq 'Run this report'){ } } - my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&phase=Run%20this%20report&limit=$limit"; if (@sql_params) { $url = join('&sql_params=', $url, map { URI::Escape::uri_escape_utf8($_) } @sql_params); } + $template->param( 'results' => \@rows, 'sql' => $sql, @@ -827,7 +827,6 @@ elsif ($phase eq 'Run this report'){ 'name' => $name, 'notes' => $notes, 'errors' => defined($errors) ? [ $errors ] : undef, - 'pagination_bar' => pagination_bar($url, $totpages, scalar $input->param('page')), 'unlimited_total' => $total, 'sql_params' => \@sql_params, ); --- a/reviews/reviewswaiting.pl +++ a/reviews/reviewswaiting.pl @@ -22,6 +22,7 @@ use C4::Auth; use C4::Output; use C4::Context; use C4::Biblio; +use C4::Koha; use Koha::Biblios; use Koha::Patrons; use Koha::Reviews; @@ -81,10 +82,16 @@ for my $review ( @$reviews ) { my $url = "/cgi-bin/koha/reviews/reviewswaiting.pl?status=$status"; +my $pagination = { + base_url => "$url&page=", + pages => getnbpages( $total, $count ), + current_page => $page, +}; + $template->param( status => $status, reviews => $reviews, - pagination_bar => pagination_bar( $url, ( int( $total / $count ) ) + ( ( $total % $count ) > 0 ? 1 : 0 ), $page, "page" ) + pagination => $pagination, ); output_html_with_http_headers $query, $cookie, $template->output; --- a/tags/review.pl +++ a/tags/review.pl @@ -29,7 +29,7 @@ use C4::Auth qw(:DEFAULT check_cookie_auth); use C4::Context; use Koha::DateUtils; # use C4::Koha; -use C4::Output qw(:html :ajax pagination_bar); +use C4::Output qw(:html :ajax); use C4::Debug; use C4::Tags qw(get_tags get_approval_rows approval_counts whitelist blacklist is_approved); @@ -210,6 +210,7 @@ $qstring =~ s/^;+//; # remove leading delims $qstring = "limit=$pagesize" . ($qstring ? '&' . $qstring : ''); $debug and print STDERR "number of approval_rows: " . scalar(@$tagloop) . "rows\n"; (scalar @errors) and $template->param(message_loop=>\@errors); + $template->param( offset => $offset, # req'd for EXPR op => $op, @@ -217,10 +218,6 @@ $template->param( script_name => $script_name, approved => 0, # dummy value (also EXPR) tagloop => $tagloop, - pagination_bar => pagination_bar( - "$script_name?$qstring\&", - ceil($counts->{approved_total}/$pagesize), # $page, 'page' - ) ); output_html_with_http_headers $input, $cookie, $template->output; --- a/virtualshelves/shelves.pl +++ a/virtualshelves/shelves.pl @@ -327,11 +327,15 @@ if ( $op eq 'view' ) { ); if ( $page ) { my $pager = $contents->pager; + + my $pagination = { + base_url => "?op=view&shelfnumber=" . $shelf->shelfnumber . "&sortfield=$sortfield&direction=$direction&page=", + pages => $pager->last_page - $pager->first_page + 1, + current_page => $page, + }; + $template->param( - pagination_bar => pagination_bar( - q||, $pager->last_page - $pager->first_page + 1, - $page, "page", { op => 'view', shelfnumber => $shelf->shelfnumber, sortfield => $sortfield, direction => $direction, } - ), + pagination => $pagination, ); } } else { --