From cc57c2688d73046ee4930869d2d7fabdc8dd37ca Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 12 Nov 2010 15:59:47 -0500 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 around it. Tested on a PC in Firefox 3.6, Chrome, Safari 5, and IE 8. Signed-off-by: Chris Nighswonger Signed-off-by: Chris Cormack --- .../prog/en/modules/circ/circulation.tmpl | 74 +++++++++---------- 1 file 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 822de1537e..46e2dc8bfc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl @@ -72,18 +72,28 @@ var allcheckboxes = $(".checkboxed"); } ).attr( 'checked', false ); + // 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(""+_("Add a new message")+""); $("#borrower_messages .cancel").click(function(){ $("#add_message_form").hide(); @@ -93,30 +103,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 " checked="checked" style="display: none;" /> - " checked="checked" /> + " checked="checked" /> - " /> + " /> @@ -723,7 +715,7 @@ No patron matched Checkin Failed - " onclick="uncheck_sibling(this);" /> + " /> " checked="checked" style="display: none;" /> @@ -759,17 +751,17 @@ No patron matched " checked="checked" style="display: none;" /> - " checked="checked" /> + " checked="checked" /> - " /> + " /> @@ -789,7 +781,7 @@ No patron matched Checkin Failed - " onclick="uncheck_sibling(this);" /> + " /> " checked="checked" style="display: none;" /> -- 2.39.2