|
Lines 228-254
Link Here
|
| 228 |
</li> |
228 |
</li> |
| 229 |
[% END # / IF OpacHoldNotes %] |
229 |
[% END # / IF OpacHoldNotes %] |
| 230 |
|
230 |
|
| 231 |
[% IF ( OPACItemHolds ) %] |
231 |
[% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %] |
| 232 |
<!-- ITEM HOLDS --> |
232 |
<!-- ITEM HOLDS --> |
| 233 |
<li class="lradio"> |
233 |
<li class="lradio place_on_type" style="display:none;"> |
| 234 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
234 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
| 235 |
[% UNLESS ( bibitemloo.holdable ) %] |
235 |
[% IF OPACItemHolds == "1" %] |
| 236 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqany_[% bibitemloo.biblionumber %]" class="selectany" value="Any" disabled="disabled" /> |
236 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
237 |
id="reqany_[% bibitemloo.biblionumber %]" |
| 238 |
class="selectany" |
| 239 |
value="Any" |
| 240 |
checked="checked" |
| 241 |
/> |
| 237 |
[% ELSE %] |
242 |
[% ELSE %] |
| 238 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqany_[% bibitemloo.biblionumber %]" class="selectany" value="Any" checked="checked" /> |
243 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
244 |
id="reqany_[% bibitemloo.biblionumber %]" |
| 245 |
class="selectany" |
| 246 |
value="Any" |
| 247 |
/> |
| 239 |
[% END %] |
248 |
[% END %] |
| 240 |
|
|
|
| 241 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
249 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
| 242 |
[% UNLESS ( bibitemloo.holdable ) %] |
250 |
[% IF OPACItemHolds == "force" %] |
| 243 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqspecific_[% bibitemloo.biblionumber %]" class="selectspecific" disabled="disabled" value="Specific" /> |
251 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
252 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
| 253 |
class="selectspecific" |
| 254 |
value="Specific" |
| 255 |
checked="checked" |
| 256 |
/> |
| 244 |
[% ELSE %] |
257 |
[% ELSE %] |
| 245 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqspecific_[% bibitemloo.biblionumber %]" class="selectspecific" value="Specific" /> |
258 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
259 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
| 260 |
class="selectspecific" |
| 261 |
value="Specific" |
| 262 |
/> |
| 246 |
[% END %] |
263 |
[% END %] |
| 247 |
</li> |
264 |
</li> |
| 248 |
[% END # / IF OPACItemHolds %] |
265 |
[% END # / IF OPACItemHolds %] |
| 249 |
</ul> |
266 |
</ul> |
| 250 |
|
267 |
|
| 251 |
[% IF ( OPACItemHolds ) %] |
268 |
[% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %] |
| 252 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
269 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
| 253 |
<caption>Select a specific copy:</caption> |
270 |
<caption>Select a specific copy:</caption> |
| 254 |
<tr> |
271 |
<tr> |
|
Lines 274-280
Link Here
|
| 274 |
[% IF ( itemLoo.available ) %] |
291 |
[% IF ( itemLoo.available ) %] |
| 275 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
292 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
| 276 |
[% ELSE %] |
293 |
[% ELSE %] |
| 277 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" /> |
294 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
|
|
295 |
style="display:none;" /> |
| 278 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
296 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
| 279 |
[% END %] |
297 |
[% END %] |
| 280 |
|
298 |
|
|
Lines 380-385
Link Here
|
| 380 |
$(this).closest("td").find("input").val(""); |
398 |
$(this).closest("td").find("input").val(""); |
| 381 |
e.preventDefault(); |
399 |
e.preventDefault(); |
| 382 |
}); |
400 |
}); |
|
|
401 |
|
| 402 |
// Select the first item available |
| 403 |
function select_first_available(id){ |
| 404 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
| 405 |
$(radios).first().attr("checked", "checked"); |
| 406 |
} |
| 407 |
|
| 383 |
$(document).ready(function() { |
408 |
$(document).ready(function() { |
| 384 |
$("#hold-request-form").preventDoubleFormSubmit(); |
409 |
$("#hold-request-form").preventDoubleFormSubmit(); |
| 385 |
var copiesRowId = null; |
410 |
var copiesRowId = null; |
|
Lines 388-397
Link Here
|
| 388 |
$(".checkitem").parent().click(function(e){ |
413 |
$(".checkitem").parent().click(function(e){ |
| 389 |
if(e.target.tagName.toLowerCase() == 'td'){ |
414 |
if(e.target.tagName.toLowerCase() == 'td'){ |
| 390 |
$(this).find("input.checkitem").each( function() { |
415 |
$(this).find("input.checkitem").each( function() { |
| 391 |
$(this).attr('checked', !$(this).attr('checked')); |
416 |
$(this).attr('checked', 'checked'); |
| 392 |
}); |
417 |
}); |
| 393 |
} |
418 |
} |
| 394 |
}); |
419 |
}); |
|
|
420 |
|
| 421 |
[% FOREACH bibitemloo IN bibitemloop %] |
| 422 |
[% IF bibitemloo.holdable %] |
| 423 |
[% IF OPACItemHolds == 'force' %] |
| 424 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
| 425 |
[% END %] |
| 426 |
[% END %] |
| 427 |
[% END %] |
| 428 |
|
| 429 |
|
| 430 |
// click on a first td check the confirmjs checkbox |
| 431 |
$("td.hold").click(function(e){ |
| 432 |
if(e.target.tagName.toLowerCase() == 'td'){ |
| 433 |
$(this).find("input.confirmjs").each( function() { |
| 434 |
$(this).attr('checked', !$(this).attr('checked')); |
| 435 |
$(this).change(); |
| 436 |
}); |
| 437 |
} |
| 438 |
}); |
| 439 |
|
| 395 |
// Hides all 'specific copy' table rows on load. |
440 |
// Hides all 'specific copy' table rows on load. |
| 396 |
$(".copiesrow").hide(); |
441 |
$(".copiesrow").hide(); |
| 397 |
|
442 |
|
|
Lines 404-412
Link Here
|
| 404 |
} |
449 |
} |
| 405 |
}); |
450 |
}); |
| 406 |
|
451 |
|
| 407 |
$("#place_on_hdr").show(); |
452 |
$(".toggle-hold-options").show(); |
| 408 |
$(".place_on_type").show(); |
|
|
| 409 |
$("#place_on_hdr,.place_on_type,.toggle-hold-options").show(); |
| 410 |
$(".hold-options").hide(); |
453 |
$(".hold-options").hide(); |
| 411 |
$(".holddatefrom,.holddateto").prop("readOnly", true); |
454 |
$(".holddatefrom,.holddateto").prop("readOnly", true); |
| 412 |
|
455 |
|
|
Lines 430-493
Link Here
|
| 430 |
$(".confirmjs_hold").each(function(){ |
473 |
$(".confirmjs_hold").each(function(){ |
| 431 |
var bib = $(this).attr("title"); |
474 |
var bib = $(this).attr("title"); |
| 432 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
475 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
| 433 |
html += "value=\"" + bib + "\"/> " + _("Place a hold on") + " </label> "; |
476 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; |
| 434 |
$(this).html(html); |
477 |
$(this).html(html); |
| 435 |
}); |
478 |
}); |
| 436 |
$(".confirmjs_nohold").each(function(){ |
479 |
$(".confirmjs_nohold").each(function(){ |
| 437 |
var bib = $(this).attr("title"); |
480 |
var bib = $(this).attr("title"); |
| 438 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
481 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
| 439 |
html += "value=\"" + bib + "\"/>" + _("Place a hold on: ") + "</label>"; |
482 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; |
| 440 |
$(this).html(html); |
483 |
$(this).html(html); |
| 441 |
}); |
484 |
}); |
| 442 |
|
485 |
|
| 443 |
// Make sure a specific item was selected where specified |
486 |
// expand or collapse the copiesrow tr |
| 444 |
// before moving on to a new item. |
487 |
function toggle_copiesrow(biblioNum) { |
| 445 |
function changeSelection (newCopiesRowId, isSpecific) { |
488 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
| 446 |
if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) { |
489 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
| 447 |
var biblioNum = suffixOf(copiesRowId, "_"); |
490 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
|
|
491 |
// If the checkbox is checked AND we want a specific item, we display the items block |
| 492 |
if ( $(checkbox).is(":checked") && select_specific ) { |
| 493 |
$(newCopiesRowId).show(); |
| 494 |
} else { |
| 495 |
$(newCopiesRowId).hide(); |
| 496 |
} |
| 497 |
}; |
| 448 |
|
498 |
|
| 449 |
// If the 'specific copy' radio button was checked |
499 |
$("#place_on_hdr").show(); |
| 450 |
if (wasSpecific && (copiesRowId != newCopiesRowId)) { |
|
|
| 451 |
// Find the selected copy |
| 452 |
var item = $(".checkitem_" + biblioNum + ":checked"); |
| 453 |
if ($(item).size() == 0) { |
| 454 |
alert(MSG_NO_COPY_SELECTED); |
| 455 |
return false; |
| 456 |
} |
| 457 |
} |
| 458 |
} |
| 459 |
copiesRowId = newCopiesRowId; |
| 460 |
wasSpecific = isSpecific; |
| 461 |
return true; |
| 462 |
} |
| 463 |
|
500 |
|
| 464 |
// When 'specific copy' radio button is clicked |
501 |
[% IF OPACItemHolds == '1' %] |
| 465 |
$(".selectspecific").click(function() { |
502 |
$(".place_on_type").show(); |
|
|
503 |
// onload, selectany is checked |
| 504 |
$(".selectany").attr("checked", "checked"); |
| 505 |
[% END %] |
| 466 |
|
506 |
|
| 467 |
// Make sure all other specific copy table rows are hidden |
507 |
// If we can choose a specific item, we preselect the first one |
| 468 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
508 |
[% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] |
| 469 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
509 |
$("table.copiesrow").each(function(){ |
|
|
510 |
var id = suffixOf($(this).attr("id"), "_"); |
| 511 |
select_first_available(id); |
| 512 |
}); |
| 513 |
[% END %] |
| 470 |
|
514 |
|
| 471 |
if (!changeSelection(newCopiesRowId, true)) { |
515 |
// On confirmsjs change |
| 472 |
return false; |
516 |
$(".confirmjs").change(function(){ |
|
|
517 |
var id = suffixOf($(this).attr("id"), "_"); |
| 518 |
// If I m checked, I enable radio buttons |
| 519 |
if ( $(this).is(":checked") ) { |
| 520 |
$("#reqspecific_" + id).attr("disabled", false); |
| 521 |
$("#reqany_" + id).attr("disabled", false); |
| 522 |
} |
| 523 |
// Else its are disabled |
| 524 |
else { |
| 525 |
$("#reqspecific_" + id).attr("disabled", "disabled"); |
| 526 |
$("#reqany_" + id).attr("disabled", "disabled"); |
| 473 |
} |
527 |
} |
|
|
528 |
// expand or collaspe the items block |
| 529 |
toggle_copiesrow(id); |
| 530 |
}); |
| 474 |
|
531 |
|
| 475 |
// Show the specific copy table for this radio button. |
532 |
// When 'specific copy' or 'first available' radio button is clicked |
| 476 |
$(newCopiesRowId).show(); |
533 |
$(".selectspecific, .selectany").click(function() { |
|
|
534 |
var id = suffixOf($(this).attr("id"), "_"); |
| 535 |
toggle_copiesrow(id); |
| 477 |
}); |
536 |
}); |
| 478 |
|
537 |
|
| 479 |
// When 'first available' radion button is clicked |
538 |
// Show or hide holds notes |
| 480 |
$(".selectany").click(function() { |
539 |
$(".shownotes").click(function(){ |
| 481 |
// Make sure all other specific copy table rows are hidden |
|
|
| 482 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
540 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
| 483 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
541 |
$("#notesrow_"+biblioNum).toggle(); |
| 484 |
|
|
|
| 485 |
if (!changeSelection(newCopiesRowId, false)) { |
| 486 |
return false; |
| 487 |
} |
| 488 |
|
| 489 |
// Hide the copies table row |
| 490 |
$(newCopiesRowId).hide(); |
| 491 |
}); |
542 |
}); |
| 492 |
|
543 |
|
| 493 |
// When 'Place Hold' button is clicked |
544 |
// When 'Place Hold' button is clicked |
| 494 |
- |
|
|