Owen Leonard
c28f7d7de5
This patch adds the jQuery "Validation" plugin (http://docs.jquery.com/Plugins/Validation) and includes it by default in the staff client along with an include file containing translatable strings for all of the plugin's possible messages. The staff client's main JavaScript file has been modified to perform automatic validation of any form with the class "validated." For a simple example I have modified the library entry form to mark required fields as required (something which had not been done before). Each required field has been given a class, "required" and the HTML5 attribute "required." The former adds the hook for the plugin, the latter adds browser-based validation in recent browsers (and which will be superceded by the plugin if JavaScript is enabled). This will check for inputs classed "required" without any additional configuration. More complex forms (with specific data types, for instance) will require more inline JavaScript configuration. $("#FormID").validate({ /* configuration details */ }); Also added to the library entry form are checks on the email and URL fields via classes ("email" and "url", respectively). This demonstrates validation of content without forcing the field to be required. To test, go to Administration -> Libraries and Groups and choose "New library." Submit the form without entering a library code or name. You should be prevented from submitting the form and be shown an error message by each field. Perform the same check with an existing entry. To test browser-based validation, disable JavaScript and follow the same procedure. Revision rebases the patch against current master and adds missing "//<![CDATA[" Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Work as described with new or existing library. No errors. Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
73 lines
3.7 KiB
HTML
73 lines
3.7 KiB
HTML
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% themelang %]/includes/favicon.ico[% END %]" type="image/x-icon" />
|
|
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui.css" />
|
|
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/bootstrap/bootstrap.min.css" />
|
|
<link rel="stylesheet" type="text/css" media="print" href="[% themelang %]/css/print.css" />
|
|
[% IF ( intranetstylesheet ) %]
|
|
<link rel="stylesheet" type="text/css" href="[% intranetstylesheet %]" />
|
|
[% ELSE %]
|
|
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
|
|
[% END %]
|
|
[% IF ( IntranetUserCSS ) %]<style type="text/css">[% IntranetUserCSS %]</style>[% END %]
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.hotkeys.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
|
|
|
|
[% IF ( login ) %]
|
|
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/login.css" />
|
|
[% END %]
|
|
[% IF ( wizard ) %]
|
|
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/wizard.css" />
|
|
[% END %]
|
|
|
|
<!-- local colors -->
|
|
[% IF ( intranetcolorstylesheet ) %]
|
|
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/[% intranetcolorstylesheet %]" />
|
|
[% END %]
|
|
|
|
<!-- yui js -->
|
|
<script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
|
|
<script type="text/javascript" src="[% yuipath %]/button/button-min.js"></script>
|
|
<script type="text/javascript" src="[% yuipath %]/container/container_core-min.js"></script>
|
|
<script type="text/javascript" src="[% yuipath %]/menu/menu-min.js"></script>
|
|
|
|
<!-- koha core js -->
|
|
<script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
|
|
[% INCLUDE 'validator-strings.inc' %]
|
|
[% IF ( intranetuserjs ) %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
[% intranetuserjs %]
|
|
//]]>
|
|
</script>
|
|
[% END %]
|
|
[% IF ( virtualshelves || intranetbookbag ) %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
var MSG_BASKET_EMPTY = _("Your cart is currently empty");
|
|
var MSG_RECORD_IN_BASKET = _("This item is already in your cart");
|
|
var MSG_RECORD_ADDED = _("This item has been added to your cart");
|
|
var MSG_NRECORDS_ADDED = _(" item(s) added to your cart");
|
|
var MSG_NRECORDS_IN_BASKET = _("already in your cart");
|
|
var MSG_NO_RECORD_SELECTED = _("No item was selected");
|
|
var MSG_NO_RECORD_ADDED = _("No item was added to your cart");
|
|
var MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty your cart?");
|
|
var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?");
|
|
var MSG_IN_YOUR_CART = _("Items in your cart: ");
|
|
var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved.");
|
|
//]]>
|
|
</script>
|
|
<script type="text/javascript" src="[% themelang %]/js/basket.js"></script>
|
|
[% END %]
|
|
[% IF LocalCoverImages %]
|
|
<script type="text/javascript" src="[% themelang %]/js/localcovers.js"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
var NO_LOCAL_JACKET = _("No cover image available");
|
|
//]]>
|
|
</script>
|
|
[% END %]
|