Bugzilla – Attachment 25425 Details for
Bug 11767
Use validation plugin when creating new authority framework tag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11767 - Use validation plugin when creating new authority framework tag
Bug-11767---Use-validation-plugin-when-creating-ne.patch (text/plain), 6.33 KB, created by
Jonathan Druart
on 2014-02-19 08:52:49 UTC
(
hide
)
Description:
Bug 11767 - Use validation plugin when creating new authority framework tag
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-19 08:52:49 UTC
Size:
6.33 KB
patch
obsolete
>From 555bd995ad086cc922edee46d1bbbb42089234e4 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 14 Feb 2014 14:29:47 -0500 >Subject: [PATCH] Bug 11767 - Use validation plugin when creating new > authority framework tag > >The page for adding a new tag to an authority framework includes some >custom form validation JavaScript which can be removed in favor of HTML5 >validation attributes and Koha's built-in validation plugin. This patch >does so. > >The patch also moves some tag markup out of the script and into the >template where it belongs. > >To test, apply the patch and go to Administration -> Authority types -> >MARC structure -> New tag. Try submitting the form without entering a >tag number. This should trigger a validation warning. > >Submission of the form with valid data should work correctly. Editing an >existing tag should also work correctly. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > admin/auth_tag_structure.pl | 6 +- > .../prog/en/modules/admin/auth_tag_structure.tt | 61 ++++++-------------- > 2 files changed, 19 insertions(+), 48 deletions(-) > >diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl >index 31b510a..ae2d2da 100755 >--- a/admin/auth_tag_structure.pl >+++ b/admin/auth_tag_structure.pl >@@ -111,18 +111,14 @@ if ($op eq 'add_form') { > -id=>'authorised_value', > -values=> \@authorised_values, > -size=>1, >- -tabindex=>'', > -multiple=>0, > -default => $data->{'authorised_value'}, > ); > > if ($searchfield) { >- $template->param(action => "Modify tag", >- searchfield => "<input type=\"hidden\" name=\"tagfield\" value=\"$searchfield\" />$searchfield"); >+ $template->param('searchfield' => $searchfield); > $template->param('heading_modify_tag_p' => 1); > } else { >- $template->param(action => "Add tag", >- searchfield => "<input type=\"text\" name=\"tagfield\" size=\"5\" maxlength=\"3\" />"); > $template->param('heading_add_tag_p' => 1); > } > $template->param('use_heading_flags_p' => 1); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt >index f8c3910..aed89bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt >@@ -19,43 +19,7 @@ > "sPaginationType": "four_button" > })); > }); >- >- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// >- function isNotNull(f,noalert) { >- if (f.value.length ==0) { >-return false; >- } >- return true; >- } >- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// >- function isNum(v,maybenull) { >- var n = new Number(v.value); >- if (isNaN(n)) { >- return false; >- } >- if (maybenull==0 && v.value=='') { >- return false; >- } >- return true; >- } >- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// >- function Check(f) { >- var ok=1; >- var _alertString=""; >- var alertString2; >- if (f.tagfield.value.length==0) { >- _alertString += "\n- " + _("tag number missing"); >- } >- if (_alertString.length==0) { >- document.Aform.submit(); >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >- alertString2 += "\n------------------------------------------------------------------------------------\n"; >- alertString2 += _alertString; >- alert(alertString2); >- } >- } >- //]]> >+//]]> > </script> > </head> > <body id="admin_auth_tag_structure" class="admin"> >@@ -112,17 +76,25 @@ return false; > [% IF ( add_form ) %] > > <h2> >- [% IF ( use_heading_flags_p ) %] > [% IF ( heading_modify_tag_p ) %]Modify tag[% END %] > [% IF ( heading_add_tag_p ) %]New tag[% END %] >- [% ELSE %][% action %][% END %] > </h2> >- <form action="[% script_name %]" name="Aform" method="post"> >+ <form action="[% script_name %]" name="Aform" method="post" class="validated"> > <input type="hidden" name="op" value="add_validate" /> > [% IF ( heading_modify_tag_p ) %]<input type="hidden" name="modif" value="1" />[% END %] > <input type="hidden" name="authtypecode" value="[% authtypecode %]" /> >- <fieldset class="rows"><ol> >- <li><span class="label">Tag: </span>[% searchfield %]</li> >+ <fieldset class="rows"> >+ <ol> >+ [% IF ( heading_modify_tag_p ) %] >+ <li> >+ <span class="label">Tag: </span> >+ <input type="hidden" name="tagfield" value="[% searchfield %]" /> >+ [% searchfield %] >+ </li> >+ [% ELSE %] >+ <li><label for="tagfield" class="required">Tag: </label><input type="text" id="tagfield" name="tagfield" size="5" maxlength="3" required="required" class="required" /></li> >+ [% END %] >+ > <li><label for="liblibrarian">Text for librarians: </label><input type="text" name="liblibrarian" id="liblibrarian" value="[% liblibrarian |html %]" size="40" maxlength="100" /></li> > <li><label for="libopac">Text for opac: </label><input type="text" name="libopac" id="libopac" value="[% libopac |html %]" size="40" maxlength="100" /></li> > <li><label for="repeatable">Repeatable: </label> >@@ -141,7 +113,10 @@ return false; > </li> > <li><label for="authorised_value">Authorized value: </label>[% authorised_value %] (if you select a value here, the indicators will be limited to the authorized value list)</li> > </ol></fieldset> >- <p><input type="button" value="Submit" class="button" onclick="Check(this.form)" /></p> >+ <fieldset class="action"> >+ <input type="submit" value="Submit" /> >+ <a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode %]" class="cancel">Cancel</a> >+ </fieldset> > </form> > [% END %] > >-- >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 11767
:
25293
|
25410
| 25425