Bugzilla – Attachment 18904 Details for
Bug 7825
Change OPACItemHolds syspref to be of type Choice, choices being "no", "yes", "force"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7825: Followup prevent submission without choosing an item
Bug-7825-Followup-prevent-submission-without-choos.patch (text/plain), 15.36 KB, created by
Kyle M Hall (khall)
on 2013-06-12 14:58:38 UTC
(
hide
)
Description:
Bug 7825: Followup prevent submission without choosing an item
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-06-12 14:58:38 UTC
Size:
15.36 KB
patch
obsolete
>From 9aed6de9d27b575cfb0898a5fbcf44f6c526b235 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 22 Feb 2013 10:34:50 +0100 >Subject: [PATCH] Bug 7825: Followup prevent submission without choosing an item > >+ Fix some ergonomic issues in opac-reserve > >Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../opac-tmpl/prog/en/modules/opac-reserve.tt | 212 +++++++++++--------- > 1 files changed, 120 insertions(+), 92 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >index 7ecb8a4..5c5afd7 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -17,19 +17,36 @@ > return s.substring(index + 1); > } > >+// Select the first item available >+function select_first_available(id){ >+ var radios = $("input:radio[name='checkitem_" + id + "']"); >+ $(radios).first().attr("checked", "checked"); >+} >+ > $(document).ready(function() { > $('#hold-request-form').preventDoubleFormSubmit(); > > var copiesRowId = null; > var wasSpecific = false; > var lastCopiesRowId = null; >- $(".checkitem").parent().click(function(e){ >- if(e.target.tagName.toLowerCase() == 'td'){ >+ $(".checkitem").parent().click(function(e){ >+ if(e.target.tagName.toLowerCase() == 'td'){ > $(this).find("input.checkitem").each( function() { >- $(this).attr('checked', !$(this).attr('checked')); >- }); >- } >- }); >+ $(this).attr('checked', 'checked'); >+ }); >+ } >+ }); >+ >+ // click on a first td check the confirmjs checkbox >+ $("td.hold").click(function(e){ >+ if(e.target.tagName.toLowerCase() == 'td'){ >+ $(this).find("input.confirmjs").each( function() { >+ $(this).attr('checked', !$(this).attr('checked')); >+ $(this).change(); >+ }); >+ } >+ }); >+ > // Hides all 'specific copy' table rows on load. > $(".copiesrow").hide(); > $(".notesrow").hide(); >@@ -43,75 +60,67 @@ > } > }); > >- $("#place_on_hdr").show(); >- $(".place_on_type").show(); >- > // Replace non-JS single-selection with multi-selection capability. > $(".reserve_mode").val("multi"); > $(".confirm_nonjs").remove(); > $(".confirmjs_hold").each(function(){ > var bib = $(this).attr("title"); > var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; >- html += "value=\"" + bib + "\"/>"; >- $(this).html(html); >- }); >- $(".confirmjs_nohold").each(function(){ >- var bib = $(this).attr("title"); >- var html = "<input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; >- html += "value=\"" + bib + "\"/>"; >+ html += "value=\"" + bib + "\" id=\"" + bib + "\"/>"; > $(this).html(html); > }); > >- // Make sure a specific item was selected where specified >- // before moving on to a new item. >- function changeSelection (newCopiesRowId, isSpecific) { >- if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) { >- var biblioNum = suffixOf(copiesRowId, "_"); >- >- // If the 'specific copy' radio button was checked >- if (wasSpecific && (copiesRowId != newCopiesRowId)) { >- // Find the selected copy >- var item = $(".checkitem_" + biblioNum + ":checked"); >- if ($(item).size() == 0) { >- alert(MSG_NO_COPY_SELECTED); >- return false; >- } >- } >- } >- copiesRowId = newCopiesRowId; >- wasSpecific = isSpecific; >- return true; >- } >- >- // When 'specific copy' radio button is clicked >- $(".selectspecific").click(function() { >- >- // Make sure all other specific copy table rows are hidden >- biblioNum = suffixOf($(this).attr("id"), "_"); >+ // expand or collapse the copiesrow tr >+ function toggle_copiesrow(biblioNum) { >+ var checkbox = $("input:checkbox[value='"+biblioNum+"']"); > newCopiesRowId = "#copiesrow_" + biblioNum; >+ var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); > >- if (!changeSelection(newCopiesRowId, true)) { >- return false; >+ // If the checkbox is checked AND we want a specific item, we display the items block >+ if ( $(checkbox).is(":checked") && select_specific ) { >+ $(newCopiesRowId).show(); >+ } else { >+ $(newCopiesRowId).hide(); > } >- $(".copiesrow:not(" + newCopiesRowId + ")").hide(); >- >- // Show the specific copy table for this radio button. >- $(newCopiesRowId).show(); >- }); >+ }; > >+ $("#place_on_hdr").show(); > >- // When 'first available' radion button is clicked >- $(".selectany").click(function() { >- // Make sure all other specific copy table rows are hidden >- biblioNum = suffixOf($(this).attr("id"), "_"); >- newCopiesRowId = "#copiesrow_" + biblioNum; >- >- if (!changeSelection(newCopiesRowId, false)) { >- return false; >+ [% IF OPACItemHolds == '1' %] >+ $(".place_on_type").show(); >+ // onload, selectany is checked >+ $(".selectany").attr("checked", "checked"); >+ [% END %] >+ >+ // If we can choose a specific item, we preselect the first one >+ [% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] >+ $("tr.hold").each(function(){ >+ var id = suffixOf($(this).attr("id"), "_"); >+ select_first_available(id); >+ }); >+ [% END %] >+ >+ // On confirmsjs change >+ $(".confirmjs").change(function(){ >+ var id = suffixOf($(this).attr("id"), "_"); >+ // If I m checked, I enable radio buttons >+ if ( $(this).is(":checked") ) { >+ $("#reqspecific_" + id).attr("disabled", false); >+ $("#reqany_" + id).attr("disabled", false); > } >- >- // Hide the copies table row >- $(".copiesrow").hide(); >+ // Else its are disabled >+ else { >+ $("#reqspecific_" + id).attr("disabled", "disabled"); >+ $("#reqany_" + id).attr("disabled", "disabled"); >+ } >+ // expand or collaspe the items block >+ toggle_copiesrow(id); >+ }); >+ >+ // When 'specific copy' or 'first available' radio button is clicked >+ $(".selectspecific, .selectany").click(function() { >+ var id = suffixOf($(this).attr("id"), "_"); >+ toggle_copiesrow(id); > }); > > // Show or hide holds notes >@@ -166,7 +175,6 @@ > > $("#selections").val(selections); > $("#biblionumbers").val(biblionumbers); >- > return true; > }); > >@@ -255,6 +263,7 @@ > <input type="hidden" name="selecteditems" id="selections"/> > <div id="bigloop"> > <table id="bibitemloop"> >+ <thead> > [% UNLESS ( none_available ) %]<tr> > <th>Hold</th> > <th>Title</th> >@@ -273,20 +282,19 @@ > [% END %] > <th>Hold not needed after</th> > [% IF ( OpacHoldNotes ) %]<th>Notes</th>[% END %] >- [% IF OPACItemHolds == 'yes' %] >+ [% IF OPACItemHolds == '1' %] > <th id="place_on_hdr" style="display:none">Place On</th> > [% END %] > [% UNLESS ( singleBranchMode ) %] >- [% IF ( choose_branch ) %] >+ [% IF ( choose_branch ) %] > <th>Pickup location</th> >- [% END %] >+ [% END %] > [% END %] > </tr>[% ELSE %]<tr><th colspan="[% itemtable_colspan + 1 %]">Title</th></tr>[% END %] >- > [% FOREACH bibitemloo IN bibitemloop %] >- <tr> >- [% IF ( bibitemloo.holdable ) %] >- <td class="hold"> >+ <tr id="hold_[% bibitemloo.biblionumber %]" class="hold"> >+ [% IF ( bibitemloo.holdable ) %] >+ <td class="hold"> > <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> > <input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> > <span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span> >@@ -297,10 +305,10 @@ > value="any" /> > <label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label> > </span> >- </td> >- [% ELSE %] >- [% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] >- [% END %] >+ </td> >+ [% ELSE %] >+ [% UNLESS ( none_available ) %]<td class="hold"> </td>[% END %] >+ [% END %] > [% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="[% itemtable_colspan + 1 %]">[% END %] > <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> > [% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] >@@ -362,37 +370,56 @@ > [% IF ( OpacHoldNotes ) %][% IF ( bibitemloo.holdable ) %]<td><input type="button" id="shownotes_[% bibitemloo.biblionumber %]" class="shownotes" value="Edit notes"/></td>[% END %][% END %] > > [% IF ( bibitemloo.holdable ) %] >- <!-- HOLDABLE --> >- [% IF OPACItemHolds == 'yes' %] >+ <!-- HOLDABLE --> >+ [% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %] > <!-- ITEM HOLDS --> > <td class="place_on_type" style="display:none"> > <ul> > <li> >- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >- id="reqany_[% bibitemloo.biblionumber %]" >- class="selectany" >- value="Any" >- checked="checked" >- /> >+ [% IF OPACItemHolds == "1" %] >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqany_[% bibitemloo.biblionumber %]" >+ class="selectany" >+ value="Any" >+ checked="checked" >+ /> >+ [% ELSE %] >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqany_[% bibitemloo.biblionumber %]" >+ class="selectany" >+ value="Any" >+ /> >+ [% END %] > <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> > </li> > <li> >- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >- id="reqspecific_[% bibitemloo.biblionumber %]" >- class="selectspecific" >- value="Specific" >- /> >+ [% IF OPACItemHolds == "force" %] >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqspecific_[% bibitemloo.biblionumber %]" >+ class="selectspecific" >+ value="Specific" >+ checked="checked" >+ /> >+ [% ELSE %] >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqspecific_[% bibitemloo.biblionumber %]" >+ class="selectspecific" >+ value="Specific" >+ /> >+ [% END %] > <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> > </li> > </ul> > </td> >- [% ELSIF OPACItemHolds == 'force' %] >-<script type="text/javascript"> >- $(document).ready(function() { >- $("#copiesrow_[% bibitemloo.biblionumber %]").show(); >- }); >-</script> >+ [% IF OPACItemHolds == 'force' %] >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $("#copiesrow_[% bibitemloo.biblionumber %]").show(); >+ }); >+ </script> > [% END %] >+ [% END %] >+ > [% END # holdable%] > [% UNLESS ( singleBranchMode ) %] > [% IF ( bibitemloo.holdable ) %] >@@ -439,7 +466,7 @@ > [% END %] > [% END %] > >- [% IF OPACItemHolds == 'yes' || OPACItemHolds == 'force' %] >+ [% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %] > [% IF ( bibitemloo.holdable ) %] > <tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> > <td> </td> >@@ -522,6 +549,7 @@ > [% END %]<!-- bib_available --> > [% END %]<!-- OPACItemHolds --> > [% END %] >+ </tbody> > </table><!-- bibitemloop --> > [% END %] <!-- if message --> > </div><!-- bigloop --> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7825
:
8641
|
8645
|
8646
|
12881
|
12883
|
12884
|
12885
|
12915
|
12920
|
12921
|
12922
|
12923
|
13305
|
13306
|
13307
|
13340
|
13341
|
13350
|
15032
|
15033
|
15034
|
15035
|
15606
|
15607
|
18435
|
18436
|
18878
|
18879
|
18903
|
18904
|
18920
|
18924
|
18925
|
18926
|
18927
|
18928
|
22635
|
22877
|
23631
|
24218
|
24270
|
24271
|
24538
|
24539
|
24540
|
24541
|
24542
|
24578
|
24579
|
24591
|
24592
|
27961
|
27962
|
27963
|
27964
|
27965
|
27966