[Koha-patches] [PATCH] Bug 11812 - Add missing "required" indicator to fields which are required

Owen Leonard oleonard at myacpl.org
Fri Feb 21 16:08:58 CET 2014


Form fields in the staff client which are required should be configured
to be so by doing several things:

- Add a class "required" to the field's <label>
- Add a class "required" to the form field
- Add 'required="required"' to the form field
- Apppend a <span class="required">Required</span> after the form field.

Several places in the templates are missing the <span>. This patch adds
them.

To test, apply the patch and view the following pages to confirm that
the "Required" text appears:

- Acquisitions -> Add an order to a basket from a new (empty) record.
  Title, quantity, and fund should indicate they are required.

- Administration -> Authority types ->  New authority type. The
  authority type and description fields should indicate they are
  required.

- Administration -> Authority types -> MARC structure -> New tag. The
  tag field should indicate it is required.

- Patron types and categories -> New category. Category code,
  description, and category type should indicate that they are required.
  FIXME: Enrollment period is required but the user must choose one. I'm
  not sure how to handle that clearly.

- Tools -> CSV profiles. Profile name, profile type, and profile MARC
  fields should indicate they are required on both the new and edit
  forms.

- Administration -> Manage MARC modification templates. Under "Create a
  new template" the name field should indicate that it is required.

- Tools -> Batch patron modification -> Submit a batch for editing. Any
  fields which are required according to your BorrowerMandatoryField
  system preference should indicate that they are required.
---
 .../prog/en/modules/acqui/neworderempty.tt         |    3 ++
 .../prog/en/modules/admin/auth_tag_structure.tt    |    5 +++-
 .../prog/en/modules/admin/authtypes.tt             |    6 +++-
 .../prog/en/modules/admin/categorie.tt             |   17 +++++++++--
 .../prog/en/modules/tools/csv-profiles.tt          |   30 ++++++++++++++------
 .../modules/tools/marc_modification_templates.tt   |    5 ++--
 .../prog/en/modules/tools/modborrowers.tt          |    5 +++-
 7 files changed, 54 insertions(+), 17 deletions(-)

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 596aa07..0b63305 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
@@ -240,6 +240,7 @@ $(document).ready(function()
             [% ELSE %]
             <label for="entertitle" class="required">Title: </label>
                 <input type="text" id="entertitle" size="50" name="title" value="[% title |html %]" class="focus" />
+                <span class="required">Required</span>
             [% END %]
         </li>
         <li>
@@ -404,6 +405,7 @@ $(document).ready(function()
                             <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
                         [% END %]
                     [% END %]
+                    <span class="required">Required</span>
                 [% END %]
                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
@@ -426,6 +428,7 @@ $(document).ready(function()
                     [% END %]
                 [% END %]
                 </select>
+                <span class="required">Required</span>
                 <label for="showallbudgets" style="float:none;width:auto;"> Show all:</label>
                 <input type="checkbox" id="showallbudgets" />
                 [% END %]
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 aed89bc..5a87e9c 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
@@ -92,7 +92,10 @@
                         [% 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>
+                    <li>
+                        <label for="tagfield" class="required">Tag: </label><input type="text" id="tagfield" name="tagfield" size="5" maxlength="3" required="required" class="required" />
+                        <span class="required">Required</span>
+                    </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>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt
index dcc606d..f84cad8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt
@@ -50,9 +50,13 @@
     [% ELSE %]
             <label for="authtypecode" class="required">Authority type: </label>
             <input id="authtypecode" type="text" class="required" required="required" name="authtypecode" size="10" maxlength="10" onblur="toUC(this)" />
+            <span class="required">Required</span>
     [% END %]
         </li>
-        <li><label for="authtypetext" class="required">Description: </label><input type="text" id="authtypetext" name="authtypetext" size="40" maxlength="80" value="[% authtypetext |html %]" class="required" required="required" /></li>
+        <li>
+            <label for="authtypetext" class="required">Description: </label><input type="text" id="authtypetext" name="authtypetext" size="40" maxlength="80" value="[% authtypetext |html %]" class="required" required="required" />
+            <span class="required">Required</span>
+        </li>
 		<li><label for="summary">Summary: </label><textarea id="summary" name="summary" cols="55" rows="7">[% summary %]</textarea></li>
 		<li>
 		<p class="tip">Note: for 'Authority field to copy', enter the authority field that should be copied from the authority record to the bibliographic record. E.g., in MARC21, field 100 in the authority record should be copied to field 100 in the bibliographic record</p>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
index b9e6740..9349f29 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
@@ -129,9 +129,17 @@
     <li><span class="label">Category code: </span>[% categorycode |html %]
 				<input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
 	[% ELSE %]
-    <li><label for="categorycode" class="required">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
+    <li>
+        <label for="categorycode" class="required">Category code: </label>
+        <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" />
+        <span class="required">Required</span>
+    </li>
 	[% END %]
-    <li><label for="description" class="required">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
+    <li>
+        <label for="description" class="required">Description: </label>
+        <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" />
+        <span class="required">Required</span>
+    </li>
     <li><label for="enrolmentperiod" class="required">Enrollment period: </label>
 	<fieldset>
 	<legend>Choose one</legend>
@@ -167,7 +175,9 @@
 			[% END %]
 					</select></li>
 	<li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
-    <li><label for="category_type" class="required">Category type: </label> <select name="category_type" id="category_type">
+    <li>
+        <label for="category_type" class="required">Category type: </label>
+        <select name="category_type" id="category_type">
                         [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
 					[% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
 					[% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
@@ -176,6 +186,7 @@
 					[% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
 					[% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
 					</select>
+        <span class="required">Required</span>
     </li>
     <li><label for="branches">Branches limitation: </label>
         <select id="branches" name="branches" multiple size="10">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt
index 1790508..9cd719a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt
@@ -87,8 +87,11 @@ function reloadPage(p) {
                         <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
 						<fieldset class="rows">
                           <ol>
-                            <li><label for="profile_name" class="required">Profile name: </label>
-                            <input type="text" id="profile_name" name="profile_name" required="required" /></li>
+                            <li>
+                                <label for="profile_name" class="required">Profile name: </label>
+                                <input type="text" id="profile_name" name="profile_name" required="required" />
+                                <span class="required">Required</span>
+                            </li>
 
                             <li>
                               <label for="profile_type" class="required">Profile type: </label>
@@ -96,6 +99,7 @@ function reloadPage(p) {
                                 <option value="marc" selected="selected">MARC</option>
                                 <option value="sql">SQL</option>
                               </select>
+                              <span class="required">Required</span>
                             </li>
 
 						    <li><label for="profile_description">Profile description: </label>
@@ -152,8 +156,10 @@ function reloadPage(p) {
 						    </select></li>
 
 
-                            <li class="marc_specific"><label for="new_profile_marc_content" class="required">Profile MARC fields: </label>
-                            <textarea cols="50" rows="2" name="profile_marc_content" id="new_profile_marc_content"></textarea>
+                            <li class="marc_specific">
+                                <label for="new_profile_marc_content" class="required">Profile MARC fields: </label>
+                                <textarea cols="50" rows="2" name="profile_marc_content" id="new_profile_marc_content"></textarea>
+                                <span class="required">Required</span>
 						    <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
                             <p>You can also use your own headers (instead of the ones from Koha) by prefixing the field number with an header, followed by the equal sign.</p>
 						    <p>Example: Personal name=200|Entry element=210$a|300|009</p>
@@ -180,7 +186,7 @@ function reloadPage(p) {
 						<fieldset class="rows">
                             <ol>
                             <li><label for="modify_profile_name" class="required">Profile name: </label>
-						    <select id="modify_profile_name" name="profile_name" onchange="javascript:reloadPage(this)">
+                                <select id="modify_profile_name" name="profile_name" required="required" class="required" onchange="javascript:reloadPage(this)">
 							<option value="0">-- Choose One --</option>
 							[% FOREACH existing_profile IN existing_profiles %]
 							[% IF ( existing_profile.export_format_id == selected_profile_id ) %]
@@ -189,11 +195,13 @@ function reloadPage(p) {
 							<option value="[% existing_profile.export_format_id %]">[% existing_profile.profile %]</option>
 							[% END %]
 							[% END %]
-						    </select></li>
+                            </select>
+                            <span class="required">Required</span>
+                            </li>
 
                             <li>
                               <label for="modify_profile_type" class="required">Profile type: </label>
-                              <select id="modify_profile_type" name="profile_type">
+                              <select id="modify_profile_type" name="profile_type" class="required" required="required">
                                 <option value="marc">MARC</option>
                                 [% IF selected_profile_type == "sql" %]
                                   <option value="sql" selected="selected">SQL</option>
@@ -201,6 +209,7 @@ function reloadPage(p) {
                                   <option value="sql">SQL</option>
                                 [% END %]
                               </select>
+                                <span class="required">Required</span>
                             </li>
 
 
@@ -352,8 +361,11 @@ function reloadPage(p) {
 							[% END %]
 						    </select></li>
 
-                            <li class="marc_specific"><label for="modify_profile_marc_content" class="required">Profile MARC fields: </label>
-                            <textarea cols="50" rows="2" name="profile_marc_content" id="modify_profile_marc_content">[% selected_profile_content %]</textarea></li>
+                            <li class="marc_specific">
+                                <label for="modify_profile_marc_content" class="required">Profile MARC fields: </label>
+                                <textarea cols="50" rows="2" name="profile_marc_content" id="modify_profile_marc_content" class="required" required="required">[% selected_profile_content %]</textarea>
+                                <span class="required">Required</span>
+                            </li>
 
                             <li class="sql_specific">
                               <label for="modify_profile_sql_content" class="required">Profile SQL fields: </label>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
index 871fa77..462582f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
@@ -501,12 +501,13 @@ function setSelectByValue( selectId, value ) {
                 <div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div>
             [% END %]
 
-            <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" >
+            <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated">
                 <fieldset>
                     <legend>Create a new template</legend>
 
                     <label for="template_name" class="required">Name: </label>
-                    <input name="template_name" id="template_name" type="text" size="30" required="required" />
+                    <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" />
+                    <span class="required">Required</span>
 
                     <input type="hidden" name="op" value="create_template" />
                     <input type="submit" value="Create template" />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt
index a55dbd4..ff44a3d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt
@@ -316,7 +316,10 @@
                                             [% IF ( field.type == 'date' ) %]
                                                 <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" readonly="readonly" class="datepicker" />
                                                 <a href="#" class="clear-field" onclick="clearDate('[% field.name %]');return false;">Clear</a>
-                                                [% END %]
+                                            [% END %]
+                                            [% IF field.mandatory %]
+                                                <span class="required">Required</span>
+                                            [% END %]
                                         </li>
                                         [% END %]
                                         [% IF ( patron_attributes_codes ) %]
-- 
1.7.9.5


More information about the Koha-patches mailing list