Bugzilla – Attachment 2690 Details for
Bug 5281
"Check in" then "Renew" checkboxes checked in the same time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed alterantive fix
0001-Fix-for-Bug-5281-Check-in-then-Renew-checkboxes-chec.patch (text/plain), 8.12 KB, created by
Owen Leonard
on 2010-10-15 13:45:22 UTC
(
hide
)
Description:
Proposed alterantive fix
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2010-10-15 13:45:22 UTC
Size:
8.12 KB
patch
obsolete
>From 91238bfd4e7680e508eaedd7df9a61230b3af457 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 15 Oct 2010 09:35:58 -0400 >Subject: [PATCH] Fix for Bug 5281, "Check in" then "Renew" checkboxes checked in the same time > >This fix corrects the behavior of the checkboxes whether the user clicks the >checkbox itself or the <td> around it. Tested on a PC in Firefox 3.6, Chrome, >Safari 5, and IE 8. >--- > .../prog/en/modules/circ/circulation.tmpl | 74 +++++++++----------- > 1 files changed, 33 insertions(+), 41 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >index 980d195..4e81ce2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >@@ -73,18 +73,28 @@ var allcheckboxes = $(".checkboxed"); > } ).attr( 'checked', false ); > <!-- /TMPL_IF --> > <!-- /TMPL_IF --> >+ // Clicking the table cell checks the checkbox inside it > $("td").click(function(e){ > if(e.target.tagName.toLowerCase() == 'td'){ >- $(this).find("input:checkbox").each( function() { >- $(this).attr('checked', !$(this).attr('checked')); >- if($(this).attr('checked')){ >- $(this).parent().siblings().find("input:checkbox").each(function(){ >- if($(this).attr('checked')){ $(this).attr('checked',''); } >- }); >- } >+ $(this).find("input:checkbox:visible").each( function() { >+ if($(this).attr("checked")){ >+ $(this).attr("checked",''); >+ } else { >+ $(this).attr("checked","checked"); >+ radioCheckBox($(this)); >+ } > }); >- } >+ } > }); >+ // prevent adjacent checkboxes from being checked simultaneously >+ function radioCheckBox(box){ >+ box.parents("td").siblings().find("input:checkbox:visible").each(function(){ >+ if($(this).attr("checked")){ >+ $(this).attr("checked",''); >+ } >+ }); >+ } >+ > $("#messages ul").after("<a href=\"#\" id=\"addmessage\">"+_("Add a new message")+"</a>"); > $("#borrower_messages .cancel").click(function(){ > $("#add_message_form").hide(); >@@ -94,30 +104,12 @@ var allcheckboxes = $(".checkboxed"); > $(this).hide(); > $("#add_message_form").show(); > }); >+ >+ $("input.radio").click(function(){ >+ radioCheckBox($(this)); >+ }); > }); >-function uncheck_sibling(me){ >-nodename=me.getAttribute("name"); >-if (nodename =="barcodes[]"){ >- var Node=me.parentNode.previousSibling; >- while (Node.nodeName!="TD"){Node=Node.previousSibling} >- var Nodes=Node.childNodes; >- for (var i=0;i<Nodes.length;i++){ >- if (Nodes[i].nodeName=="INPUT" && Nodes[i].getAttribute("type")=="checkbox"){ >- Nodes[i].checked=false; >- } >- } >- >-}else { >- var Node=me.parentNode.nextSibling; >- while (Node.nodeName!="TD"){Node=Node.nextSibling} >- var Nodes=Node.childNodes; >- for (var i=0;i<Nodes.length;i++){ >- if (Nodes[i].nodeName=="INPUT" && Nodes[i].getAttribute("type")=="checkbox"){ >- Nodes[i].checked=false; >- } >- } >-} >-} >+ > function validate1(date) { > var today = new Date(); > if ( date < today ) { >@@ -694,17 +686,17 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> > <!-- TMPL_IF NAME="can_renew" --> > <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" /> > <!-- TMPL_IF NAME="od" --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> > <!-- TMPL_ELSE --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> > <!-- /TMPL_IF --> > <!-- TMPL_ELSE --> > <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed" style="display: none"> > <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" /> > <!-- TMPL_IF NAME="od" --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> > <!-- TMPL_ELSE --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> > <!-- /TMPL_IF --> > </span> > <span class="renewals-disabled"> >@@ -724,7 +716,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> > <!-- TMPL_IF NAME="return_failed" --> > <td class="problem">Checkin Failed</td> > <!--TMPL_ELSE--> >- <td><input type="checkbox" name="barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" onclick="uncheck_sibling(this);" /> >+ <td><input type="checkbox" class="radio" name="barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" /> > <input type="checkbox" name="all_barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" checked="checked" style="display: none;" /> > </td> > <!-- /TMPL_IF --> >@@ -760,17 +752,17 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> > <!-- TMPL_IF NAME="can_renew" --> > <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" /> > <!-- TMPL_IF NAME="od" --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> > <!-- TMPL_ELSE --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> > <!-- /TMPL_IF --> > <!-- TMPL_ELSE --> > <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed" style="display: none"> > <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" /> > <!-- TMPL_IF NAME="od" --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" /> > <!-- TMPL_ELSE --> >- <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> >+ <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" /> > <!-- /TMPL_IF --> > </span> > <span class="renewals-disabled"> >@@ -790,7 +782,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> > <!-- TMPL_IF NAME="return_failed" --> > <td class="problem">Checkin Failed</td> > <!--TMPL_ELSE--> >- <td><input type="checkbox" name="barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" onclick="uncheck_sibling(this);" /> >+ <td><input type="checkbox" class="radio" name="barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" /> > <input type="checkbox" name="all_barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" checked="checked" style="display: none;" /> > </td> > <!-- /TMPL_IF --> >-- >1.7.0.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 5281
:
2667
|
2680
| 2690