Bugzilla – Attachment 25520 Details for
Bug 11789
Use validation plugin when creating new list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11789 - Use validation plugin when creating new list
Bug-11789---Use-validation-plugin-when-creating-ne.patch (text/plain), 5.53 KB, created by
Owen Leonard
on 2014-02-20 19:39:06 UTC
(
hide
)
Description:
Bug 11789 - Use validation plugin when creating new list
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2014-02-20 19:39:06 UTC
Size:
5.53 KB
patch
obsolete
>From 564ed4d444a8e35ff1a611a190c1398692ec7972 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 18 Feb 2014 15:37:31 -0500 >Subject: [PATCH] Bug 11789 - Use validation plugin when creating new list >Content-Type: text/plain; charset="utf-8" > >The page for adding a new list 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. > >Other edits: Minor validation fixes. > >To test, apply the patch and go to Lists -> New list. Try submitting the >form without entering a list name. This should trigger a validation >warning. > >Submission of the form with valid data should work correctly. Editing an >existing list should also work correctly. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > .../prog/en/modules/virtualshelves/shelves.tt | 41 +++++++------------- > 1 file changed, 13 insertions(+), 28 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 95fa4b9..aca9485 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -155,26 +155,7 @@ function placeHold () { > $("#hold_form").submit(); > return false; > } >- /** >- * This function checks to make sure a list title is assigned >- */ >- function Check(f) { >- var _alertString=""; >- var alertString2; >- >- if($("#shelfname").val() == ""){ >- _alertString += "- "+_("You must enter a List Name") + "\n"; >- } > >- if (_alertString.length==0) { >- f.submit(); >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >- alertString2 += "\n------------------------------------------------------------------------------------\n\n"; >- alertString2 += _alertString; >- alert(alertString2); >- } >- } > function cartList(){ > var checkboxes = $("#searchresults").find(":checkbox"); > var vshelf = vShelfAdd(checkboxes); >@@ -440,14 +421,16 @@ function placeHold () { > [% IF ( seflag ) %] > <div class="yui-ge"> > <div class="yui-u first"> >- <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl"> >+ <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" class="validated"> > <fieldset class="rows"> > > [% IF ( shelves ) %] >- <input type="hidden" name="shelves" value="1" /> > <legend>Create a new list</legend> >+ <input type="hidden" name="shelves" value="1" /> > <ol> >- <li><label class="required" for="addshelf">List name:</label><input id="addshelf" type="text" name="addshelf" size="25" /></li> >+ <li><label class="required" for="addshelf">List name:</label><input id="addshelf" type="text" name="addshelf" size="25" required="required" class="required" /> >+ <span class="required">Required</span> >+ </li> > <li><span class="label">Owner: </span><input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />[% loggedinusername %]</li> > <li><label for="sortfield" >Sort this list by: </label> > <select name="sortfield" id="sortfield"> >@@ -466,13 +449,15 @@ function placeHold () { > [% END %] > > [% IF ( edit ) %] >- <input type="hidden" name="op" value="modifsave" /> >+ <legend>Edit list <i>[% shelfname | html %]</i></legend> > <input type="hidden" name="display" value="[% display %]" /> >+ <input type="hidden" name="op" value="modifsave" /> > [% IF ( showprivateshelves ) %]<input type="hidden" name="display" value="privateshelves" />[% END %] >- <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" /> >- <legend>Edit list <i>[% shelfname | html %]</i></legend> >+ <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" /> > <ol> >- <li><label for="shelfname">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelfname |html %]" /></li> >+ <li><label for="shelfname" class="required">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelfname |html %]" required="required" class="required" /> >+ <span class="required">Required</span> >+ </li> > <li><label for="owner">Owner: </label><input type="hidden" id="owner" name="owner" value="[% IF ( owner ) %][% ownername %][% ELSE %][% loggedinusername %][% END %]" />[% IF ( owner ) %][% ownername %][% ELSE %][% loggedinusername %][% END %]</li> > <li><label for="sortfield" >Sort this list by: </label> > <select name="sortfield"> >@@ -499,7 +484,8 @@ function placeHold () { > [% END %] > > </fieldset> >- <fieldset class="action"><input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" /> >+ >+ <fieldset class="action"><input type="submit" value="Save" class="submit" /> > [% IF ( showprivateshelves ) %] > <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves" class="cancel">Cancel</a> > [% ELSE %] >@@ -516,7 +502,6 @@ function placeHold () { > <div class="help"><ul> > <li>A <b>Private</b> list is managed by you and can be seen only by you.</li> > <li> A <b>Public</b> list can be seen by everybody, but managed only by you.</li> >- <br/> > <li>The owner of a list is always allowed to add entries, but needs permission to remove.</li> > </ul> > </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 11789
:
25396
|
25408
|
25483
| 25520