Bugzilla – Attachment 25389 Details for
Bug 11785
Use validation plugin when uploading local cover images
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11785 - Use validation plugin when uploading local cover images
Bug-11785---Use-validation-plugin-when-uploading-l.patch (text/plain), 2.48 KB, created by
Owen Leonard
on 2014-02-18 17:21:43 UTC
(
hide
)
Description:
Bug 11785 - Use validation plugin when uploading local cover images
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2014-02-18 17:21:43 UTC
Size:
2.48 KB
patch
obsolete
>From 318ff914e870df1d97c289fbddb5606259447f92 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 18 Feb 2014 12:13:39 -0500 >Subject: [PATCH] Bug 11785 - Use validation plugin when uploading local cover > images >Content-Type: text/plain; charset="utf-8" > >When uploading local cover images the form should not be submitted if >no file has been selected. The existing form validation script doesn't >work. This patch adds HTML5 validation attributes and use of Koha's >built-in form validation plugin. > >To test, apply the patch and go to Tools -> Upload local cover image. >Try to submit the form without selecting a file to upload. You should be >prevented from doing so. Choose a file and confirm that the upload >completes correctly. >--- > .../prog/en/modules/tools/upload-images.tt | 21 +++++++++----------- > 1 file changed, 9 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt >index 0491e18..4565995 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt >@@ -17,16 +17,12 @@ $(document).ready(function(){ > $("#image").click(function(){ > $("#bibnum").show(); > }); >+ $("#uploadfile").validate({ >+ submitHandler: function(form) { >+ ajaxFileUpload(); >+ } >+ }); > }); >-function CheckForm(f) { >- if ($("#fileToUpload").value == '') { >- alert(_("Please upload a file first.")); >- } else { >- return submitBackgroundJob(f); >- } >- return false; >-} >- > //]]> > </script> > </head> >@@ -72,11 +68,12 @@ function CheckForm(f) { > <ol> > <li> > <div id="fileuploadform"> >- <label for="fileToUpload">Select the file to upload: </label> >- <input type="file" id="fileToUpload" name="fileToUpload" /> >+ <label for="fileToUpload" class="required">Select the file to upload: </label> >+ <input type="file" id="fileToUpload" name="fileToUpload" required="required" class="required" /> >+ <span class="required">Required</span> > </div> </li> > </ol> >- <fieldset class="action"><button class="submit" onclick="return ajaxFileUpload();">Upload file</button></fieldset> >+ <fieldset class="action"><button class="submit">Upload file</button></fieldset> > </fieldset> > > <div id="uploadpanel"><div id="fileuploadstatus">Upload progress: <div id="fileuploadprogress"></div> <span id="fileuploadpercent">0</span>%</div> >-- >1.7.9.5
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 11785
:
25389
|
25405
|
25480