Browse Source

Fix for Bug 3523 - Menu of existing lists limited to 10

- adding "more" option to the search results dropdown
- offering a scrolling list on the add-to-list popup
- lists add popup shows the full list of all
  the patron's lists, divided into groups of private and
  public lists.

Can be improved by a fix for Bug 5529

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
3.4.x
Owen Leonard 13 years ago
committed by Chris Cormack
parent
commit
731b933d51
  1. 25
      C4/VirtualShelves.pm
  2. 2
      koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
  3. 15
      koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl
  4. 13
      koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
  5. 48
      opac/opac-addbybiblionumber.pl

25
C4/VirtualShelves.pm

@ -47,7 +47,7 @@ BEGIN {
&GetBibliosShelves
);
@EXPORT_OK = qw(
&GetShelvesSummary &GetRecentShelves
&GetShelvesSummary &GetRecentShelves &GetAllShelves
&RefreshShelvesSummary &SetShelvesLimit
);
}
@ -212,6 +212,29 @@ sub GetRecentShelves ($$$) {
return ( \@shelflist, $total );
}
=head2 GetAllShelves
($shelflist) = GetAllShelves($owner)
This function returns a references to an array of hashrefs containing all shelves sorted
by the shelf name.
This function is intended to return a dataset reflecting all the shelves for
the submitted parameters.
=cut
sub GetAllShelves ($$) {
my ($category,$owner) = @_;
my (@shelflist);
my @params = ($category,$owner);
my $query = "SELECT * FROM virtualshelves WHERE category = ? AND owner = ? ORDER BY shelfname ASC";
my $sth = $dbh->prepare($query);
$sth->execute(@params);
@shelflist = $sth->fetchall_arrayref({});
return ( \@shelflist );
}
=head2 GetShelf
(shelfnumber,shelfname,owner,category,sortfield) = &GetShelf($shelfnumber);

2
koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc

@ -159,7 +159,7 @@
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="bartotal" -->
<ul class="second-of-type">
<li class="yuimenuitem"><a class="yuimenuitemlabel" href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">View all <!--TMPL_VAR NAME="bartotal" --> of your lists</a></li>
<li class="yuimenuitem"><a class="yuimenuitemlabel" href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">View all <!--TMPL_VAR NAME="bartotal" --> of your private lists</a></li>
</ul>
<!-- /TMPL_IF -->
<ul class="second-of-type">

15
koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl

@ -22,10 +22,21 @@
</li>
<!-- /TMPL_LOOP -->
</ul>
<!-- TMPL_IF NAME="CGIvirtualshelves"-->
<!-- TMPL_IF NAME="existingshelves" -->
<form name="f1" action="/cgi-bin/koha/opac-addbybiblionumber.pl" method="post">
<fieldset class="rows"><legend>Select a List</legend>
<ol><li> <label for="shelfnumber">Add to list:</label> <!-- TMPL_VAR NAME="CGIvirtualshelves" --></li></ol>
<ol><li> <label for="shelfnumber">Add to list:</label> <select name="shelfnumber" id="shelfnumber">
<!-- TMPL_IF NAME="privatevirtualshelves" --><optgroup label="Private Lists">
<!-- TMPL_LOOP NAME="privatevirtualshelves" -->
<option value="<!-- TMPL_VAR NAME="shelfnumber" -->"><!-- TMPL_VAR NAME="shelfname" --></option>
<!-- /TMPL_LOOP -->
</optgroup><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="publicvirtualshelves" --><optgroup label="Public Lists">
<!-- TMPL_LOOP NAME="publicvirtualshelves" -->
<option value="<!-- TMPL_VAR NAME="shelfnumber" -->"><!-- TMPL_VAR NAME="shelfname" --></option>
<!-- /TMPL_LOOP -->
</optgroup><!-- /TMPL_IF -->
</select></li></ol>
<!-- TMPL_LOOP NAME="biblios" --> <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" /><!-- /TMPL_LOOP -->
<input type="hidden" name="modifyshelfcontents" value="1" /></fieldset>
<fieldset class="action"><input type="submit" value="Save" class="submit" /> <a class="close cancel" href="#">Cancel</a></fieldset>

13
koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl

@ -105,9 +105,11 @@ $(document).ready(function(){
<!-- /TMPL_IF --><!-- TMPL_IF NAME="virtualshelves" --><!-- TMPL_IF NAME="loggedinusername" --><!-- TMPL_IF NAME="addbarshelves" -->
param1 += "<optgroup label=\""+_("Your Lists:")+"\">";<!-- TMPL_LOOP NAME="addbarshelvesloop" -->
param1 += "<option id=\"s<!-- TMPL_VAR NAME="shelfnumber" -->\" value=\"addtolist\"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"--><\/option>";<!-- /TMPL_LOOP -->
<!-- TMPL_IF NAME="bartotal" -->param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";<!-- /TMPL_IF -->
param1 += "<\/optgroup>";<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="addpubshelves" -->param1 += "<optgroup label=\""+_("Public Lists:")+"\">"<!-- TMPL_LOOP NAME="addpubshelvesloop" -->+"<option id=\"s<!-- TMPL_VAR NAME="shelfnumber" -->\" value=\"addtolist\"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"--><\/option>"<!-- /TMPL_LOOP --><!-- /TMPL_IF -->
param1 +="<\/optgroup><option value=\"newlist\">[ "+_("New List")+" ]<\/option>"
<!-- TMPL_IF NAME="addpubshelves" -->param1 += "<optgroup label=\""+_("Public Lists:")+"\">"<!-- TMPL_LOOP NAME="addpubshelvesloop" -->+"<option id=\"s<!-- TMPL_VAR NAME="shelfnumber" -->\" value=\"addtolist\"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"--><\/option>";<!-- /TMPL_LOOP --><!-- /TMPL_IF -->
param1 += "<\/optgroup>";
param1 += "<option value=\"newlist\">[ "+_("New List")+" ]<\/option>";
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
param1 += "<\/select> <input type=\"submit\" class=\"submit\" value=\""+_("Save")+"\" />";
@ -153,7 +155,7 @@ $(document).ready(function(){
<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="TagsEnabled" -->$("#tagsel_span").html("<input id=\"tagsel_tag\" class=\"submit\" type=\"submit\" value=\"Tag\"/>");<!-- /TMPL_IF --><!-- /TMPL_IF -->
function cartList(){
if($("#addto").find("option:selected").attr("value") == "addtolist"){
if($("#addto").find("option:selected").attr("value") == "addtolist"){
var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
if (vShelfAdd()) {
Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?selectedshelf='+shelfnumber+'&' + vShelfAdd());
@ -164,6 +166,11 @@ $(document).ready(function(){
Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?newshelf=1&' + vShelfAdd());
}<!-- TMPL_ELSE --> alert('You must be logged in to create or add to Lists'); <!-- /TMPL_IF -->
return false;
} else if($("#addto").find("option:selected").attr("value") == "morelists"){
<!-- TMPL_IF NAME="loggedinusername" -->if (vShelfAdd()) {
Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?' + vShelfAdd());
}<!-- TMPL_ELSE --> alert('You must be logged in to create or add to Lists'); <!-- /TMPL_IF -->
return false;
}
if($("#addto").find("option:selected").attr("value") == "addtocart" || $("#addto").attr("class") == "addtocart"){
addMultiple();

48
opac/opac-addbybiblionumber.pl

@ -27,7 +27,7 @@ use warnings;
use C4::Biblio;
use CGI;
use C4::VirtualShelves qw/:DEFAULT GetRecentShelves RefreshShelvesSummary/;
use C4::VirtualShelves qw/:DEFAULT GetAllShelves RefreshShelvesSummary/;
use C4::Auth;
use C4::Output;
use C4::Auth qw/get_session/;
@ -96,36 +96,26 @@ else {
"category$singlecategory" => 1
);
} else {
# offer choice of shelves
my $limit = 10;
my @shelvesloop;
my %shelvesloop;
#grab each type of shelf, open (type 3) should not be limited by user.
foreach my $shelftype (1,2,3) {
my ($shelflist) = GetRecentShelves($shelftype, $limit, $shelftype == 3 ? undef : $loggedinuser);
for my $shelf (@{ $shelflist->[0] }) {
push(@shelvesloop, $shelf->{shelfnumber});
$shelvesloop{$shelf->{shelfnumber}} = $shelf->{shelfname};
}
}
my $CGIvirtualshelves;
if ( @shelvesloop > 0 ) {
$CGIvirtualshelves = CGI::scrolling_list (
-name => 'shelfnumber',
-id => 'shelfnumber',
-values => \@shelvesloop,
-labels => \%shelvesloop,
-size => 1,
-tabindex => '',
-multiple => 0
);
$template->param (
CGIvirtualshelves => $CGIvirtualshelves,
);
}
}
my $privateshelves = GetAllShelves(1,$loggedinuser);
my @privateshelves = @{$privateshelves};
warn scalar($privateshelves);
if(@privateshelves){
$template->param (
privatevirtualshelves => @privateshelves,
existingshelves => 1
);
}
my $publicshelves = GetAllShelves(2,$loggedinuser);
my @publicshelves = @{$publicshelves};
if(@publicshelves){
$template->param (
publicvirtualshelves => @publicshelves,
existingshelves => 1
);
}
}
my @biblios;
for my $bib (@biblionumber) {
my $data = GetBiblioData( $bib );

Loading…
Cancel
Save