Lines 19-37
Link Here
|
19 |
return s.substring(index + 1); |
19 |
return s.substring(index + 1); |
20 |
} |
20 |
} |
21 |
|
21 |
|
|
|
22 |
// Select the first item available |
23 |
function select_first_available(id){ |
24 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
25 |
$(radios).first().attr("checked", "checked"); |
26 |
} |
27 |
|
22 |
$(document).ready(function() { |
28 |
$(document).ready(function() { |
23 |
$('#hold-request-form').preventDoubleFormSubmit(); |
29 |
$('#hold-request-form').preventDoubleFormSubmit(); |
24 |
|
30 |
|
25 |
var copiesRowId = null; |
31 |
var copiesRowId = null; |
26 |
var wasSpecific = false; |
32 |
var wasSpecific = false; |
27 |
var lastCopiesRowId = null; |
33 |
var lastCopiesRowId = null; |
28 |
$(".checkitem").parent().click(function(e){ |
34 |
$(".checkitem").parent().click(function(e){ |
29 |
if(e.target.tagName.toLowerCase() == 'td'){ |
35 |
if(e.target.tagName.toLowerCase() == 'td'){ |
30 |
$(this).find("input.checkitem").each( function() { |
36 |
$(this).find("input.checkitem").each( function() { |
31 |
$(this).attr('checked', !$(this).attr('checked')); |
37 |
$(this).attr('checked', 'checked'); |
32 |
}); |
38 |
}); |
33 |
} |
39 |
} |
34 |
}); |
40 |
}); |
|
|
41 |
|
42 |
// click on a first td check the confirmjs checkbox |
43 |
$("td.hold").click(function(e){ |
44 |
if(e.target.tagName.toLowerCase() == 'td'){ |
45 |
$(this).find("input.confirmjs").each( function() { |
46 |
$(this).attr('checked', !$(this).attr('checked')); |
47 |
$(this).change(); |
48 |
}); |
49 |
} |
50 |
}); |
51 |
|
35 |
// Hides all 'specific copy' table rows on load. |
52 |
// Hides all 'specific copy' table rows on load. |
36 |
$(".copiesrow").hide(); |
53 |
$(".copiesrow").hide(); |
37 |
|
54 |
|
Lines 44-50
Link Here
|
44 |
} |
61 |
} |
45 |
}); |
62 |
}); |
46 |
|
63 |
|
47 |
$("#place_on_hdr,.place_on_type,.toggle-hold-options").show(); |
64 |
$(".toggle-hold-options").show(); |
48 |
$(".hold-options").hide(); |
65 |
$(".hold-options").hide(); |
49 |
$(".holddatefrom,.holddateto").prop("readOnly", true); |
66 |
$(".holddatefrom,.holddateto").prop("readOnly", true); |
50 |
|
67 |
|
Lines 68-132
Link Here
|
68 |
$(".confirmjs_hold").each(function(){ |
85 |
$(".confirmjs_hold").each(function(){ |
69 |
var bib = $(this).attr("title"); |
86 |
var bib = $(this).attr("title"); |
70 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
87 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
71 |
html += "value=\"" + bib + "\"/> " + _("Place a hold on") + " </label> "; |
88 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; |
72 |
$(this).html(html); |
89 |
$(this).html(html); |
73 |
}); |
90 |
}); |
74 |
$(".confirmjs_nohold").each(function(){ |
91 |
$(".confirmjs_nohold").each(function(){ |
75 |
var bib = $(this).attr("title"); |
92 |
var bib = $(this).attr("title"); |
76 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
93 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
77 |
html += "value=\"" + bib + "\"/>" + _("Place a hold on: ") + "</label>"; |
94 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; |
78 |
$(this).html(html); |
95 |
$(this).html(html); |
79 |
}); |
96 |
}); |
80 |
|
97 |
|
81 |
// Make sure a specific item was selected where specified |
98 |
// expand or collapse the copiesrow tr |
82 |
// before moving on to a new item. |
99 |
function toggle_copiesrow(biblioNum) { |
83 |
function changeSelection (newCopiesRowId, isSpecific) { |
100 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
84 |
if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) { |
|
|
85 |
var biblioNum = suffixOf(copiesRowId, "_"); |
86 |
|
87 |
// If the 'specific copy' radio button was checked |
88 |
if (wasSpecific && (copiesRowId != newCopiesRowId)) { |
89 |
// Find the selected copy |
90 |
var item = $(".checkitem_" + biblioNum + ":checked"); |
91 |
if ($(item).size() == 0) { |
92 |
alert(MSG_NO_COPY_SELECTED); |
93 |
return false; |
94 |
} |
95 |
} |
96 |
} |
97 |
copiesRowId = newCopiesRowId; |
98 |
wasSpecific = isSpecific; |
99 |
return true; |
100 |
} |
101 |
|
102 |
// When 'specific copy' radio button is clicked |
103 |
$(".selectspecific").click(function() { |
104 |
|
105 |
// Make sure all other specific copy table rows are hidden |
106 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
107 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
101 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
102 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
108 |
|
103 |
|
109 |
if (!changeSelection(newCopiesRowId, true)) { |
104 |
// If the checkbox is checked AND we want a specific item, we display the items block |
110 |
return false; |
105 |
if ( $(checkbox).is(":checked") && select_specific ) { |
|
|
106 |
$(newCopiesRowId).show(); |
107 |
} else { |
108 |
$(newCopiesRowId).hide(); |
111 |
} |
109 |
} |
|
|
110 |
}; |
112 |
|
111 |
|
113 |
// Show the specific copy table for this radio button. |
112 |
$("#place_on_hdr").show(); |
114 |
$(newCopiesRowId).show(); |
|
|
115 |
}); |
116 |
|
113 |
|
|
|
114 |
[% IF OPACItemHolds == '1' %] |
115 |
$(".place_on_type").show(); |
116 |
// onload, selectany is checked |
117 |
$(".selectany").attr("checked", "checked"); |
118 |
[% END %] |
117 |
|
119 |
|
118 |
// When 'first available' radion button is clicked |
120 |
// If we can choose a specific item, we preselect the first one |
119 |
$(".selectany").click(function() { |
121 |
[% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] |
120 |
// Make sure all other specific copy table rows are hidden |
122 |
$("table.copiesrow").each(function(){ |
121 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
123 |
var id = suffixOf($(this).attr("id"), "_"); |
122 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
124 |
select_first_available(id); |
|
|
125 |
}); |
126 |
[% END %] |
123 |
|
127 |
|
124 |
if (!changeSelection(newCopiesRowId, false)) { |
128 |
// On confirmsjs change |
125 |
return false; |
129 |
$(".confirmjs").change(function(){ |
|
|
130 |
var id = suffixOf($(this).attr("id"), "_"); |
131 |
// If I m checked, I enable radio buttons |
132 |
if ( $(this).is(":checked") ) { |
133 |
$("#reqspecific_" + id).attr("disabled", false); |
134 |
$("#reqany_" + id).attr("disabled", false); |
135 |
} |
136 |
// Else its are disabled |
137 |
else { |
138 |
$("#reqspecific_" + id).attr("disabled", "disabled"); |
139 |
$("#reqany_" + id).attr("disabled", "disabled"); |
126 |
} |
140 |
} |
|
|
141 |
// expand or collaspe the items block |
142 |
toggle_copiesrow(id); |
143 |
}); |
144 |
|
145 |
// When 'specific copy' or 'first available' radio button is clicked |
146 |
$(".selectspecific, .selectany").click(function() { |
147 |
var id = suffixOf($(this).attr("id"), "_"); |
148 |
toggle_copiesrow(id); |
149 |
}); |
127 |
|
150 |
|
128 |
// Hide the copies table row |
151 |
// Show or hide holds notes |
129 |
$(newCopiesRowId).hide(); |
152 |
$(".shownotes").click(function(){ |
|
|
153 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
154 |
$("#notesrow_"+biblioNum).toggle(); |
130 |
}); |
155 |
}); |
131 |
|
156 |
|
132 |
// When 'Place Hold' button is clicked |
157 |
// When 'Place Hold' button is clicked |
Lines 175-181
Link Here
|
175 |
|
200 |
|
176 |
$("#selections").val(selections); |
201 |
$("#selections").val(selections); |
177 |
$("#biblionumbers").val(biblionumbers); |
202 |
$("#biblionumbers").val(biblionumbers); |
178 |
|
|
|
179 |
return true; |
203 |
return true; |
180 |
}); |
204 |
}); |
181 |
$(".toggle-hold-options").on("click",function(e){ |
205 |
$(".toggle-hold-options").on("click",function(e){ |
Lines 422-469
Link Here
|
422 |
|
446 |
|
423 |
[% IF ( bibitemloo.holdable ) %] |
447 |
[% IF ( bibitemloo.holdable ) %] |
424 |
<!-- HOLD ABLE --> |
448 |
<!-- HOLD ABLE --> |
425 |
[% IF ( OPACItemHolds ) %] |
449 |
[% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %] |
426 |
<!-- ITEM HOLDS --> |
450 |
<!-- ITEM HOLDS --> |
427 |
|
451 |
|
428 |
<li class="radio"> |
452 |
<li class="radio place_on_type" style="display:none;"> |
429 |
[% UNLESS ( bibitemloo.holdable ) %] |
453 |
[% IF OPACItemHolds == "1" %] |
430 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
454 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
431 |
id="reqany_[% bibitemloo.biblionumber %]" |
455 |
id="reqany_[% bibitemloo.biblionumber %]" |
432 |
class="selectany" |
456 |
class="selectany" |
433 |
value="Any" |
457 |
value="Any" |
434 |
disabled="disabled" |
458 |
checked="checked" |
435 |
/> |
459 |
/> |
436 |
[% ELSE %] |
460 |
[% ELSE %] |
437 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
461 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
438 |
id="reqany_[% bibitemloo.biblionumber %]" |
462 |
id="reqany_[% bibitemloo.biblionumber %]" |
439 |
class="selectany" |
463 |
class="selectany" |
440 |
value="Any" |
464 |
value="Any" |
441 |
checked="checked" |
465 |
/> |
442 |
/> |
|
|
443 |
[% END %] |
466 |
[% END %] |
444 |
|
|
|
445 |
<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
467 |
<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
446 |
[% UNLESS ( bibitemloo.holdable ) %] |
468 |
[% IF OPACItemHolds == "force" %] |
447 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
469 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
448 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
470 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
449 |
class="selectspecific" |
471 |
class="selectspecific" |
450 |
disabled="disabled" |
472 |
value="Specific" |
451 |
value="Specific" |
473 |
checked="checked" |
452 |
/> |
474 |
/> |
453 |
[% ELSE %] |
475 |
[% ELSE %] |
454 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
476 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
455 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
477 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
456 |
class="selectspecific" |
478 |
class="selectspecific" |
457 |
value="Specific" |
479 |
value="Specific" |
458 |
/> |
480 |
/> |
459 |
[% END %] |
481 |
[% END %] |
460 |
<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
482 |
<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
461 |
</li> |
483 |
</li> |
462 |
|
484 |
|
|
|
485 |
[% IF OPACItemHolds == 'force' %] |
486 |
<script type="text/javascript"> |
487 |
$(document).ready(function() { |
488 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
489 |
}); |
490 |
</script> |
491 |
[% END %] |
492 |
|
463 |
[% END %] |
493 |
[% END %] |
464 |
</ul> |
494 |
</ul> |
465 |
[% END %] |
495 |
[% END %] |
466 |
[% IF ( OPACItemHolds ) %] |
496 |
[% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %] |
467 |
[% IF ( bibitemloo.holdable ) %] |
497 |
[% IF ( bibitemloo.holdable ) %] |
468 |
|
498 |
|
469 |
<table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> |
499 |
<table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> |
Lines 492-498
Link Here
|
492 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" |
522 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" |
493 |
value="[% itemLoo.itemnumber %]" /> |
523 |
value="[% itemLoo.itemnumber %]" /> |
494 |
[% ELSE %] |
524 |
[% ELSE %] |
495 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" /> |
525 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
|
|
526 |
style="display:none;" /> |
496 |
<img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
527 |
<img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
497 |
[% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %] |
528 |
[% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %] |
498 |
</td> |
529 |
</td> |
Lines 548-554
Link Here
|
548 |
|
579 |
|
549 |
</div> |
580 |
</div> |
550 |
[% END %] |
581 |
[% END %] |
551 |
|
|
|
552 |
[% END %] <!-- if message --> |
582 |
[% END %] <!-- if message --> |
553 |
</div><!-- bigloop --> |
583 |
</div><!-- bigloop --> |
554 |
|
584 |
|
555 |
- |
|
|