Lines 17-35
Link Here
|
17 |
return s.substring(index + 1); |
17 |
return s.substring(index + 1); |
18 |
} |
18 |
} |
19 |
|
19 |
|
|
|
20 |
// Select the first item available |
21 |
function select_first_available(id){ |
22 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
23 |
$(radios).first().attr("checked", "checked"); |
24 |
} |
25 |
|
20 |
$(document).ready(function() { |
26 |
$(document).ready(function() { |
21 |
$('#hold-request-form').preventDoubleFormSubmit(); |
27 |
$('#hold-request-form').preventDoubleFormSubmit(); |
22 |
|
28 |
|
23 |
var copiesRowId = null; |
29 |
var copiesRowId = null; |
24 |
var wasSpecific = false; |
30 |
var wasSpecific = false; |
25 |
var lastCopiesRowId = null; |
31 |
var lastCopiesRowId = null; |
26 |
$(".checkitem").parent().click(function(e){ |
32 |
$(".checkitem").parent().click(function(e){ |
27 |
if(e.target.tagName.toLowerCase() == 'td'){ |
33 |
if(e.target.tagName.toLowerCase() == 'td'){ |
28 |
$(this).find("input.checkitem").each( function() { |
34 |
$(this).find("input.checkitem").each( function() { |
29 |
$(this).attr('checked', !$(this).attr('checked')); |
35 |
$(this).attr('checked', 'checked'); |
30 |
}); |
36 |
}); |
31 |
} |
37 |
} |
32 |
}); |
38 |
}); |
|
|
39 |
|
40 |
// click on a first td check the confirmjs checkbox |
41 |
$("td.hold").click(function(e){ |
42 |
if(e.target.tagName.toLowerCase() == 'td'){ |
43 |
$(this).find("input.confirmjs").each( function() { |
44 |
$(this).attr('checked', !$(this).attr('checked')); |
45 |
$(this).change(); |
46 |
}); |
47 |
} |
48 |
}); |
49 |
|
33 |
// Hides all 'specific copy' table rows on load. |
50 |
// Hides all 'specific copy' table rows on load. |
34 |
$(".copiesrow").hide(); |
51 |
$(".copiesrow").hide(); |
35 |
$(".notesrow").hide(); |
52 |
$(".notesrow").hide(); |
Lines 43-117
Link Here
|
43 |
} |
60 |
} |
44 |
}); |
61 |
}); |
45 |
|
62 |
|
46 |
$("#place_on_hdr").show(); |
|
|
47 |
$(".place_on_type").show(); |
48 |
|
49 |
// Replace non-JS single-selection with multi-selection capability. |
63 |
// Replace non-JS single-selection with multi-selection capability. |
50 |
$(".reserve_mode").val("multi"); |
64 |
$(".reserve_mode").val("multi"); |
51 |
$(".confirm_nonjs").remove(); |
65 |
$(".confirm_nonjs").remove(); |
52 |
$(".confirmjs_hold").each(function(){ |
66 |
$(".confirmjs_hold").each(function(){ |
53 |
var bib = $(this).attr("title"); |
67 |
var bib = $(this).attr("title"); |
54 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
68 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
55 |
html += "value=\"" + bib + "\"/>"; |
69 |
html += "value=\"" + bib + "\" id=\"" + bib + "\"/>"; |
56 |
$(this).html(html); |
|
|
57 |
}); |
58 |
$(".confirmjs_nohold").each(function(){ |
59 |
var bib = $(this).attr("title"); |
60 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
61 |
html += "value=\"" + bib + "\"/>"; |
62 |
$(this).html(html); |
70 |
$(this).html(html); |
63 |
}); |
71 |
}); |
64 |
|
72 |
|
65 |
// Make sure a specific item was selected where specified |
73 |
// expand or collapse the copiesrow tr |
66 |
// before moving on to a new item. |
74 |
function toggle_copiesrow(biblioNum) { |
67 |
function changeSelection (newCopiesRowId, isSpecific) { |
75 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
68 |
if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) { |
|
|
69 |
var biblioNum = suffixOf(copiesRowId, "_"); |
70 |
|
71 |
// If the 'specific copy' radio button was checked |
72 |
if (wasSpecific && (copiesRowId != newCopiesRowId)) { |
73 |
// Find the selected copy |
74 |
var item = $(".checkitem_" + biblioNum + ":checked"); |
75 |
if ($(item).size() == 0) { |
76 |
alert(MSG_NO_COPY_SELECTED); |
77 |
return false; |
78 |
} |
79 |
} |
80 |
} |
81 |
copiesRowId = newCopiesRowId; |
82 |
wasSpecific = isSpecific; |
83 |
return true; |
84 |
} |
85 |
|
86 |
// When 'specific copy' radio button is clicked |
87 |
$(".selectspecific").click(function() { |
88 |
|
89 |
// Make sure all other specific copy table rows are hidden |
90 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
91 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
76 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
77 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
92 |
|
78 |
|
93 |
if (!changeSelection(newCopiesRowId, true)) { |
79 |
// If the checkbox is checked AND we want a specific item, we display the items block |
94 |
return false; |
80 |
if ( $(checkbox).is(":checked") && select_specific ) { |
|
|
81 |
$(newCopiesRowId).show(); |
82 |
} else { |
83 |
$(newCopiesRowId).hide(); |
95 |
} |
84 |
} |
96 |
$(".copiesrow:not(" + newCopiesRowId + ")").hide(); |
85 |
}; |
97 |
|
|
|
98 |
// Show the specific copy table for this radio button. |
99 |
$(newCopiesRowId).show(); |
100 |
}); |
101 |
|
86 |
|
|
|
87 |
$("#place_on_hdr").show(); |
102 |
|
88 |
|
103 |
// When 'first available' radion button is clicked |
89 |
[% IF OPACItemHolds == '1' %] |
104 |
$(".selectany").click(function() { |
90 |
$(".place_on_type").show(); |
105 |
// Make sure all other specific copy table rows are hidden |
91 |
// onload, selectany is checked |
106 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
92 |
$(".selectany").attr("checked", "checked"); |
107 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
93 |
[% END %] |
108 |
|
94 |
|
109 |
if (!changeSelection(newCopiesRowId, false)) { |
95 |
// If we can choose a specific item, we preselect the first one |
110 |
return false; |
96 |
[% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] |
|
|
97 |
$("tr.hold").each(function(){ |
98 |
var id = suffixOf($(this).attr("id"), "_"); |
99 |
select_first_available(id); |
100 |
}); |
101 |
[% END %] |
102 |
|
103 |
// On confirmsjs change |
104 |
$(".confirmjs").change(function(){ |
105 |
var id = suffixOf($(this).attr("id"), "_"); |
106 |
// If I m checked, I enable radio buttons |
107 |
if ( $(this).is(":checked") ) { |
108 |
$("#reqspecific_" + id).attr("disabled", false); |
109 |
$("#reqany_" + id).attr("disabled", false); |
111 |
} |
110 |
} |
112 |
|
111 |
// Else its are disabled |
113 |
// Hide the copies table row |
112 |
else { |
114 |
$(".copiesrow").hide(); |
113 |
$("#reqspecific_" + id).attr("disabled", "disabled"); |
|
|
114 |
$("#reqany_" + id).attr("disabled", "disabled"); |
115 |
} |
116 |
// expand or collaspe the items block |
117 |
toggle_copiesrow(id); |
118 |
}); |
119 |
|
120 |
// When 'specific copy' or 'first available' radio button is clicked |
121 |
$(".selectspecific, .selectany").click(function() { |
122 |
var id = suffixOf($(this).attr("id"), "_"); |
123 |
toggle_copiesrow(id); |
115 |
}); |
124 |
}); |
116 |
|
125 |
|
117 |
// Show or hide holds notes |
126 |
// Show or hide holds notes |
Lines 166-172
Link Here
|
166 |
|
175 |
|
167 |
$("#selections").val(selections); |
176 |
$("#selections").val(selections); |
168 |
$("#biblionumbers").val(biblionumbers); |
177 |
$("#biblionumbers").val(biblionumbers); |
169 |
|
|
|
170 |
return true; |
178 |
return true; |
171 |
}); |
179 |
}); |
172 |
|
180 |
|
Lines 255-260
Link Here
|
255 |
<input type="hidden" name="selecteditems" id="selections"/> |
263 |
<input type="hidden" name="selecteditems" id="selections"/> |
256 |
<div id="bigloop"> |
264 |
<div id="bigloop"> |
257 |
<table id="bibitemloop"> |
265 |
<table id="bibitemloop"> |
|
|
266 |
<thead> |
258 |
[% UNLESS ( none_available ) %]<tr> |
267 |
[% UNLESS ( none_available ) %]<tr> |
259 |
<th>Hold</th> |
268 |
<th>Hold</th> |
260 |
<th>Title</th> |
269 |
<th>Title</th> |
Lines 273-292
Link Here
|
273 |
[% END %] |
282 |
[% END %] |
274 |
<th>Hold not needed after</th> |
283 |
<th>Hold not needed after</th> |
275 |
[% IF ( OpacHoldNotes ) %]<th>Notes</th>[% END %] |
284 |
[% IF ( OpacHoldNotes ) %]<th>Notes</th>[% END %] |
276 |
[% IF OPACItemHolds == 'yes' %] |
285 |
[% IF OPACItemHolds == '1' %] |
277 |
<th id="place_on_hdr" style="display:none">Place On</th> |
286 |
<th id="place_on_hdr" style="display:none">Place On</th> |
278 |
[% END %] |
287 |
[% END %] |
279 |
[% UNLESS ( singleBranchMode ) %] |
288 |
[% UNLESS ( singleBranchMode ) %] |
280 |
[% IF ( choose_branch ) %] |
289 |
[% IF ( choose_branch ) %] |
281 |
<th>Pickup location</th> |
290 |
<th>Pickup location</th> |
282 |
[% END %] |
291 |
[% END %] |
283 |
[% END %] |
292 |
[% END %] |
284 |
</tr>[% ELSE %]<tr><th colspan="[% itemtable_colspan + 1 %]">Title</th></tr>[% END %] |
293 |
</tr>[% ELSE %]<tr><th colspan="[% itemtable_colspan + 1 %]">Title</th></tr>[% END %] |
285 |
|
|
|
286 |
[% FOREACH bibitemloo IN bibitemloop %] |
294 |
[% FOREACH bibitemloo IN bibitemloop %] |
287 |
<tr> |
295 |
<tr id="hold_[% bibitemloo.biblionumber %]" class="hold"> |
288 |
[% IF ( bibitemloo.holdable ) %] |
296 |
[% IF ( bibitemloo.holdable ) %] |
289 |
<td class="hold"> |
297 |
<td class="hold"> |
290 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
298 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
291 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> |
299 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> |
292 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span> |
300 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span> |
Lines 297-306
Link Here
|
297 |
value="any" /> |
305 |
value="any" /> |
298 |
<label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label> |
306 |
<label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label> |
299 |
</span> |
307 |
</span> |
300 |
</td> |
308 |
</td> |
301 |
[% ELSE %] |
309 |
[% ELSE %] |
302 |
[% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] |
310 |
[% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] |
303 |
[% END %] |
311 |
[% END %] |
304 |
[% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="[% itemtable_colspan + 1 %]">[% END %] |
312 |
[% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="[% itemtable_colspan + 1 %]">[% END %] |
305 |
<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> |
313 |
<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> |
306 |
[% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] |
314 |
[% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] |
Lines 362-398
Link Here
|
362 |
[% IF ( OpacHoldNotes ) %][% IF ( bibitemloo.holdable ) %]<td><input type="button" id="shownotes_[% bibitemloo.biblionumber %]" class="shownotes" value="Edit notes"/></td>[% END %][% END %] |
370 |
[% IF ( OpacHoldNotes ) %][% IF ( bibitemloo.holdable ) %]<td><input type="button" id="shownotes_[% bibitemloo.biblionumber %]" class="shownotes" value="Edit notes"/></td>[% END %][% END %] |
363 |
|
371 |
|
364 |
[% IF ( bibitemloo.holdable ) %] |
372 |
[% IF ( bibitemloo.holdable ) %] |
365 |
<!-- HOLDABLE --> |
373 |
<!-- HOLDABLE --> |
366 |
[% IF OPACItemHolds == 'yes' %] |
374 |
[% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %] |
367 |
<!-- ITEM HOLDS --> |
375 |
<!-- ITEM HOLDS --> |
368 |
<td class="place_on_type" style="display:none"> |
376 |
<td class="place_on_type" style="display:none"> |
369 |
<ul> |
377 |
<ul> |
370 |
<li> |
378 |
<li> |
371 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
379 |
[% IF OPACItemHolds == "1" %] |
372 |
id="reqany_[% bibitemloo.biblionumber %]" |
380 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
373 |
class="selectany" |
381 |
id="reqany_[% bibitemloo.biblionumber %]" |
374 |
value="Any" |
382 |
class="selectany" |
375 |
checked="checked" |
383 |
value="Any" |
376 |
/> |
384 |
checked="checked" |
|
|
385 |
/> |
386 |
[% ELSE %] |
387 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
388 |
id="reqany_[% bibitemloo.biblionumber %]" |
389 |
class="selectany" |
390 |
value="Any" |
391 |
/> |
392 |
[% END %] |
377 |
<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
393 |
<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
378 |
</li> |
394 |
</li> |
379 |
<li> |
395 |
<li> |
380 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
396 |
[% IF OPACItemHolds == "force" %] |
381 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
397 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
382 |
class="selectspecific" |
398 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
383 |
value="Specific" |
399 |
class="selectspecific" |
384 |
/> |
400 |
value="Specific" |
|
|
401 |
checked="checked" |
402 |
/> |
403 |
[% ELSE %] |
404 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
405 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
406 |
class="selectspecific" |
407 |
value="Specific" |
408 |
/> |
409 |
[% END %] |
385 |
<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
410 |
<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
386 |
</li> |
411 |
</li> |
387 |
</ul> |
412 |
</ul> |
388 |
</td> |
413 |
</td> |
389 |
[% ELSIF OPACItemHolds == 'force' %] |
414 |
[% IF OPACItemHolds == 'force' %] |
390 |
<script type="text/javascript"> |
415 |
<script type="text/javascript"> |
391 |
$(document).ready(function() { |
416 |
$(document).ready(function() { |
392 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
417 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
393 |
}); |
418 |
}); |
394 |
</script> |
419 |
</script> |
395 |
[% END %] |
420 |
[% END %] |
|
|
421 |
[% END %] |
422 |
|
396 |
[% END # holdable%] |
423 |
[% END # holdable%] |
397 |
[% UNLESS ( singleBranchMode ) %] |
424 |
[% UNLESS ( singleBranchMode ) %] |
398 |
[% IF ( bibitemloo.holdable ) %] |
425 |
[% IF ( bibitemloo.holdable ) %] |
Lines 439-445
Link Here
|
439 |
[% END %] |
466 |
[% END %] |
440 |
[% END %] |
467 |
[% END %] |
441 |
|
468 |
|
442 |
[% IF OPACItemHolds == 'yes' || OPACItemHolds == 'force' %] |
469 |
[% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %] |
443 |
[% IF ( bibitemloo.holdable ) %] |
470 |
[% IF ( bibitemloo.holdable ) %] |
444 |
<tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> |
471 |
<tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> |
445 |
<td> </td> |
472 |
<td> </td> |
Lines 522-527
Link Here
|
522 |
[% END %]<!-- bib_available --> |
549 |
[% END %]<!-- bib_available --> |
523 |
[% END %]<!-- OPACItemHolds --> |
550 |
[% END %]<!-- OPACItemHolds --> |
524 |
[% END %] |
551 |
[% END %] |
|
|
552 |
</tbody> |
525 |
</table><!-- bibitemloop --> |
553 |
</table><!-- bibitemloop --> |
526 |
[% END %] <!-- if message --> |
554 |
[% END %] <!-- if message --> |
527 |
</div><!-- bigloop --> |
555 |
</div><!-- bigloop --> |
528 |
- |
|
|