Lines 14-106
Link Here
|
14 |
return s.substring(index + 1); |
14 |
return s.substring(index + 1); |
15 |
} |
15 |
} |
16 |
|
16 |
|
|
|
17 |
// Select the first item available |
18 |
function select_first_available(id){ |
19 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
20 |
$(radios).first().attr("checked", "checked"); |
21 |
} |
22 |
|
17 |
$(document).ready(function() { |
23 |
$(document).ready(function() { |
18 |
$('#hold-request-form').preventDoubleFormSubmit(); |
24 |
$('#hold-request-form').preventDoubleFormSubmit(); |
19 |
|
25 |
|
20 |
var copiesRowId = null; |
26 |
var copiesRowId = null; |
21 |
var wasSpecific = false; |
27 |
var wasSpecific = false; |
22 |
var lastCopiesRowId = null; |
28 |
var lastCopiesRowId = null; |
23 |
$(".checkitem").parent().click(function(e){ |
29 |
$(".checkitem").parent().click(function(e){ |
24 |
if(e.target.tagName.toLowerCase() == 'td'){ |
30 |
if(e.target.tagName.toLowerCase() == 'td'){ |
25 |
$(this).find("input.checkitem").each( function() { |
31 |
$(this).find("input.checkitem").each( function() { |
26 |
$(this).attr('checked', !$(this).attr('checked')); |
32 |
$(this).attr('checked', 'checked'); |
27 |
}); |
33 |
}); |
28 |
} |
34 |
} |
29 |
}); |
35 |
}); |
|
|
36 |
|
37 |
// click on a first td check the confirmjs checkbox |
38 |
$("td.hold").click(function(e){ |
39 |
if(e.target.tagName.toLowerCase() == 'td'){ |
40 |
$(this).find("input.confirmjs").each( function() { |
41 |
$(this).attr('checked', !$(this).attr('checked')); |
42 |
$(this).change(); |
43 |
}); |
44 |
} |
45 |
}); |
46 |
|
30 |
// Hides all 'specific copy' table rows on load. |
47 |
// Hides all 'specific copy' table rows on load. |
31 |
$(".copiesrow").hide(); |
48 |
$(".copiesrow").hide(); |
32 |
|
49 |
|
33 |
$("#place_on_hdr").show(); |
|
|
34 |
[% IF OPACItemHolds == '1' %] |
35 |
$(".place_on_type").show(); |
36 |
[% END %] |
37 |
|
38 |
// Replace non-JS single-selection with multi-selection capability. |
50 |
// Replace non-JS single-selection with multi-selection capability. |
39 |
$(".reserve_mode").val("multi"); |
51 |
$(".reserve_mode").val("multi"); |
40 |
$(".confirm_nonjs").remove(); |
52 |
$(".confirm_nonjs").remove(); |
41 |
$(".confirmjs_hold").each(function(){ |
53 |
$(".confirmjs_hold").each(function(){ |
42 |
var bib = $(this).attr("title"); |
54 |
var bib = $(this).attr("title"); |
43 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
55 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
44 |
html += "value=\"" + bib + "\"/>"; |
56 |
html += "value=\"" + bib + "\" id=\"" + bib + "\"/>"; |
45 |
$(this).html(html); |
|
|
46 |
}); |
47 |
$(".confirmjs_nohold").each(function(){ |
48 |
var bib = $(this).attr("title"); |
49 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
50 |
html += "value=\"" + bib + "\"/>"; |
51 |
$(this).html(html); |
57 |
$(this).html(html); |
52 |
}); |
58 |
}); |
53 |
|
59 |
|
54 |
// Make sure a specific item was selected where specified |
60 |
// expand or collapse the copiesrow tr |
55 |
// before moving on to a new item. |
61 |
function toggle_copiesrow(biblioNum) { |
56 |
function changeSelection (newCopiesRowId, isSpecific) { |
62 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
57 |
if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) { |
|
|
58 |
var biblioNum = suffixOf(copiesRowId, "_"); |
59 |
|
60 |
// If the 'specific copy' radio button was checked |
61 |
if (wasSpecific && (copiesRowId != newCopiesRowId)) { |
62 |
// Find the selected copy |
63 |
var item = $(".checkitem_" + biblioNum + ":checked"); |
64 |
if ($(item).size() == 0) { |
65 |
alert(MSG_NO_COPY_SELECTED); |
66 |
return false; |
67 |
} |
68 |
} |
69 |
} |
70 |
copiesRowId = newCopiesRowId; |
71 |
wasSpecific = isSpecific; |
72 |
return true; |
73 |
} |
74 |
|
75 |
// When 'specific copy' radio button is clicked |
76 |
$(".selectspecific").click(function() { |
77 |
|
78 |
// Make sure all other specific copy table rows are hidden |
79 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
80 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
63 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
64 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
81 |
|
65 |
|
82 |
if (!changeSelection(newCopiesRowId, true)) { |
66 |
// If the checkbox is checked AND we want a specific item, we display the items block |
83 |
return false; |
67 |
if ( $(checkbox).is(":checked") && select_specific ) { |
|
|
68 |
$(newCopiesRowId).show(); |
69 |
} else { |
70 |
$(newCopiesRowId).hide(); |
84 |
} |
71 |
} |
85 |
$(".copiesrow:not(" + newCopiesRowId + ")").hide(); |
72 |
}; |
86 |
|
73 |
|
87 |
// Show the specific copy table for this radio button. |
74 |
$("#place_on_hdr").show(); |
88 |
$(newCopiesRowId).show(); |
|
|
89 |
}); |
90 |
|
75 |
|
|
|
76 |
[% IF OPACItemHolds == '1' %] |
77 |
$(".place_on_type").show(); |
78 |
// onload, selectany is checked |
79 |
$(".selectany").attr("checked", "checked"); |
80 |
[% END %] |
91 |
|
81 |
|
92 |
// When 'first available' radion button is clicked |
82 |
// If we can choose a specific item, we preselect the first one |
93 |
$(".selectany").click(function() { |
83 |
[% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] |
94 |
// Make sure all other specific copy table rows are hidden |
84 |
$("tr.hold").each(function(){ |
95 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
85 |
var id = suffixOf($(this).attr("id"), "_"); |
96 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
86 |
select_first_available(id); |
|
|
87 |
}); |
88 |
[% END %] |
97 |
|
89 |
|
98 |
if (!changeSelection(newCopiesRowId, false)) { |
90 |
// On confirmsjs change |
99 |
return false; |
91 |
$(".confirmjs").change(function(){ |
|
|
92 |
var id = suffixOf($(this).attr("id"), "_"); |
93 |
// If I m checked, I enable radio buttons |
94 |
if ( $(this).is(":checked") ) { |
95 |
$("#reqspecific_" + id).attr("disabled", false); |
96 |
$("#reqany_" + id).attr("disabled", false); |
100 |
} |
97 |
} |
101 |
|
98 |
// Else its are disabled |
102 |
// Hide the copies table row |
99 |
else { |
103 |
$(".copiesrow").hide(); |
100 |
$("#reqspecific_" + id).attr("disabled", "disabled"); |
|
|
101 |
$("#reqany_" + id).attr("disabled", "disabled"); |
102 |
} |
103 |
// expand or collaspe the items block |
104 |
toggle_copiesrow(id); |
105 |
}); |
106 |
|
107 |
// When 'specific copy' or 'first available' radio button is clicked |
108 |
$(".selectspecific, .selectany").click(function() { |
109 |
var id = suffixOf($(this).attr("id"), "_"); |
110 |
toggle_copiesrow(id); |
104 |
}); |
111 |
}); |
105 |
|
112 |
|
106 |
// When 'Place Hold' button is clicked |
113 |
// When 'Place Hold' button is clicked |
Lines 237-242
Link Here
|
237 |
<input type="hidden" name="selecteditems" id="selections"/> |
244 |
<input type="hidden" name="selecteditems" id="selections"/> |
238 |
<div id="bigloop"> |
245 |
<div id="bigloop"> |
239 |
<table id="bibitemloop"> |
246 |
<table id="bibitemloop"> |
|
|
247 |
<thead> |
240 |
[% UNLESS ( none_available ) %]<tr> |
248 |
[% UNLESS ( none_available ) %]<tr> |
241 |
<th>Hold</th> |
249 |
<th>Hold</th> |
242 |
<th>Title</th> |
250 |
<th>Title</th> |
Lines 258-273
Link Here
|
258 |
<th id="place_on_hdr" style="display:none">Place On</th> |
266 |
<th id="place_on_hdr" style="display:none">Place On</th> |
259 |
[% END %] |
267 |
[% END %] |
260 |
[% UNLESS ( singleBranchMode ) %] |
268 |
[% UNLESS ( singleBranchMode ) %] |
261 |
[% IF ( choose_branch ) %] |
269 |
[% IF ( choose_branch ) %] |
262 |
<th>Pickup location</th> |
270 |
<th>Pickup location</th> |
263 |
[% END %] |
271 |
[% END %] |
264 |
[% END %] |
272 |
[% END %] |
265 |
</tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %] |
273 |
</tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %] |
266 |
|
274 |
</thead> |
|
|
275 |
<tbody> |
267 |
[% FOREACH bibitemloo IN bibitemloop %] |
276 |
[% FOREACH bibitemloo IN bibitemloop %] |
268 |
<tr> |
277 |
<tr id="hold_[% bibitemloo.biblionumber %]" class="hold"> |
269 |
[% IF ( bibitemloo.holdable ) %] |
278 |
[% IF ( bibitemloo.holdable ) %] |
270 |
<td class="hold"> |
279 |
<td class="hold"> |
271 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
280 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
272 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> |
281 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> |
273 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span> |
282 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span> |
Lines 278-287
Link Here
|
278 |
value="any" /> |
287 |
value="any" /> |
279 |
<label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label> |
288 |
<label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label> |
280 |
</span> |
289 |
</span> |
281 |
</td> |
290 |
</td> |
282 |
[% ELSE %] |
291 |
[% ELSE %] |
283 |
[% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] |
292 |
[% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] |
284 |
[% END %] |
293 |
[% END %] |
285 |
[% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="5">[% END %] |
294 |
[% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="5">[% END %] |
286 |
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% bibitemloo.biblionumber %]">[% bibitemloo.title |html %][% IF ( bibitemloo.subtitle ) %] [% FOREACH subtitl IN bibitemloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a> |
295 |
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% bibitemloo.biblionumber %]">[% bibitemloo.title |html %][% IF ( bibitemloo.subtitle ) %] [% FOREACH subtitl IN bibitemloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a> |
287 |
[% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] |
296 |
[% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] |
Lines 490-495
Link Here
|
490 |
[% END %]<!-- bib_available --> |
499 |
[% END %]<!-- bib_available --> |
491 |
[% END %]<!-- OPACItemHolds --> |
500 |
[% END %]<!-- OPACItemHolds --> |
492 |
[% END %] |
501 |
[% END %] |
|
|
502 |
</tbody> |
493 |
</table><!-- bibitemloop --> |
503 |
</table><!-- bibitemloop --> |
494 |
[% END %] <!-- if message --> |
504 |
[% END %] <!-- if message --> |
495 |
</div><!-- bigloop --> |
505 |
</div><!-- bigloop --> |
496 |
- |
|
|