Lines 1-4
Link Here
|
1 |
/* global MSG_BASKET_EMPTY MSG_RECORD_IN_BASKET MSG_RECORD_ADDED MSG_NRECORDS_IN_BASKET MSG_NRECORDS_ADDED MSG_NO_RECORD_SELECTED MSG_NO_RECORD_ADDED MSG_RECORD_REMOVED MSG_CONFIRM_DEL_BASKET MSG_CONFIRM_DEL_RECORDS MSG_ITEM_IN_CART MSG_ITEM_NOT_IN_CART */ |
1 |
/* global __ __p */ |
2 |
|
2 |
|
3 |
////////////////////////////////////////////////////////////////////////////// |
3 |
////////////////////////////////////////////////////////////////////////////// |
4 |
// BASIC FUNCTIONS FOR COOKIE MANAGEMENT // |
4 |
// BASIC FUNCTIONS FOR COOKIE MANAGEMENT // |
Lines 86-92
function openBasket() {
Link Here
|
86 |
if (window.focus) {basket.focus()} |
86 |
if (window.focus) {basket.focus()} |
87 |
} |
87 |
} |
88 |
else { |
88 |
else { |
89 |
showCartUpdate(MSG_BASKET_EMPTY); |
89 |
showCartUpdate( __("Your cart is currently empty") ); |
90 |
} |
90 |
} |
91 |
} |
91 |
} |
92 |
|
92 |
|
Lines 115-121
function addRecord(val, selection,NoMsgAlert) {
Link Here
|
115 |
return 0; |
115 |
return 0; |
116 |
} |
116 |
} |
117 |
if (! NoMsgAlert ) { |
117 |
if (! NoMsgAlert ) { |
118 |
showCartUpdate(MSG_RECORD_IN_BASKET); |
118 |
showCartUpdate( __p("Bibliographic record", "The item is already in your cart") ); |
119 |
} |
119 |
} |
120 |
} |
120 |
} |
121 |
else { |
121 |
else { |
Lines 132-138
function addRecord(val, selection,NoMsgAlert) {
Link Here
|
132 |
return 1; |
132 |
return 1; |
133 |
} |
133 |
} |
134 |
if (! NoMsgAlert ) { |
134 |
if (! NoMsgAlert ) { |
135 |
showCartUpdate(MSG_RECORD_ADDED); |
135 |
showCartUpdate( __p("Bibliographic record", "The item has been added to your cart") ); |
136 |
updateLink(val,"add"); |
136 |
updateLink(val,"add"); |
137 |
} |
137 |
} |
138 |
|
138 |
|
Lines 189-206
function addSelRecords(valSel) { // function for adding a selection of biblios t
Link Here
|
189 |
var msg = ""; |
189 |
var msg = ""; |
190 |
if (nbAdd) { |
190 |
if (nbAdd) { |
191 |
if (i > nbAdd) { |
191 |
if (i > nbAdd) { |
192 |
msg = nbAdd+" "+MSG_NRECORDS_ADDED+", "+(i-nbAdd)+" "+MSG_NRECORDS_IN_BASKET; |
192 |
msg = nbAdd+" "+ __p("Bibliographic record", " item(s) added to your cart") +", "+(i-nbAdd)+" " + __("already in your cart"); |
193 |
} |
193 |
} |
194 |
else { |
194 |
else { |
195 |
msg = nbAdd+" "+MSG_NRECORDS_ADDED; |
195 |
msg = nbAdd+" "+ __p("Bibliographic record", " item(s) added to your cart"); |
196 |
} |
196 |
} |
197 |
} |
197 |
} |
198 |
else { |
198 |
else { |
199 |
if (i < 1) { |
199 |
if (i < 1) { |
200 |
msg = MSG_NO_RECORD_SELECTED; |
200 |
msg = __p("Bibliographic record", "No item was selected"); |
201 |
} |
201 |
} |
202 |
else { |
202 |
else { |
203 |
msg = MSG_NO_RECORD_ADDED+" ("+MSG_NRECORDS_IN_BASKET+") !"; |
203 |
msg = __p("Bibliographic record", "No item was added to your cart") + " (" + __("already in your cart") + ") !"; |
204 |
} |
204 |
} |
205 |
} |
205 |
} |
206 |
showCartUpdate(msg); |
206 |
showCartUpdate(msg); |
Lines 241-247
function delSingleRecord(biblionumber){
Link Here
|
241 |
writeCookie( nameCookie, valCookie ); |
241 |
writeCookie( nameCookie, valCookie ); |
242 |
updateBasket( arrayRecords.length-1 ); |
242 |
updateBasket( arrayRecords.length-1 ); |
243 |
updateLink(biblionumber,"del"); |
243 |
updateLink(biblionumber,"del"); |
244 |
showCartUpdate(MSG_RECORD_REMOVED); |
244 |
showCartUpdate( __p("Bibliographic record", "The item has been removed from your cart") ); |
245 |
} |
245 |
} |
246 |
|
246 |
|
247 |
function delSelRecords() { |
247 |
function delSelRecords() { |
Lines 268-274
function delSelRecords() {
Link Here
|
268 |
|
268 |
|
269 |
if (str2.length == 0) { // equivalent to emptying the basket |
269 |
if (str2.length == 0) { // equivalent to emptying the basket |
270 |
var rep = false; |
270 |
var rep = false; |
271 |
rep = confirm(MSG_CONFIRM_DEL_BASKET); |
271 |
rep = confirm( __("Are you sure you want to empty your cart?") ); |
272 |
if (rep) { |
272 |
if (rep) { |
273 |
delCookie(nameCookie); |
273 |
delCookie(nameCookie); |
274 |
document.location = "about:blank"; |
274 |
document.location = "about:blank"; |
Lines 293-299
function delSelRecords() {
Link Here
|
293 |
document.location = "/cgi-bin/koha/opac-basket.pl?" + strCookie; |
293 |
document.location = "/cgi-bin/koha/opac-basket.pl?" + strCookie; |
294 |
} |
294 |
} |
295 |
else { |
295 |
else { |
296 |
alert(MSG_NO_RECORD_SELECTED); |
296 |
alert( __p("Bibliographic record", "No item was selected") ); |
297 |
} |
297 |
} |
298 |
} |
298 |
} |
299 |
|
299 |
|
Lines 324-330
function delBasket() {
Link Here
|
324 |
var nameCookie = "bib_list"; |
324 |
var nameCookie = "bib_list"; |
325 |
|
325 |
|
326 |
var rep = false; |
326 |
var rep = false; |
327 |
rep = confirm(MSG_CONFIRM_DEL_BASKET); |
327 |
rep = confirm( __("Are you sure you want to empty your cart?") ); |
328 |
if (rep) { |
328 |
if (rep) { |
329 |
delCookie(nameCookie); |
329 |
delCookie(nameCookie); |
330 |
updateAllLinks(top.opener); |
330 |
updateAllLinks(top.opener); |
Lines 338-344
function delBasket() {
Link Here
|
338 |
function quit() { |
338 |
function quit() { |
339 |
if (document.myform.records.value) { |
339 |
if (document.myform.records.value) { |
340 |
var rep = false; |
340 |
var rep = false; |
341 |
rep = confirm(MSG_CONFIRM_DEL_RECORDS); |
341 |
rep = confirm( __p("Bibliographic records", "Are you sure you want to remove the selected items?") ); |
342 |
if (rep) { |
342 |
if (rep) { |
343 |
delSelRecords(); |
343 |
delSelRecords(); |
344 |
} |
344 |
} |
Lines 398-404
function holdSel() {
Link Here
|
398 |
parent.opener.document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers=" + items; |
398 |
parent.opener.document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers=" + items; |
399 |
window.close(); |
399 |
window.close(); |
400 |
} else { |
400 |
} else { |
401 |
alert(MSG_NO_RECORD_SELECTED); |
401 |
alert( __p("Bibliographic record", "No item was selected") ); |
402 |
} |
402 |
} |
403 |
} |
403 |
} |
404 |
|
404 |
|
Lines 430-436
function addSelToShelf() {
Link Here
|
430 |
var loc = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items; |
430 |
var loc = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items; |
431 |
var shelf = open(loc, "shelf", optWin); |
431 |
var shelf = open(loc, "shelf", optWin); |
432 |
} else { |
432 |
} else { |
433 |
alert(MSG_NO_RECORD_SELECTED); |
433 |
alert( __p("Bibliographic record", "No item was selected") ); |
434 |
} |
434 |
} |
435 |
} |
435 |
} |
436 |
|
436 |
|
Lines 444-450
function vShelfAdd() {
Link Here
|
444 |
bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); |
444 |
bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); |
445 |
} |
445 |
} |
446 |
} |
446 |
} |
447 |
if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); } |
447 |
if (bibs.length == 0) { showListsUpdate( __p("Bibliographic record", "No item was selected") ); } |
448 |
return bibs.join("&"); |
448 |
return bibs.join("&"); |
449 |
} else { |
449 |
} else { |
450 |
if (document.bookbag_form.biblionumber.checked) { |
450 |
if (document.bookbag_form.biblionumber.checked) { |
Lines 476-493
function hideCart(){
Link Here
|
476 |
function updateLink(val,op,target){ |
476 |
function updateLink(val,op,target){ |
477 |
if(target){ |
477 |
if(target){ |
478 |
if(op == "add"){ |
478 |
if(op == "add"){ |
479 |
target.$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_IN_CART ).addClass("incart"); |
479 |
target.$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("In your cart") ).addClass("incart"); |
480 |
target.$("a.cartR"+val).show(); |
480 |
target.$("a.cartR"+val).show(); |
481 |
} else { |
481 |
} else { |
482 |
target.$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_NOT_IN_CART ).removeClass("incart").addClass("addtocart cart"+val); |
482 |
target.$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart cart"+val); |
483 |
target.$("a.cartR"+val).hide(); |
483 |
target.$("a.cartR"+val).hide(); |
484 |
} |
484 |
} |
485 |
} else { |
485 |
} else { |
486 |
if(op == "add"){ |
486 |
if(op == "add"){ |
487 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_IN_CART ).addClass("incart"); |
487 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("In your cart") ).addClass("incart"); |
488 |
$("a.cartR"+val).show(); |
488 |
$("a.cartR"+val).show(); |
489 |
} else { |
489 |
} else { |
490 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_NOT_IN_CART ).removeClass("incart").addClass("addtocart cart"+val); |
490 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart cart"+val); |
491 |
$("a.cartR"+val).hide(); |
491 |
$("a.cartR"+val).hide(); |
492 |
} |
492 |
} |
493 |
} |
493 |
} |
Lines 495-504
function updateLink(val,op,target){
Link Here
|
495 |
|
495 |
|
496 |
function updateAllLinks(target){ |
496 |
function updateAllLinks(target){ |
497 |
if(target){ |
497 |
if(target){ |
498 |
target.$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_NOT_IN_CART ).removeClass("incart").addClass("addtocart"); |
498 |
target.$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart"); |
499 |
target.$("a.cartRemove").hide(); |
499 |
target.$("a.cartRemove").hide(); |
500 |
} else { |
500 |
} else { |
501 |
$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_NOT_IN_CART ).removeClass("incart").addClass("addtocart"); |
501 |
$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart"); |
502 |
$("a.cartRemove").hide(); |
502 |
$("a.cartRemove").hide(); |
503 |
} |
503 |
} |
504 |
} |
504 |
} |
505 |
- |
|
|