Koha/opac/svc/shelfbrowser.pl
Jonathan Druart 5c0fa5ec3d Bug 10856: Improve the previous and next items on the shelf browser
The next and previous links should completely refresh the shelf.

For example:
[<] [1] [2] [3] [4] [5] [6] [>]
Before this patch, the next and previous links were the same as the 1
and 6.
With this patch, after clicking on next, we will get:
[<] [7] [8] [9] [10] [11] [12] [13] [>]

This patch adds a new AJAX script to get the shelf browser block.

Test plan:
- On a detail biblio page, click on a "Browse shelf" link.
- Play with the next and previous links.
- Deactivate Javascript (using NoScript for example) and check that you
  get the same behavior (but the page is reloaded).
- Launch the unit tests: prove t/db_dependent/ShelfBrowser.t

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-04 15:56:35 +00:00

41 lines
1.2 KiB
Perl
Executable file

#!/usr/bin/perl
use Modern::Perl;
use CGI;
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::ShelfBrowser;
my $cgi = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "svc/shelfbrowser.tt",
query => $cgi,
type => "opac",
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
flagsrequired => { borrow => 1 },
}
);
# Shelf Browser Stuff
if (C4::Context->preference("OPACShelfBrowser")) {
my $starting_itemnumber = $cgi->param('shelfbrowse_itemnumber');
if (defined($starting_itemnumber)) {
my $nearby = GetNearbyItems($starting_itemnumber);
$template->param(
starting_homebranch => $nearby->{starting_homebranch}->{description},
starting_location => $nearby->{starting_location}->{description},
starting_ccode => $nearby->{starting_ccode}->{description},
shelfbrowser_prev_item => $nearby->{prev_item},
shelfbrowser_next_item => $nearby->{next_item},
shelfbrowser_items => $nearby->{items},
OpenOPACShelfBrowser => 1,
);
}
}
print $template->output;