From 91238bfd4e7680e508eaedd7df9a61230b3af457 Mon Sep 17 00:00:00 2001 From: Owen Leonard 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 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 ); + // 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(); @@ -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 " checked="checked" style="display: none;" /> - " checked="checked" /> + " checked="checked" /> - " /> + " /> @@ -724,7 +716,7 @@ No patron matched Checkin Failed - " onclick="uncheck_sibling(this);" /> + " /> " checked="checked" style="display: none;" /> @@ -760,17 +752,17 @@ No patron matched " checked="checked" style="display: none;" /> - " checked="checked" /> + " checked="checked" /> - " /> + " /> @@ -790,7 +782,7 @@ No patron matched Checkin Failed - " onclick="uncheck_sibling(this);" /> + " /> " checked="checked" style="display: none;" /> -- 1.7.0.4