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 388-394
function holdSel() {
Link Here
|
388 |
parent.opener.document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers=" + items; |
388 |
parent.opener.document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers=" + items; |
389 |
window.close(); |
389 |
window.close(); |
390 |
} else { |
390 |
} else { |
391 |
alert(MSG_NO_RECORD_SELECTED); |
391 |
alert( __p("Bibliographic record", "No item was selected") ); |
392 |
} |
392 |
} |
393 |
} |
393 |
} |
394 |
|
394 |
|
Lines 420-426
function addSelToShelf() {
Link Here
|
420 |
var loc = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items; |
420 |
var loc = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items; |
421 |
var shelf = open(loc, "shelf", optWin); |
421 |
var shelf = open(loc, "shelf", optWin); |
422 |
} else { |
422 |
} else { |
423 |
alert(MSG_NO_RECORD_SELECTED); |
423 |
alert( __p("Bibliographic record", "No item was selected") ); |
424 |
} |
424 |
} |
425 |
} |
425 |
} |
426 |
|
426 |
|
Lines 434-440
function vShelfAdd() {
Link Here
|
434 |
bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); |
434 |
bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); |
435 |
} |
435 |
} |
436 |
} |
436 |
} |
437 |
if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); } |
437 |
if (bibs.length == 0) { showListsUpdate( __p("Bibliographic record", "No item was selected") ); } |
438 |
return bibs.join("&"); |
438 |
return bibs.join("&"); |
439 |
} else { |
439 |
} else { |
440 |
if (document.bookbag_form.biblionumber.checked) { |
440 |
if (document.bookbag_form.biblionumber.checked) { |
Lines 466-483
function hideCart(){
Link Here
|
466 |
function updateLink(val,op,target){ |
466 |
function updateLink(val,op,target){ |
467 |
if(target){ |
467 |
if(target){ |
468 |
if(op == "add"){ |
468 |
if(op == "add"){ |
469 |
target.$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_IN_CART ).addClass("incart"); |
469 |
target.$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("In your cart") ).addClass("incart"); |
470 |
target.$("a.cartR"+val).show(); |
470 |
target.$("a.cartR"+val).show(); |
471 |
} else { |
471 |
} else { |
472 |
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); |
472 |
target.$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart cart"+val); |
473 |
target.$("a.cartR"+val).hide(); |
473 |
target.$("a.cartR"+val).hide(); |
474 |
} |
474 |
} |
475 |
} else { |
475 |
} else { |
476 |
if(op == "add"){ |
476 |
if(op == "add"){ |
477 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_IN_CART ).addClass("incart"); |
477 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("In your cart") ).addClass("incart"); |
478 |
$("a.cartR"+val).show(); |
478 |
$("a.cartR"+val).show(); |
479 |
} else { |
479 |
} else { |
480 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_NOT_IN_CART ).removeClass("incart").addClass("addtocart cart"+val); |
480 |
$("a.cart"+val).html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart cart"+val); |
481 |
$("a.cartR"+val).hide(); |
481 |
$("a.cartR"+val).hide(); |
482 |
} |
482 |
} |
483 |
} |
483 |
} |
Lines 485-494
function updateLink(val,op,target){
Link Here
|
485 |
|
485 |
|
486 |
function updateAllLinks(target){ |
486 |
function updateAllLinks(target){ |
487 |
if(target){ |
487 |
if(target){ |
488 |
target.$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_NOT_IN_CART ).removeClass("incart").addClass("addtocart"); |
488 |
target.$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart"); |
489 |
target.$("a.cartRemove").hide(); |
489 |
target.$("a.cartRemove").hide(); |
490 |
} else { |
490 |
} else { |
491 |
$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + MSG_ITEM_NOT_IN_CART ).removeClass("incart").addClass("addtocart"); |
491 |
$("a.incart").html( "<i class=\"fa fa-fw fa-shopping-cart\"></i> " + __("Add to cart") ).removeClass("incart").addClass("addtocart"); |
492 |
$("a.cartRemove").hide(); |
492 |
$("a.cartRemove").hide(); |
493 |
} |
493 |
} |
494 |
} |
494 |
} |
495 |
- |
|
|