Browse Source

Merge remote-tracking branch 'origin/new/bug_3215'

3.8.x
Paul Poulain 11 years ago
parent
commit
80c202170a
  1. 11
      C4/VirtualShelves/Page.pm
  2. 16
      koha-tmpl/opac-tmpl/prog/en/css/opac.css
  3. 3
      koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc
  4. 6
      koha-tmpl/opac-tmpl/prog/en/includes/opac-detail-sidebar.inc
  5. 50
      koha-tmpl/opac-tmpl/prog/en/js/basket.js
  6. 8
      koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
  7. 9
      koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
  8. 11
      opac/opac-ISBDdetail.pl
  9. 11
      opac/opac-MARCdetail.pl
  10. 11
      opac/opac-detail.pl
  11. 12
      opac/opac-search.pl

11
C4/VirtualShelves/Page.pm

@ -68,6 +68,14 @@ sub shelfpage ($$$$$) {
my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset );
my $marcflavour = C4::Context->preference("marcflavour");
# get biblionumbers stored in the cart
my @cart_list;
my $cart_cookie = ( $type eq 'opac' ? "bib_list" : "intranet_bib_list" );
if($query->cookie($cart_cookie)){
my $cart_list = $query->cookie($cart_cookie);
@cart_list = split(/\//, $cart_list);
}
$shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') );
$shelflimit = $shelflimit || 20;
$shelfoffset = ( $itemoff - 1 ) * $shelflimit; # Sets the offset to begin retrieving items at
@ -227,6 +235,9 @@ sub shelfpage ($$$$$) {
my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
$this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} );
$this_item->{'ITEM_RESULTS'} = \@items_infos;
if ( grep {$_ eq $biblionumber} @cart_list) {
$this_item->{'incart'} = 1;
}
if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnList')) {
$this_item->{'TagLoop'} = get_tags({

16
koha-tmpl/opac-tmpl/prog/en/css/opac.css

@ -453,6 +453,18 @@ a .term {
background-image:url(../../images/cart2.gif);
}
#action a.cartRemove, .actions a.cartRemove {
color: #cc3333;
font-size : 90%;
margin : 0;
padding: 0;
}
#action a.incart {
background-image:url(../../images/cart2.gif);
color : #666;
}
/* toolbar buttons */
#toolbar {
@ -1296,6 +1308,9 @@ padding-left : .4em;
color: #707070;
padding : 0 0 .5em 0;
}
.results_summary .results_summary {
font-size : 100%;
}
.m880 {
display:block;
@ -1498,6 +1513,7 @@ div.lang{
box-shadow: 1px 1px 3px #666;
-moz-box-shadow: 1px 1px 3px #666;
-webkit-box-shadow: 1px 1px 3px #666;
z-index: 2;
}

3
koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc

@ -48,12 +48,15 @@
[% IF ( opacbookbag ) %]var MSG_BASKET_EMPTY = _("Your cart is currently empty");
var MSG_RECORD_IN_BASKET = _("This item is already in your cart");
var MSG_RECORD_ADDED = _("This item has been added to your cart");
var MSG_RECORD_REMOVED = _("This item has been removed from your cart");
var MSG_NRECORDS_ADDED = _(" item(s) added to your cart");
var MSG_NRECORDS_IN_BASKET = _("already in your cart");
var MSG_NO_RECORD_SELECTED = _("No item was selected");
var MSG_NO_RECORD_ADDED = _("No item was added to your cart");
var MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty your cart?");
var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?");
var MSG_ITEM_IN_CART = _("In your cart");
var MSG_ITEM_NOT_IN_CART = _("Add to your cart");
$("#cartDetails").ready(function(){ $("#cmspan").html("<a href=\"#\" id=\"cartmenulink\" class=\"\"><i><\/i><span><i><\/i><span><\/span><span id=\"carticon\"></span> "+_("Cart")+"<span id=\"basketcount\"><\/span><\/span><\/a>"); }); [% ELSE %][% IF ( virtualshelves ) %]
var MSG_NO_RECORD_SELECTED = _("No item was selected");[% END %][% END %]
[% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system.");

6
koha-tmpl/opac-tmpl/prog/en/includes/opac-detail-sidebar.inc

@ -21,7 +21,11 @@
[% END %][% END %]
[% END %]
[% IF ( opacbookbag ) %]
<li><a class="addtocart" href="#" onclick="addRecord('[% biblionumber %]'); return false;">Add to Your Cart</a></li>
[% IF ( incart ) %]
<li><a class="incart cart[% biblionumber %]" href="#" onclick="addRecord('[% biblionumber %]'); return false;">In your cart</a> <a class="cartRemove cartR[% biblionumber %]" href="#" onclick="delSingleRecord('[% biblionumber %]'); return false;">(remove)</a></li>
[% ELSE %]
<li><a class="addtocart cart[% biblionumber %]" href="#" onclick="addRecord('[% biblionumber %]'); return false;">Add to your cart</a> <a style="display:none;" class="cartRemove cartR[% biblionumber %]" href="#" onclick="delSingleRecord('[% biblionumber %]'); return false;">(remove)</a></li>
[% END %]
[% END %]
<li style="display:none;"><a href="#" id="furthersearches">More searches</a></li>
</ul>

50
koha-tmpl/opac-tmpl/prog/en/js/basket.js

@ -128,10 +128,12 @@ function addRecord(val, selection,NoMsgAlert) {
if (write) {
writeCookie(nameCookie, valCookie);
if (selection) { // when adding a selection of records
updateLink(val,"add");
return 1;
}
if (! NoMsgAlert ) {
showCartUpdate(MSG_RECORD_ADDED);
updateLink(val,"add");
}
}
}
@ -229,12 +231,24 @@ function selRecord(num, status) {
document.myform.records.value = str;
}
function delSingleRecord(biblionumber){
var nameCookie = "bib_list";
var valCookie = readCookie(nameCookie);
var arrayRecords = valCookie.split("/");
var pos = jQuery.inArray(biblionumber,arrayRecords);
arrayRecords.splice(pos,1);
valCookie = arrayRecords.join("/");
writeCookie( nameCookie, valCookie );
updateBasket( arrayRecords.length-1 );
updateLink(biblionumber,"del");
showCartUpdate(MSG_RECORD_REMOVED);
}
function delSelRecords() {
var recordsSel = 0;
var end = 0;
var nameCookie = "bib_list";
var valCookie = readCookie(nameCookie, 1);
if (valCookie) {
var str = document.myform.records.value;
if (str.length > 0){
@ -243,9 +257,10 @@ function delSelRecords() {
while (!end){
s = str.indexOf("/");
if (s>0){
num = str.substring(0, s)
num = str.substring(0, s);
str = delRecord(num,str);
str2 = delRecord(num,str2);
updateLink(num,"del",top.opener);
} else {
end = 1;
}
@ -312,6 +327,7 @@ function delBasket() {
rep = confirm(MSG_CONFIRM_DEL_BASKET);
if (rep) {
delCookie(nameCookie);
updateAllLinks(top.opener);
document.location = "about:blank";
updateBasket(0,top.opener);
window.close();
@ -462,6 +478,36 @@ function hideLists(){
$("#listsDetails").fadeOut("fast");
}
function updateLink(val,op,target){
if(target){
if(op == "add"){
target.$("a.cart"+val).html(MSG_ITEM_IN_CART).addClass("incart");
target.$("a.cartR"+val).show();
} else {
target.$("a.cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart cart"+val);
target.$("a.cartR"+val).hide();
}
} else {
if(op == "add"){
$("a.cart"+val).html(MSG_ITEM_IN_CART).addClass("incart");
$("a.cartR"+val).show();
} else {
$("a.cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart cart"+val);
$("a.cartR"+val).hide();
}
}
}
function updateAllLinks(target){
if(target){
target.$("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
target.$("a.cartRemove").hide();
} else {
$("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
$("a.cartRemove").hide();
}
}
$("#cartDetails").ready(function(){
$("#cartDetails,#cartmenulink").click(function(){ hideCart(); });
$("#cartmenulink").click(function(){ openBasket(); return false; });

8
koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt

@ -521,7 +521,13 @@ $(document).ready(function(){
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( virtualshelves ) %]<a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]'); return false;">Save to Lists</a>
[% END %][% END %][% END %]
[% IF ( opacbookbag ) %]<a class="addtocart" href="#" onclick="addRecord('[% SEARCH_RESULT.biblionumber %]'); return false;">Add to Cart</a>[% END %]
[% IF ( opacbookbag ) %]
[% IF ( SEARCH_RESULT.incart ) %]
<a class="addtocart cart[% SEARCH_RESULT.biblionumber %]" href="#" onclick="addRecord('[% SEARCH_RESULT.biblionumber %]'); return false;">In your Cart</a> <a class="cartRemove cartR[% SEARCH_RESULT.biblionumber %]" href="#" onclick="delSingleRecord('[% SEARCH_RESULT.biblionumber %]'); return false;">(remove)</a>
[% ELSE %]
<a class="addtocart cart[% SEARCH_RESULT.biblionumber %]" href="#" onclick="addRecord('[% SEARCH_RESULT.biblionumber %]'); return false;">Add to Cart</a> <a style="display:none;" class="cartRemove cartR[% SEARCH_RESULT.biblionumber %]" href="#" onclick="delSingleRecord('[% SEARCH_RESULT.biblionumber %]'); return false;">(remove)</a>
[% END %]
[% END %]
</span>
</td><td>
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">

9
koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt

@ -320,8 +320,13 @@ $(function() {
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( virtualshelves ) %]<a class="addtolist" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]'); return false;">Save to another list</a>
[% END %][% END %][% END %]
[% IF ( opacbookbag ) %]<a class="addtocart" href="#" onclick="addRecord('[% itemsloo.biblionumber %]'); return false;">Add to Cart</a>[% ELSE %]nocart[% END %]
[% IF ( opacbookbag ) %]
[% IF ( itemsloo.incart ) %]
<a class="addtocart cart[% itemsloo.biblionumber %]" href="#" onclick="addRecord('[% itemsloo.biblionumber %]'); return false;">In your cart</a> <a class="cartRemove cartR[% itemsloo.biblionumber %]" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber %]'); return false;">(remove)</a>
[% ELSE %]
<a class="addtocart cart[% itemsloo.biblionumber %]" href="#" onclick="addRecord('[% itemsloo.biblionumber %]'); return false;">Add to Cart</a> <a style="display:none;" class="cartRemove cartR[% itemsloo.biblionumber %]" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber %]'); return false;">(remove)</a>
[% END %]
[% END %]
</span>
<!-- COinS / Openurl --><span class="Z3988" title="[% itemsloo.coins %]"></span>

11
opac/opac-ISBDdetail.pl

@ -69,6 +69,17 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $biblionumber = $query->param('biblionumber');
# get biblionumbers stored in the cart
my @cart_list;
if($query->cookie("bib_list")){
my $cart_list = $query->cookie("bib_list");
@cart_list = split(/\//, $cart_list);
if ( grep {$_ eq $biblionumber} @cart_list) {
$template->param( incart => 1 );
}
}
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );

11
opac/opac-MARCdetail.pl

@ -81,6 +81,17 @@ $template->param(
bibliotitle => $biblio->{title},
);
# get biblionumbers stored in the cart
my @cart_list;
if($query->cookie("bib_list")){
my $cart_list = $query->cookie("bib_list");
@cart_list = split(/\//, $cart_list);
if ( grep {$_ eq $biblionumber} @cart_list) {
$template->param( incart => 1 );
}
}
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );

11
opac/opac-detail.pl

@ -75,6 +75,17 @@ if ( ! $record ) {
}
$template->param( biblionumber => $biblionumber );
# get biblionumbers stored in the cart
my @cart_list;
if($query->cookie("bib_list")){
my $cart_list = $query->cookie("bib_list");
@cart_list = split(/\//, $cart_list);
if ( grep {$_ eq $biblionumber} @cart_list) {
$template->param( incart => 1 );
}
}
SetUTF8Flag($record);

12
opac/opac-search.pl

@ -88,6 +88,14 @@ if ($template_name eq 'opac-results.tmpl') {
$template->param('COinSinOPACResults' => C4::Context->preference('COinSinOPACResults'));
}
# get biblionumbers stored in the cart
my @cart_list;
if($cgi->cookie("bib_list")){
my $cart_list = $cgi->cookie("bib_list");
@cart_list = split(/\//, $cart_list);
}
if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom') {
$template->param($format => 1);
$template->param(timestamp => strftime("%Y-%m-%dT%H:%M:%S-00:00", gmtime)) if ($format eq 'atom');
@ -497,6 +505,10 @@ for (my $i=0;$i<@servers;$i++) {
# in order to avoid problems generated by the default size value in TT
foreach my $line (@newresults) {
if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
# while we're checking each line, see if item is in the cart
if ( grep {$_ eq $line->{'biblionumber'}} @cart_list) {
$line->{'incart'} = 1;
}
}
my $tag_quantity;

Loading…
Cancel
Save