|
Lines 128-137
function addRecord(val, selection,NoMsgAlert) {
Link Here
|
| 128 |
if (write) { |
128 |
if (write) { |
| 129 |
writeCookie(nameCookie, valCookie); |
129 |
writeCookie(nameCookie, valCookie); |
| 130 |
if (selection) { // when adding a selection of records |
130 |
if (selection) { // when adding a selection of records |
|
|
131 |
updateLink(val,"add"); |
| 131 |
return 1; |
132 |
return 1; |
| 132 |
} |
133 |
} |
| 133 |
if (! NoMsgAlert ) { |
134 |
if (! NoMsgAlert ) { |
| 134 |
showCartUpdate(MSG_RECORD_ADDED); |
135 |
showCartUpdate(MSG_RECORD_ADDED); |
|
|
136 |
updateLink(val,"add"); |
| 135 |
} |
137 |
} |
| 136 |
} |
138 |
} |
| 137 |
} |
139 |
} |
|
Lines 229-240
function selRecord(num, status) {
Link Here
|
| 229 |
document.myform.records.value = str; |
231 |
document.myform.records.value = str; |
| 230 |
} |
232 |
} |
| 231 |
|
233 |
|
|
|
234 |
function delSingleRecord(biblionumber){ |
| 235 |
var nameCookie = "bib_list"; |
| 236 |
var valCookie = readCookie(nameCookie); |
| 237 |
var arrayRecords = valCookie.split("/"); |
| 238 |
var pos = jQuery.inArray(biblionumber,arrayRecords); |
| 239 |
arrayRecords.splice(pos,1); |
| 240 |
valCookie = arrayRecords.join("/"); |
| 241 |
writeCookie( nameCookie, valCookie ); |
| 242 |
updateBasket( arrayRecords.length-1 ); |
| 243 |
updateLink(biblionumber,"del"); |
| 244 |
showCartUpdate(MSG_RECORD_REMOVED); |
| 245 |
} |
| 246 |
|
| 232 |
function delSelRecords() { |
247 |
function delSelRecords() { |
| 233 |
var recordsSel = 0; |
248 |
var recordsSel = 0; |
| 234 |
var end = 0; |
249 |
var end = 0; |
| 235 |
var nameCookie = "bib_list"; |
250 |
var nameCookie = "bib_list"; |
| 236 |
var valCookie = readCookie(nameCookie, 1); |
251 |
var valCookie = readCookie(nameCookie, 1); |
| 237 |
|
|
|
| 238 |
if (valCookie) { |
252 |
if (valCookie) { |
| 239 |
var str = document.myform.records.value; |
253 |
var str = document.myform.records.value; |
| 240 |
if (str.length > 0){ |
254 |
if (str.length > 0){ |
|
Lines 243-251
function delSelRecords() {
Link Here
|
| 243 |
while (!end){ |
257 |
while (!end){ |
| 244 |
s = str.indexOf("/"); |
258 |
s = str.indexOf("/"); |
| 245 |
if (s>0){ |
259 |
if (s>0){ |
| 246 |
num = str.substring(0, s) |
260 |
num = str.substring(0, s); |
| 247 |
str = delRecord(num,str); |
261 |
str = delRecord(num,str); |
| 248 |
str2 = delRecord(num,str2); |
262 |
str2 = delRecord(num,str2); |
|
|
263 |
updateLink(num,"del",top.opener); |
| 249 |
} else { |
264 |
} else { |
| 250 |
end = 1; |
265 |
end = 1; |
| 251 |
} |
266 |
} |
|
Lines 312-317
function delBasket() {
Link Here
|
| 312 |
rep = confirm(MSG_CONFIRM_DEL_BASKET); |
327 |
rep = confirm(MSG_CONFIRM_DEL_BASKET); |
| 313 |
if (rep) { |
328 |
if (rep) { |
| 314 |
delCookie(nameCookie); |
329 |
delCookie(nameCookie); |
|
|
330 |
updateAllLinks(top.opener); |
| 315 |
document.location = "about:blank"; |
331 |
document.location = "about:blank"; |
| 316 |
updateBasket(0,top.opener); |
332 |
updateBasket(0,top.opener); |
| 317 |
window.close(); |
333 |
window.close(); |
|
Lines 383-393
function showLess() {
Link Here
|
| 383 |
|
399 |
|
| 384 |
function updateBasket(updated_value,target) { |
400 |
function updateBasket(updated_value,target) { |
| 385 |
if(target){ |
401 |
if(target){ |
| 386 |
target.$('#basketcount').html("<span>"+updated_value+"</span>"); |
402 |
target.$('#basketcount').html("<span>"+updated_value+"</span>"); |
| 387 |
target.$('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items")); |
403 |
target.$('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items")); |
| 388 |
} else { |
404 |
} else { |
| 389 |
$('#basketcount').html("<span>"+updated_value+"</span>"); |
405 |
$('#basketcount').html("<span>"+updated_value+"</span>"); |
| 390 |
$('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items")); |
406 |
$('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items")); |
| 391 |
} |
407 |
} |
| 392 |
var basketcount = updated_value; |
408 |
var basketcount = updated_value; |
| 393 |
} |
409 |
} |
|
Lines 458-463
function hideLists(){
Link Here
|
| 458 |
$("#listsDetails").fadeOut("fast"); |
474 |
$("#listsDetails").fadeOut("fast"); |
| 459 |
} |
475 |
} |
| 460 |
|
476 |
|
|
|
477 |
function updateLink(val,op,target){ |
| 478 |
if(target){ |
| 479 |
if(op == "add"){ |
| 480 |
target.$("a.cart"+val).html(MSG_ITEM_IN_CART).addClass("incart"); |
| 481 |
target.$("a.cartR"+val).show(); |
| 482 |
} else { |
| 483 |
target.$("a.cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart cart"+val); |
| 484 |
target.$("a.cartR"+val).hide(); |
| 485 |
} |
| 486 |
} else { |
| 487 |
if(op == "add"){ |
| 488 |
$("a.cart"+val).html(MSG_ITEM_IN_CART).addClass("incart"); |
| 489 |
$("a.cartR"+val).show(); |
| 490 |
} else { |
| 491 |
$("a.cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart cart"+val); |
| 492 |
$("a.cartR"+val).hide(); |
| 493 |
} |
| 494 |
} |
| 495 |
} |
| 496 |
|
| 497 |
function updateAllLinks(target){ |
| 498 |
if(target){ |
| 499 |
target.$("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart"); |
| 500 |
target.$("a.cartRemove").hide(); |
| 501 |
} else { |
| 502 |
$("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart"); |
| 503 |
$("a.cartRemove").hide(); |
| 504 |
} |
| 505 |
} |
| 506 |
|
| 461 |
$("#cartDetails").ready(function(){ |
507 |
$("#cartDetails").ready(function(){ |
| 462 |
$("#cartDetails,#cartmenulink").click(function(){ hideCart(); }); |
508 |
$("#cartDetails,#cartmenulink").click(function(){ hideCart(); }); |
| 463 |
$("#cartmenulink").click(function(){ openBasket(); return false; }); |
509 |
$("#cartmenulink").click(function(){ openBasket(); return false; }); |