From c0dc7efd76eb61e84c3e3fd2f76f5db406fad3af Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 28 Aug 2012 13:37:37 -0400 Subject: [PATCH] Bug 8215 - Course Reserves - Followup - Remove checkEnter() and reimplement with noEnterSubmit class Content-Type: text/plain; charset="utf-8" --- .../prog/en/includes/doc-head-close.inc | 9 ------ koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js | 29 +++++++------------- .../prog/en/modules/cataloguing/additem.tt | 2 +- .../prog/en/modules/members/mancredit.tt | 2 +- .../prog/en/modules/members/maninvoice.tt | 2 +- .../prog/en/modules/members/memberentrygen.tt | 2 +- 6 files changed, 14 insertions(+), 32 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc index 22a8854..32eae21 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -67,12 +67,3 @@ var NO_LOCAL_JACKET = _("No cover image available"); //]]> [% END %] - - diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js index 125cd52..e73cd01 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js @@ -5,11 +5,20 @@ function _(s) { return s } // dummy function for gettext $(document).ready(function() { $('#header_search').tabs().bind('tabsshow', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); }); - $(".close").click(function(){ window.close(); }); + + $(".close").click(function(){ window.close(); }); + if($("#header_search #checkin_search").length > 0){ $(document).bind('keydown','Alt+r',function (){ $("#header_search").tabs("select","#checkin_search"); $("#ret_barcode").focus(); }); } else { $(document).bind('keydown','Alt+r',function (){ location.href="/cgi-bin/koha/circ/returns.pl"; }); } if($("#header_search #circ_search").length > 0){ $(document).bind('keydown','Alt+u',function (){ $("#header_search").tabs("select","#circ_search"); $("#findborrower").focus(); }); } else { $(document).bind('keydown','Alt+u',function(){ location.href="/cgi-bin/koha/circ/circulation.pl"; }); } if($("#header_search #catalog_search").length > 0){ $(document).bind('keydown','Alt+q',function (){ $("#header_search").tabs("select","#catalog_search"); $("#search-form").focus(); }); } else { $(document).bind('keydown','Alt+q',function(){ location.href="/cgi-bin/koha/catalogue/search.pl"; }); } + $(".focus").focus(); + + $('.noEnterSubmit').keypress(function(e){ + if ( e.which == 13 ) return false; + //if ( e.which == 13 ) e.preventDefault(); + }); + }); @@ -73,24 +82,6 @@ YAHOO.util.Event.onContentReady("changelanguage", function () { }); }); -// http://jennifermadden.com/javascript/stringEnterKeyDetector.html -function checkEnter(e){ //e is event object passed from function invocation - var characterCode; // literal character code will be stored in this variable - if(e && e.which){ //if which property of event object is supported (NN4) - e = e; - characterCode = e.which; //character code is contained in NN4's which property - } else { - e = event; - characterCode = e.keyCode; //character code is contained in IE's keyCode property - } - - if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key) - return false; - } else { - return true; - } -} - function clearHoldFor(){ $.cookie("holdfor",null, { path: "/", expires: 0 }); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 6692274..a14164d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -9,7 +9,7 @@ $(document).ready(function(){ window.close(); [% END %] [% END %] - $("fieldset.rows input").keydown(function(e){ return checkEnter(e); }); + $("fieldset.rows input").addClass("noEnterSubmit"); /* Inline edit/delete links */ var biblionumber = $("input[name='biblionumber']").attr("value"); $("td").click(function(event){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt index 8b71856..6ac018c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt @@ -4,7 +4,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt index 217882e..464e6fe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt @@ -4,7 +4,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index bd62f58..5e3c2c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -6,7 +6,7 @@