Browse Source

(bug #3355) add pagination in bib search for subscriptions

This add the support of pagination, delete a javascript call, and use now a get method(why post was used?).

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
3.2.x
Nahuel ANGELINETTI 15 years ago
committed by Galen Charlton
parent
commit
34426697c5
  1. 18
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/result.tmpl
  2. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tmpl
  3. 17
      serials/subscription-bib-search.pl

18
koha-tmpl/intranet-tmpl/prog/en/modules/serials/result.tmpl

@ -21,7 +21,7 @@ function GetIt(bibno,title)
<div id="bd">
<h1>Search results</h1>
<h1>Search results from <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --></h1>
<!-- TMPL_IF NAME="total"-->
<table>
<tr>
@ -54,15 +54,15 @@ function GetIt(bibno,title)
<!-- TMPL_ELSE -->
<h2>No results found for <b><!-- TMPL_VAR NAME="query" --></b></h2>
<!-- /TMPL_IF-->
<a onclick="Plugin(f)" href="">Search for another Biblio</a>
<!-- TMPL_IF NAME="displayprev" -->
<a href="/cgi-bin/koha/serials/subscription-bib-search.pl?op=do_search&type=intranet&startfrom=<!-- TMPL_VAR ESCAPE="URL" NAME="startfromprev" -->&q=<!-- TMPL_VAR ESCAPE="URL" NAME="query" -->">&lt;&lt;</a>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="displaynext" -->
<a href="/cgi-bin/koha/serials/subscription-bib-search.pl?op=do_search&type=intranet&startfrom=<!-- TMPL_VAR ESCAPE="URL" NAME="startfromnext" -->&q=<!-- TMPL_VAR ESCAPE="URL" NAME="query" -->">&gt;&gt;</a>
<!-- /TMPL_IF -->
<br/>
<a href="subscription-bib-search.pl">Search for another Biblio</a>
<a class="button" href="#" onclick="window.close()"> Close</a></p>
</div>
<script type="text/javascript">
function Plugin(f)
{
window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
}
</script>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

2
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tmpl

@ -12,7 +12,7 @@
<!-- TMPL_IF name="no_query" -->
<div class="warning">You must enter a term to search on </div>
<!-- /TMPL_IF -->
<form name="f" action="/cgi-bin/koha/serials/subscription-bib-search.pl" method="post">
<form name="f" action="/cgi-bin/koha/serials/subscription-bib-search.pl" method="get">
<input type="hidden" name="op" value="do_search" />
<input type="hidden" name="type" value="intranet" />
<label for="q">Keyword</label>

17
serials/subscription-bib-search.pl

@ -79,9 +79,9 @@ if ($op eq "do_search" && $query) {
}
$resultsperpage= $input->param('resultsperpage');
$resultsperpage = 19 if(!defined $resultsperpage);
$resultsperpage = 20 if(!defined $resultsperpage);
my ($error, $marcrecords, $total_hits) = SimpleSearch($query, $startfrom, $resultsperpage);
my ($error, $marcrecords, $total_hits) = SimpleSearch($query, $startfrom*$resultsperpage, $resultsperpage);
my $total = scalar @$marcrecords;
if (defined $error) {
@ -122,14 +122,14 @@ if ($op eq "do_search" && $query) {
# multi page display gestion
my $displaynext=0;
my $displayprev=$startfrom;
if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
if(($total_hits - (($startfrom+1)*($resultsperpage))) > 0 ){
$displaynext = 1;
}
my @numbers = ();
if ($total>$resultsperpage)
if ($total_hits>$resultsperpage)
{
for (my $i=1; $i<$total/$resultsperpage+1; $i++)
{
@ -144,11 +144,12 @@ if ($op eq "do_search" && $query) {
}
}
}
my $from = $startfrom*$resultsperpage+1;
my $from = 0;
$from = $startfrom*$resultsperpage+1 if($total_hits > 0);
my $to;
if($total < (($startfrom+1)*$resultsperpage))
if($total_hits < (($startfrom+1)*$resultsperpage))
{
$to = $total;
} else {
@ -163,7 +164,7 @@ if ($op eq "do_search" && $query) {
resultsperpage => $resultsperpage,
startfromnext => $startfrom+1,
startfromprev => $startfrom-1,
total=>$total,
total=>$total_hits,
from=>$from,
to=>$to,
numbers=>\@numbers,

Loading…
Cancel
Save