Bugzilla – Attachment 3523 Details for
Bug 3523
Menu of existing lists limited to 10
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed fix
0001-Fix-for-Bug-3523-Menu-of-existing-lists-limited-to-1.patch (text/plain), 10.00 KB, created by
Owen Leonard
on 2011-03-30 12:56:18 UTC
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2011-03-30 12:56:18 UTC
Size:
10.00 KB
patch
obsolete
>From 015cd2bf00eb52dcd1cee99df62764d9d35bbed6 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 17 Dec 2010 08:36:52 -0500 >Subject: [PATCH] Fix for Bug 3523 - Menu of existing lists limited to 10 >Content-Type: text/plain; charset="utf-8" > >- 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 >--- > C4/VirtualShelves.pm | 25 ++++++++++- > koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 2 +- > .../prog/en/modules/opac-addbybiblionumber.tmpl | 15 +++++- > .../opac-tmpl/prog/en/modules/opac-results.tmpl | 13 ++++- > opac/opac-addbybiblionumber.pl | 48 ++++++++------------ > 5 files changed, 67 insertions(+), 36 deletions(-) > >diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm >index 77ae394..7257149 100644 >--- a/C4/VirtualShelves.pm >+++ b/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); >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >index 3a3d4b9..df0b413 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >+++ b/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"> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl >index 745d19d..4df208d 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl >+++ b/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> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl >index d7aff2e..0938dd5 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl >+++ b/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(); >diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl >index b1bf224..c72afe5 100755 >--- a/opac/opac-addbybiblionumber.pl >+++ b/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 ); >-- >1.7.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3523
:
1383
|
1384
|
2893
|
2894
| 3523