Bugzilla – Attachment 23631 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: Changed OPACItemHolds syspref to be no|yes|force choice - bootstrap
Bug-7825-Changed-OPACItemHolds-syspref-to-be-noyes.patch (text/plain), 14.25 KB, created by
Jonathan Druart
on 2013-12-18 14:04:49 UTC
(
hide
)
Description:
Bug 7825: Changed OPACItemHolds syspref to be no|yes|force choice - bootstrap
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-12-18 14:04:49 UTC
Size:
14.25 KB
patch
obsolete
>From 18ca124ec5b63192e6c2afc9954119e83537c98c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 18 Dec 2013 14:48:53 +0100 >Subject: [PATCH] Bug 7825: Changed OPACItemHolds syspref to be no|yes|force > choice - bootstrap > >Same test plan as previous patch but with the bootstrap theme set. >--- > .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 163 +++++++++++++------- > 1 file changed, 107 insertions(+), 56 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index ecccb6e..f07e7e0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -228,27 +228,44 @@ > </li> > [% END # / IF OpacHoldNotes %] > >- [% IF ( OPACItemHolds ) %] >+ [% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %] > <!-- ITEM HOLDS --> >- <li class="lradio"> >+ <li class="lradio place_on_type" style="display:none;"> > <label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> >- [% UNLESS ( bibitemloo.holdable ) %] >- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqany_[% bibitemloo.biblionumber %]" class="selectany" value="Any" disabled="disabled" /> >+ [% 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" checked="checked" /> >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqany_[% bibitemloo.biblionumber %]" >+ class="selectany" >+ value="Any" >+ /> > [% END %] >- > <label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> >- [% UNLESS ( bibitemloo.holdable ) %] >- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqspecific_[% bibitemloo.biblionumber %]" class="selectspecific" disabled="disabled" 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" /> >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqspecific_[% bibitemloo.biblionumber %]" >+ class="selectspecific" >+ value="Specific" >+ /> > [% END %] > </li> > [% END # / IF OPACItemHolds %] > </ul> > >- [% IF ( OPACItemHolds ) %] >+ [% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %] > <table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> > <caption>Select a specific copy:</caption> > <tr> >@@ -274,7 +291,8 @@ > [% IF ( itemLoo.available ) %] > <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> > [% ELSE %] >- <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" /> >+ <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" >+ style="display:none;" /> > <img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> > [% END %] > >@@ -380,6 +398,13 @@ > $(this).closest("td").find("input").val(""); > e.preventDefault(); > }); >+ >+ // 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; >@@ -388,10 +413,30 @@ > $(".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'); > }); > } > }); >+ >+ [% FOREACH bibitemloo IN bibitemloop %] >+ [% IF bibitemloo.holdable %] >+ [% IF OPACItemHolds == 'force' %] >+ $("#copiesrow_[% bibitemloo.biblionumber %]").show(); >+ [% END %] >+ [% END %] >+ [% END %] >+ >+ >+ // 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(); > >@@ -404,9 +449,7 @@ > } > }); > >- $("#place_on_hdr").show(); >- $(".place_on_type").show(); >- $("#place_on_hdr,.place_on_type,.toggle-hold-options").show(); >+ $(".toggle-hold-options").show(); > $(".hold-options").hide(); > $(".holddatefrom,.holddateto").prop("readOnly", true); > >@@ -430,64 +473,72 @@ > $(".confirmjs_hold").each(function(){ > var bib = $(this).attr("title"); > var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; >- html += "value=\"" + bib + "\"/> " + _("Place a hold on") + " </label> "; >+ html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; > $(this).html(html); > }); > $(".confirmjs_nohold").each(function(){ > var bib = $(this).attr("title"); > var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; >- html += "value=\"" + bib + "\"/>" + _("Place a hold on: ") + "</label>"; >+ html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; > $(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, "_"); >+ // 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 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(); >+ } >+ }; > >- // 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; >- } >+ $("#place_on_hdr").show(); > >- // When 'specific copy' radio button is clicked >- $(".selectspecific").click(function() { >+ [% IF OPACItemHolds == '1' %] >+ $(".place_on_type").show(); >+ // onload, selectany is checked >+ $(".selectany").attr("checked", "checked"); >+ [% END %] > >- // Make sure all other specific copy table rows are hidden >- biblioNum = suffixOf($(this).attr("id"), "_"); >- newCopiesRowId = "#copiesrow_" + biblioNum; >+ // If we can choose a specific item, we preselect the first one >+ [% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] >+ $("table.copiesrow").each(function(){ >+ var id = suffixOf($(this).attr("id"), "_"); >+ select_first_available(id); >+ }); >+ [% END %] > >- if (!changeSelection(newCopiesRowId, true)) { >- return false; >+ // 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); >+ } >+ // Else its are disabled >+ else { >+ $("#reqspecific_" + id).attr("disabled", "disabled"); >+ $("#reqany_" + id).attr("disabled", "disabled"); > } >+ // expand or collaspe the items block >+ toggle_copiesrow(id); >+ }); > >- // Show the specific copy table for this radio button. >- $(newCopiesRowId).show(); >+ // When 'specific copy' or 'first available' radio button is clicked >+ $(".selectspecific, .selectany").click(function() { >+ var id = suffixOf($(this).attr("id"), "_"); >+ toggle_copiesrow(id); > }); > >- // When 'first available' radion button is clicked >- $(".selectany").click(function() { >- // Make sure all other specific copy table rows are hidden >+ // Show or hide holds notes >+ $(".shownotes").click(function(){ > biblioNum = suffixOf($(this).attr("id"), "_"); >- newCopiesRowId = "#copiesrow_" + biblioNum; >- >- if (!changeSelection(newCopiesRowId, false)) { >- return false; >- } >- >- // Hide the copies table row >- $(newCopiesRowId).hide(); >+ $("#notesrow_"+biblioNum).toggle(); > }); > > // When 'Place Hold' button is clicked >-- >1.7.10.4
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