MT 1976 : Multiple add of records to a new list, intranet

(cherry picked from commit f9867cdd975726197720613af04bddd0197f3fac)
This commit is contained in:
Matthias Meusburger 2009-09-30 10:37:11 +02:00 committed by Henri-Damien LAURENT
parent fd75507a55
commit b18661529f
3 changed files with 34 additions and 14 deletions

View file

@ -21,11 +21,6 @@ function verify_images() {
}
});
}
$(window).load(function() {
verify_images();
});
<!-- /TMPL_IF -->
var q_array = new Array(); // will hold search terms, if present
$(window).load(function() {
@ -80,7 +75,7 @@ $(".addtocart").show();
return false;
} else if($("#addto").find("option:selected").attr("value") == "newlist"){
if (vShelfAdd()) {
Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&confirm=1&' + vShelfAdd());
Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vShelfAdd());
}
return false;
}

View file

@ -68,17 +68,19 @@
</h4>
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF NAME="CGIvirtualshelves" --><form name="f1" method="post" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
<!-- TMPL_IF NAME="CGIvirtualshelves" --><!-- TMPL_UNLESS NAME="newshelf" --><form name="f1" method="post" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
<!-- TMPL_UNLESS NAME="biblionumbers" -->
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<!-- TMPL_ELSE -->
<input type="hidden" name="biblionumbers" value="<!-- TMPL_VAR NAME="biblionumbers" -->" />
<!-- /TMPL_UNLESS -->
<input type="hidden" name="confirmed" value="1" /></fieldset>
<fieldset class="rows">
<legend>Select an existing list</legend>
<ol>
<li><label>Choose list</label><!-- TMPL_VAR NAME="CGIvirtualshelves" --></li>
</ol>
<!-- TMPL_LOOP NAME="biblios" --><input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_LOOP -->
<!-- TMPL_UNLESS NAME="biblionumbers" -->
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<!-- TMPL_ELSE -->
@ -87,31 +89,34 @@
<fieldset class="action"><input type="submit" value="Save" class="submit" /></fieldset>
</fieldset>
</form>
<h4>...or...</h4><!-- /TMPL_IF -->
<h4>...or...</h4><!-- /TMPL_UNLESS --><!-- /TMPL_IF -->
<!-- TMPL_UNLESS NAME="shelfnumber" -->
<form name="f2" method="post" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
<fieldset class="rows"><legend>Add to a new list:</legend>
<ol><li>
<label for="newvirtualshelf">
List name:
</label>
<!-- TMPL_LOOP NAME="biblios" --><input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_LOOP -->
<!-- TMPL_UNLESS NAME="biblionumbers" -->
<input type="hidden" name="biblionumber" id="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<!-- TMPL_ELSE -->
<input type="hidden" name="biblionumbers" id="biblionumbers" value="<!-- TMPL_VAR NAME="biblionumbers" -->" />
<!-- /TMPL_UNLESS -->
<input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" />
<input type="hidden" name="confirmed" value="1" />
</li>
<li>
<label for="category">Category:</label>
<select name="category" id="category">
<option value="1">Private</option>
<option value="2">Public</option>
<option value="3">Free</option>
<option value="3">Free</option>
</select>
</li></ol>
<fieldset class="action"><input type="submit" value="Save" class="submit" /></fieldset> </fieldset>
</form>
<!-- /TMPL_UNLESS -->
<!-- /TMPL_IF -->
</div>

View file

@ -50,6 +50,10 @@
if this script has to add a shelf, it add one with this category.
=item newshelf
if this parameter exists, then we create a new shelf
=back
=cut
@ -102,6 +106,7 @@ my $biblionumbers = $query->param('biblionumbers');
my $shelfnumber = $query->param('shelfnumber');
my $newvirtualshelf = $query->param('newvirtualshelf');
my $newshelf = $query->param('newshelf');
my $category = $query->param('category');
my $sortfield = $query->param('sortfield');
my $confirmed = $query->param('confirmed') || 0;
@ -124,8 +129,7 @@ if ($biblionumbers) {
@biblionumbers = (@biblionumber);
}
$shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category, $sortfield )
if $newvirtualshelf;
$shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category, $sortfield ) if $newvirtualshelf;
if ( $shelfnumber || ( $shelfnumber == -1 ) ) { # the shelf already exist.
if ($confirmed == 1) {
@ -173,6 +177,7 @@ else { # this shelf doesn't already exist.
push( @shelvesloop, $shelf->{shelfnumber} );
$shelvesloop{$shelf->{shelfnumber}} = $shelf->{shelfname};
}
if(@shelvesloop gt 0){
my $CGIvirtualshelves = CGI::scrolling_list
(
@ -188,8 +193,23 @@ else { # this shelf doesn't already exist.
CGIvirtualshelves => $CGIvirtualshelves,
);
}
unless ($biblionumbers) {
my @biblios;
for my $bib (@biblionumber) {
my $data = GetBiblioData( $bib );
push(@biblios,
{ biblionumber => $bib,
title => $data->{'title'},
author => $data->{'author'},
} );
}
$template->param(
newshelf => $newshelf,
biblios=>\@biblios,
multiple => (scalar(@biblionumber) > 1),
total => scalar(@biblionumber),
);
unless (@biblionumbers) {
my ( $bibliocount, @biblios ) = GetBiblio($biblionumber);
$template->param