Add multiple items to virt shelf, and bugvix virtual shelf adds.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
0734f8fca0
commit
433be86631
4 changed files with 50 additions and 51 deletions
|
@ -159,11 +159,6 @@ function addMultiple(){
|
|||
}
|
||||
}
|
||||
|
||||
function addSelToShelf() {
|
||||
var items = document.getElementById('records').value;
|
||||
document.location = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items;
|
||||
}
|
||||
|
||||
function addSelRecords(valSel) { // function for adding a selection of biblios to the basket
|
||||
// from the results list
|
||||
var arrayRecords = valSel.split("/");
|
||||
|
@ -371,3 +366,22 @@ function openBiblio(dest,biblionumber) {
|
|||
opener.document.location = openerURL;
|
||||
opener.focus();
|
||||
}
|
||||
|
||||
function addSelToShelf() {
|
||||
var items = document.getElementById('records').value;
|
||||
document.location = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items;
|
||||
}
|
||||
|
||||
/// vShelfAdd() builds url string for multiple-biblio adds.
|
||||
|
||||
function vShelfAdd() {
|
||||
bibs= new Array;
|
||||
if(document.bookbag_form.biblionumber.length > 0) {
|
||||
for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
|
||||
if (document.bookbag_form.biblionumber[i].checked) {
|
||||
bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value);
|
||||
}
|
||||
}
|
||||
return bibs.join("&");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,26 +9,21 @@
|
|||
<div id="custom-doc" class="yui-t7">
|
||||
|
||||
<!-- TMPL_IF NAME="multiple"-->
|
||||
<h1>Add these <!-- TMPL_VAR NAME="total"--> biblios to a shelf</h1>
|
||||
<!-- TMPL_LOOP NAME="biblios"-->
|
||||
<b><!-- TMPL_VAR NAME="title"--></b>
|
||||
<!-- TMPL_IF NAME="author"-->by <!-- TMPL_VAR NAME="author"--><!-- /TMPL_IF -->
|
||||
<br /><br />
|
||||
<!-- /TMPL_LOOP -->
|
||||
<h1>Add <!-- TMPL_VAR NAME="total"--> items to a book list:</h1>
|
||||
<!-- TMPL_ELSE -->
|
||||
<h1>Add
|
||||
<i><!-- TMPL_VAR NAME="title" --></i>
|
||||
<!-- TMPL_IF NAME="author" -->
|
||||
by <!-- TMPL_VAR NAME="author" -->
|
||||
<!-- /TMPL_IF --> to a Virtual Shelf
|
||||
</h1>
|
||||
<h1>Add to a book list:</h1>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<ul> <!-- TMPL_LOOP NAME="biblios"-->
|
||||
<li> <span class="title"><!-- TMPL_VAR NAME="title"--></span>
|
||||
<!-- TMPL_IF NAME="author"--><span class="author"> <!-- TMPL_VAR NAME="author"--> </span><!-- /TMPL_IF -->
|
||||
</li>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</ul>
|
||||
<!-- TMPL_IF NAME="CGIvirtualshelves"-->
|
||||
<form name="f1" action="/cgi-bin/koha/opac-addbybiblionumber.pl" method="post">
|
||||
<fieldset class="rows"><legend>Select an Existing List</legend>
|
||||
<ol><li> <label for="shelfnumber">Add to list:</label> <!-- TMPL_VAR NAME="CGIvirtualshelves" --></li></ol>
|
||||
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
|
||||
<!-- 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="cancel" href="#" onclick="closePopup();">Cancel</a></fieldset>
|
||||
</form>
|
||||
|
@ -48,7 +43,7 @@
|
|||
<option value="1">Private</option>
|
||||
<option value="2">Public</option>
|
||||
</select></li></ol></fieldset>
|
||||
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
|
||||
<!-- TMPL_LOOP NAME="biblios" --> <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_LOOP -->
|
||||
<fieldset class="action"><input type="submit" value="Save" class="submit" /> <a class="cancel" href="#" onclick="closePopup();">Cancel</a></fieldset>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
|
||||
<!-- TMPL_IF name="opacbookbag" --><a href="#" onclick="SelectAll()"><img src="/opac-tmpl/prog/images/checkall.gif" alt="Check All" border="0" /></a>
|
||||
<input type="button" class="icon shelf" value="Add checked items to book bag" onclick="addMultiple(); return false;" />
|
||||
<!-- TMPL_IF NAME="virtualshelves" --><input type="button" class="icon shelf" value="Add Checked Items to Virtual Shelf" onclick="<!-- 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 Virtual Shelves'); <!-- /TMPL_IF --> return false;" /><!-- /TMPL_IF -->
|
||||
<input type="reset" value="Clear All" class="icon shelf" />
|
||||
<!-- /TMPL_IF --></p></td></tr>
|
||||
<!-- Actual Search Results -->
|
||||
|
|
|
@ -31,7 +31,7 @@ use C4::Auth;
|
|||
use C4::Output;
|
||||
|
||||
my $query = new CGI;
|
||||
my $biblionumber = $query->param('biblionumber');
|
||||
my @biblionumber = $query->param('biblionumber');
|
||||
my $shelfnumber = $query->param('shelfnumber');
|
||||
my $newvirtualshelf = $query->param('newvirtualshelf');
|
||||
my $category = $query->param('category');
|
||||
|
@ -45,23 +45,19 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
}
|
||||
);
|
||||
|
||||
$shelfnumber = AddShelf( '', $newvirtualshelf, $loggedinuser, $category ) if $newvirtualshelf;
|
||||
$shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category ) if $newvirtualshelf;
|
||||
|
||||
# multiple bibs might come in as '/' delimited string (from where, i don't see), or as array.
|
||||
|
||||
# to know if we had to add more than one biblio.
|
||||
my $multiple = 0;
|
||||
$multiple = 1 if $biblionumber =~ /^(\d*\/)*$/;
|
||||
|
||||
|
||||
if ($shelfnumber) {
|
||||
|
||||
if ($multiple){
|
||||
foreach (split /\//,$biblionumber){
|
||||
&AddToShelfFromBiblio($_,$shelfnumber);
|
||||
my @bibs;
|
||||
if (scalar(@biblionumber) == 1) {
|
||||
@biblionumber = (split /\//,$biblionumber[0]);
|
||||
}
|
||||
if ($shelfnumber && ($shelfnumber != -1)) {
|
||||
for my $bib (@biblionumber){
|
||||
&AddToShelfFromBiblio($bib,$shelfnumber);
|
||||
}
|
||||
}
|
||||
else {
|
||||
&AddToShelfFromBiblio( $biblionumber, $shelfnumber );
|
||||
}
|
||||
print $query->header;
|
||||
print "<html><body onload=\"window.close();\"></body></html>";
|
||||
exit;
|
||||
|
@ -87,27 +83,20 @@ else {
|
|||
);
|
||||
}
|
||||
|
||||
if ( $multiple ) {
|
||||
my @biblios;
|
||||
foreach (split /\//,$biblionumber){
|
||||
my $data = GetBiblioData($_);
|
||||
push @biblios,$data;
|
||||
}
|
||||
for my $bib (@biblionumber) {
|
||||
my $data = GetBiblioData( $bib );
|
||||
push(@biblios,
|
||||
{ biblionumber => $bib,
|
||||
title => $data->{'title'},
|
||||
author => $data->{'author'},
|
||||
} );
|
||||
}
|
||||
$template->param (
|
||||
multiple => 1,
|
||||
biblionumber => $biblionumber,
|
||||
multiple => (scalar(@biblios) > 1),
|
||||
total => scalar @biblios,
|
||||
biblios => \@biblios,
|
||||
);
|
||||
}
|
||||
else { # just one to add.
|
||||
my $data = GetBiblioData( $biblionumber );
|
||||
$template->param (
|
||||
biblionumber => $biblionumber,
|
||||
title => $data->{'title'},
|
||||
author => $data->{'author'},
|
||||
);
|
||||
}
|
||||
|
||||
$template->param (
|
||||
CGIvirtualshelves => $CGIvirtualshelves,
|
||||
|
|
Loading…
Reference in a new issue