Bugzilla – Attachment 14947 Details for
Bug 9507
Some code used to prevent form from being unexpectedly submitted is duplicated
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9507: prevent submit: factorize some code in a js file
Bug-9507-prevent-submit-factorize-some-code-in-a-j.patch (text/plain), 5.40 KB, created by
Jonathan Druart
on 2013-01-30 14:22:38 UTC
(
hide
)
Description:
Bug 9507: prevent submit: factorize some code in a js file
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-01-30 14:22:38 UTC
Size:
5.40 KB
patch
obsolete
>From b7763366cac5ed1071df752bae4a806e8c343281 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 30 Jan 2013 15:19:58 +0100 >Subject: [PATCH] Bug 9507: prevent submit: factorize some code in a js file > >This patch factorize code in a js file. > >Test plan: >On acqui/neworderempty.pl, acqui/orderreceive.pl and >serials/serials-edit.tt try to scan a barcode (or press enter) on the >form and check that it is not sent. >--- > .../intranet-tmpl/prog/en/js/prevent_submit.js | 18 ++++++++++++++++++ > .../prog/en/modules/acqui/neworderempty.tt | 19 +------------------ > .../prog/en/modules/acqui/orderreceive.tt | 20 +------------------- > .../prog/en/modules/serials/serials-edit.tt | 19 +------------------ > 4 files changed, 21 insertions(+), 55 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/prevent_submit.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/prevent_submit.js b/koha-tmpl/intranet-tmpl/prog/en/js/prevent_submit.js >new file mode 100644 >index 0000000..bafd42a >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/prevent_submit.js >@@ -0,0 +1,18 @@ >+var prevent_nav = window.Event ? true : false; >+if (prevent_nav) { >+ window.captureEvents(Event.KEYDOWN); >+ window.onkeydown = NetscapeEventHandler_KeyDown; >+} else { >+ document.onkeydown = IEEventHandler_KeyDown; >+} >+ >+function NetscapeEventHandler_KeyDown(e) { >+ if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; } >+ return true; >+} >+ >+function IEEventHandler_KeyDown() { >+ if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit') >+ return false; >+ return true; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 6bda444..e78eddb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -6,25 +6,8 @@ > <script type="text/javascript" src="[% themelang %]/js/acq.js"></script> > [% INCLUDE 'additem.js.inc' %] > <script type="text/javascript" src="[% themelang %]/js/additem.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/prevent_submit.js"></script> > <script type="text/javascript"> >-var nav = window.Event ? true : false; >-if (nav) { >- window.captureEvents(Event.KEYDOWN); >- window.onkeydown = NetscapeEventHandler_KeyDown; >-} else { >- document.onkeydown = IEEventHandler_KeyDown; >-} >- >-function NetscapeEventHandler_KeyDown(e) { >- if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; } >- return true; >-} >- >-function IEEventHandler_KeyDown() { >- if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit') >- return false; >- return true; >-} > //<![CDATA[ > actTotal = ""; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index e88f9ce..6d55cc9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -3,26 +3,8 @@ > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'additem.js.inc' %] > <script type="text/javascript" src="[% themelang %]/js/additem.js"> </script> >+<script type="text/javascript" src="[% themelang %]/js/prevent_submit.js"></script> > <script type="text/javascript"> >- >-var nav = window.Event ? true : false; >-if (nav) { >- window.captureEvents(Event.KEYDOWN); >- window.onkeydown = NetscapeEventHandler_KeyDown; >-} else { >- document.onkeydown = IEEventHandler_KeyDown; >-} >- >-function NetscapeEventHandler_KeyDown(e) { >- if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; } >- return true; >-} >- >-function IEEventHandler_KeyDown() { >- if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit') >- return false; >- return true; >-} > //<![CDATA[ > function Check(form) { > [% IF (AcqCreateItemReceiving) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >index 3a64b11..31fdee0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >@@ -2,25 +2,8 @@ > <title>Koha › Serials › Serial edition [% bibliotitle %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/prevent_submit.js"></script> > <script language="JavaScript" type="text/javascript"> >-var nav = window.Event ? true : false; >-if (nav) { >- window.captureEvents(Event.KEYDOWN); >- window.onkeydown = NetscapeEventHandler_KeyDown; >-} else { >- document.onkeydown = IEEventHandler_KeyDown; >-} >- >-function NetscapeEventHandler_KeyDown(e) { >- if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; } >- return true; >-} >- >-function IEEventHandler_KeyDown() { >- if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit') >- return false; >- return true; >-} > //<![CDATA[ > function generateReceive() { > var subscriptionid = document.getElementsByName("subscriptionid")[0].value; >-- >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 9507
:
14947
|
15015
|
18305
|
18309
|
18310
|
18726