|
Lines 14-104
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 |
$(".place_on_type").show(); |
| 35 |
|
| 36 |
// Replace non-JS single-selection with multi-selection capability. |
50 |
// Replace non-JS single-selection with multi-selection capability. |
| 37 |
$(".reserve_mode").val("multi"); |
51 |
$(".reserve_mode").val("multi"); |
| 38 |
$(".confirm_nonjs").remove(); |
52 |
$(".confirm_nonjs").remove(); |
| 39 |
$(".confirmjs_hold").each(function(){ |
53 |
$(".confirmjs_hold").each(function(){ |
| 40 |
var bib = $(this).attr("title"); |
54 |
var bib = $(this).attr("title"); |
| 41 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
55 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
| 42 |
html += "value=\"" + bib + "\"/>"; |
56 |
html += "value=\"" + bib + "\" id=\"" + bib + "\"/>"; |
| 43 |
$(this).html(html); |
|
|
| 44 |
}); |
| 45 |
$(".confirmjs_nohold").each(function(){ |
| 46 |
var bib = $(this).attr("title"); |
| 47 |
var html = "<input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
| 48 |
html += "value=\"" + bib + "\"/>"; |
| 49 |
$(this).html(html); |
57 |
$(this).html(html); |
| 50 |
}); |
58 |
}); |
| 51 |
|
59 |
|
| 52 |
// Make sure a specific item was selected where specified |
60 |
// expand or collapse the copiesrow tr |
| 53 |
// before moving on to a new item. |
61 |
function toggle_copiesrow(biblioNum) { |
| 54 |
function changeSelection (newCopiesRowId, isSpecific) { |
62 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
| 55 |
if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) { |
|
|
| 56 |
var biblioNum = suffixOf(copiesRowId, "_"); |
| 57 |
|
| 58 |
// If the 'specific copy' radio button was checked |
| 59 |
if (wasSpecific && (copiesRowId != newCopiesRowId)) { |
| 60 |
// Find the selected copy |
| 61 |
var item = $(".checkitem_" + biblioNum + ":checked"); |
| 62 |
if ($(item).size() == 0) { |
| 63 |
alert(MSG_NO_COPY_SELECTED); |
| 64 |
return false; |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
copiesRowId = newCopiesRowId; |
| 69 |
wasSpecific = isSpecific; |
| 70 |
return true; |
| 71 |
} |
| 72 |
|
| 73 |
// When 'specific copy' radio button is clicked |
| 74 |
$(".selectspecific").click(function() { |
| 75 |
|
| 76 |
// Make sure all other specific copy table rows are hidden |
| 77 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
| 78 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
63 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
64 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
| 79 |
|
65 |
|
| 80 |
if (!changeSelection(newCopiesRowId, true)) { |
66 |
// If the checkbox is checked AND we want a specific item, we display the items block |
| 81 |
return false; |
67 |
if ( $(checkbox).is(":checked") && select_specific ) { |
|
|
68 |
$(newCopiesRowId).show(); |
| 69 |
} else { |
| 70 |
$(newCopiesRowId).hide(); |
| 82 |
} |
71 |
} |
| 83 |
$(".copiesrow:not(" + newCopiesRowId + ")").hide(); |
72 |
}; |
| 84 |
|
|
|
| 85 |
// Show the specific copy table for this radio button. |
| 86 |
$(newCopiesRowId).show(); |
| 87 |
}); |
| 88 |
|
73 |
|
|
|
74 |
$("#place_on_hdr").show(); |
| 89 |
|
75 |
|
| 90 |
// When 'first available' radion button is clicked |
76 |
[% IF OPACItemHolds == '1' %] |
| 91 |
$(".selectany").click(function() { |
77 |
$(".place_on_type").show(); |
| 92 |
// Make sure all other specific copy table rows are hidden |
78 |
// onload, selectany is checked |
| 93 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
79 |
$(".selectany").attr("checked", "checked"); |
| 94 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
80 |
[% END %] |
| 95 |
|
81 |
|
| 96 |
if (!changeSelection(newCopiesRowId, false)) { |
82 |
// If we can choose a specific item, we preselect the first one |
| 97 |
return false; |
83 |
[% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] |
|
|
84 |
$("tr.hold").each(function(){ |
| 85 |
var id = suffixOf($(this).attr("id"), "_"); |
| 86 |
select_first_available(id); |
| 87 |
}); |
| 88 |
[% END %] |
| 89 |
|
| 90 |
// On confirmsjs change |
| 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); |
| 98 |
} |
97 |
} |
| 99 |
|
98 |
// Else its are disabled |
| 100 |
// Hide the copies table row |
99 |
else { |
| 101 |
$(".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); |
| 102 |
}); |
111 |
}); |
| 103 |
|
112 |
|
| 104 |
// When 'Place Hold' button is clicked |
113 |
// When 'Place Hold' button is clicked |
|
Lines 147-153
Link Here
|
| 147 |
|
156 |
|
| 148 |
$("#selections").val(selections); |
157 |
$("#selections").val(selections); |
| 149 |
$("#biblionumbers").val(biblionumbers); |
158 |
$("#biblionumbers").val(biblionumbers); |
| 150 |
|
|
|
| 151 |
return true; |
159 |
return true; |
| 152 |
}); |
160 |
}); |
| 153 |
|
161 |
|
|
Lines 236-241
Link Here
|
| 236 |
<input type="hidden" name="selecteditems" id="selections"/> |
244 |
<input type="hidden" name="selecteditems" id="selections"/> |
| 237 |
<div id="bigloop"> |
245 |
<div id="bigloop"> |
| 238 |
<table id="bibitemloop"> |
246 |
<table id="bibitemloop"> |
|
|
247 |
<thead> |
| 239 |
[% UNLESS ( none_available ) %]<tr> |
248 |
[% UNLESS ( none_available ) %]<tr> |
| 240 |
<th>Hold</th> |
249 |
<th>Hold</th> |
| 241 |
<th>Title</th> |
250 |
<th>Title</th> |
|
Lines 253-272
Link Here
|
| 253 |
<th>Hold starts on date</th> |
262 |
<th>Hold starts on date</th> |
| 254 |
[% END %] |
263 |
[% END %] |
| 255 |
<th>Hold not needed after</th> |
264 |
<th>Hold not needed after</th> |
| 256 |
[% IF OPACItemHolds == 'yes' %] |
265 |
[% IF OPACItemHolds == '1' %] |
| 257 |
<th id="place_on_hdr" style="display:none">Place On</th> |
266 |
<th id="place_on_hdr" style="display:none">Place On</th> |
| 258 |
[% END %] |
267 |
[% END %] |
| 259 |
[% UNLESS ( singleBranchMode ) %] |
268 |
[% UNLESS ( singleBranchMode ) %] |
| 260 |
[% IF ( choose_branch ) %] |
269 |
[% IF ( choose_branch ) %] |
| 261 |
<th>Pickup location</th> |
270 |
<th>Pickup location</th> |
| 262 |
[% END %] |
271 |
[% END %] |
| 263 |
[% END %] |
272 |
[% END %] |
| 264 |
</tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %] |
273 |
</tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %] |
| 265 |
|
274 |
</thead> |
|
|
275 |
<tbody> |
| 266 |
[% FOREACH bibitemloo IN bibitemloop %] |
276 |
[% FOREACH bibitemloo IN bibitemloop %] |
| 267 |
<tr> |
277 |
<tr id="hold_[% bibitemloo.biblionumber %]" class="hold"> |
| 268 |
[% IF ( bibitemloo.holdable ) %] |
278 |
[% IF ( bibitemloo.holdable ) %] |
| 269 |
<td class="hold"> |
279 |
<td class="hold"> |
| 270 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
280 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
| 271 |
<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 %]"/> |
| 272 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span> |
282 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span> |
|
Lines 277-286
Link Here
|
| 277 |
value="any" /> |
287 |
value="any" /> |
| 278 |
<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> |
| 279 |
</span> |
289 |
</span> |
| 280 |
</td> |
290 |
</td> |
| 281 |
[% ELSE %] |
291 |
[% ELSE %] |
| 282 |
[% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] |
292 |
[% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] |
| 283 |
[% END %] |
293 |
[% END %] |
| 284 |
[% 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 %] |
| 285 |
<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> |
| 286 |
[% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] |
296 |
[% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] |
|
Lines 341-347
Link Here
|
| 341 |
|
351 |
|
| 342 |
[% IF ( bibitemloo.holdable ) %] |
352 |
[% IF ( bibitemloo.holdable ) %] |
| 343 |
<!-- HOLDABLE --> |
353 |
<!-- HOLDABLE --> |
| 344 |
[% IF OPACItemHolds == 'yes' %] |
354 |
[% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %] |
| 345 |
<!-- ITEM HOLDS --> |
355 |
<!-- ITEM HOLDS --> |
| 346 |
<td class="place_on_type" style="display:none"> |
356 |
<td class="place_on_type" style="display:none"> |
| 347 |
<ul> |
357 |
<ul> |
|
Lines 350-356
Link Here
|
| 350 |
id="reqany_[% bibitemloo.biblionumber %]" |
360 |
id="reqany_[% bibitemloo.biblionumber %]" |
| 351 |
class="selectany" |
361 |
class="selectany" |
| 352 |
value="Any" |
362 |
value="Any" |
| 353 |
checked="checked" |
363 |
[% IF OPACItemHolds == "1" %]checked="checked"[% END %] |
| 354 |
/> |
364 |
/> |
| 355 |
<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
365 |
<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> |
| 356 |
</li> |
366 |
</li> |
|
Lines 359-376
Link Here
|
| 359 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
369 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
| 360 |
class="selectspecific" |
370 |
class="selectspecific" |
| 361 |
value="Specific" |
371 |
value="Specific" |
|
|
372 |
[% IF OPACItemHolds == "force" %]checked="checked"[% END %] |
| 362 |
/> |
373 |
/> |
| 363 |
<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
374 |
<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> |
| 364 |
</li> |
375 |
</li> |
| 365 |
</ul> |
376 |
</ul> |
| 366 |
</td> |
377 |
</td> |
| 367 |
[% ELSIF OPACItemHolds == 'force' %] |
378 |
[% IF OPACItemHolds == 'force' %] |
| 368 |
<script type="text/javascript"> |
379 |
<script type="text/javascript"> |
| 369 |
$(document).ready(function() { |
380 |
$(document).ready(function() { |
| 370 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
381 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
| 371 |
}); |
382 |
}); |
| 372 |
</script> |
383 |
</script> |
| 373 |
[% END %] |
384 |
[% END %] |
|
|
385 |
[% END %] |
| 386 |
|
| 374 |
[% END # holdable%] |
387 |
[% END # holdable%] |
| 375 |
[% UNLESS ( singleBranchMode ) %] |
388 |
[% UNLESS ( singleBranchMode ) %] |
| 376 |
[% IF ( bibitemloo.holdable ) %] |
389 |
[% IF ( bibitemloo.holdable ) %] |
|
Lines 403-409
Link Here
|
| 403 |
[% END %] |
416 |
[% END %] |
| 404 |
</tr> |
417 |
</tr> |
| 405 |
|
418 |
|
| 406 |
[% IF OPACItemHolds == 'yes' || OPACItemHolds == 'force' %] |
419 |
[% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %] |
| 407 |
[% IF ( bibitemloo.holdable ) %] |
420 |
[% IF ( bibitemloo.holdable ) %] |
| 408 |
<tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> |
421 |
<tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> |
| 409 |
<td> </td> |
422 |
<td> </td> |
|
Lines 486-491
Link Here
|
| 486 |
[% END %]<!-- bib_available --> |
499 |
[% END %]<!-- bib_available --> |
| 487 |
[% END %]<!-- OPACItemHolds --> |
500 |
[% END %]<!-- OPACItemHolds --> |
| 488 |
[% END %] |
501 |
[% END %] |
|
|
502 |
</tbody> |
| 489 |
</table><!-- bibitemloop --> |
503 |
</table><!-- bibitemloop --> |
| 490 |
[% END %] <!-- if message --> |
504 |
[% END %] <!-- if message --> |
| 491 |
</div><!-- bigloop --> |
505 |
</div><!-- bigloop --> |
| 492 |
- |
|
|