← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17480: Added short name field to category option

 

------------------------------------------------------------
revno: 17480
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-11-15 14:26:06 +0100
message:
  Added short name field to category option
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ValidateDataElementCategoryOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionStore.java	2014-10-17 20:57:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionStore.java	2014-11-15 13:26:06 +0000
@@ -30,13 +30,13 @@
 
 import java.util.List;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
 /**
  * @author Lars Helge Overland
  */
 public interface CategoryOptionStore
-    extends GenericIdentifiableObjectStore<DataElementCategoryOption>
+    extends GenericNameableObjectStore<DataElementCategoryOption>
 {
     List<DataElementCategoryOption> getCategoryOptions( DataElementCategory category );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2014-10-23 10:07:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2014-11-15 13:26:06 +0000
@@ -227,6 +227,14 @@
     DataElementCategoryOption getDataElementCategoryOptionByName( String name );
 
     /**
+     * Retrieves the DataElementCategoryOption with the given short name.
+     * 
+     * @param shortName the short name.
+     * @return the DataElementCategoryOption with the given short name.
+     */
+    DataElementCategoryOption getDataElementCategoryOptionByShortName( String shortName );
+
+    /**
      * Retrieves the DataElementCategoryOption with the given code.
      * 
      * @param code the code.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2014-10-23 10:07:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2014-11-15 13:26:06 +0000
@@ -310,6 +310,12 @@
     }
 
     @Override
+    public DataElementCategoryOption getDataElementCategoryOptionByShortName( String shortName )
+    {
+        return i18n( i18nService, categoryOptionStore.getByShortName( shortName ) );
+    }
+    
+    @Override
     public DataElementCategoryOption getDataElementCategoryOptionByCode( String code )
     {
         return i18n( i18nService, categoryOptionStore.getByCode( code ) );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-11-07 16:06:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-11-15 13:26:06 +0000
@@ -143,7 +143,6 @@
         executeSql( "ALTER TABLE reporttable DROP column docategoryoptioncombos" );
         executeSql( "ALTER TABLE reporttable DROP column mode" );
         executeSql( "ALTER TABLE categoryoptioncombo DROP COLUMN displayorder" );
-        executeSql( "ALTER TABLE dataelementcategoryoption DROP COLUMN shortname" );
         executeSql( "ALTER TABLE section DROP COLUMN label" );
         executeSql( "ALTER TABLE section DROP COLUMN title" );
         executeSql( "ALTER TABLE organisationunit DROP COLUMN polygoncoordinates" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2014-09-29 21:40:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2014-11-15 13:26:06 +0000
@@ -17,6 +17,8 @@
 
     <property name="name" column="name" not-null="true" unique="true" length="230" />
 
+    <property name="shortName" column="shortname" unique="true" length="50" />
+
     <property name="startDate" type="date" />
 
     <property name="endDate" type="date" />

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm	2014-06-13 07:55:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataElementCategoryOption.vm	2014-11-15 13:26:06 +0000
@@ -3,8 +3,8 @@
     "id":  "${dataElementCategoryOption.id}" ,
     "uid":  "${dataElementCategoryOption.uid}" ,
     "name": "$!encoder.jsonEncode( ${dataElementCategoryOption.name} )",
+    "shortName": "$!encoder.jsonEncode( ${dataElementCategoryOption.shortName} )",
     "startDate": "$!format.formatDate( ${dataElementCategoryOption.startDate} )",
-    "endDate": "$!format.formatDate( ${dataElementCategoryOption.endDate} )",
-	"concept": "$!encoder.jsonEncode(${dataElementCategoryOption.concept.name})"
+    "endDate": "$!format.formatDate( ${dataElementCategoryOption.endDate} )"
   }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-10-17 08:04:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-11-15 13:26:06 +0000
@@ -111,8 +111,10 @@
     $el.val(localDate);
   });
 
-  options.altField = '#' + isoFieldId;
-
+  if (options) {
+	  options.altField = '#' + isoFieldId;
+  }
+  
   $el.calendarsPicker($.extend({}, this.defaults, options));
 };
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryOptionAction.java	2014-11-15 13:26:06 +0000
@@ -35,6 +35,7 @@
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 
 import com.opensymphony.xwork2.Action;
+
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -74,6 +75,13 @@
         this.name = name;
     }
 
+    private String shortName;
+
+    public void setShortName( String shortName )
+    {
+        this.shortName = shortName;
+    }
+
     private String code;
 
     public void setCode( String code )
@@ -131,6 +139,7 @@
         }
 
         dataElementCategoryOption = new DataElementCategoryOption( name );
+        dataElementCategoryOption.setShortName( shortName );
         dataElementCategoryOption.setCode( code );
         dataElementCategoryOption.setStartDate( sDate );
         dataElementCategoryOption.setEndDate( eDate );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java	2014-11-15 13:26:06 +0000
@@ -36,6 +36,7 @@
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 
 import com.opensymphony.xwork2.Action;
+
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.Date;
@@ -82,6 +83,13 @@
         this.name = name;
     }
 
+    private String shortName;
+
+    public void setShortName( String shortName )
+    {
+        this.shortName = shortName;
+    }
+
     private String code;
 
     public void setCode( String code )
@@ -140,6 +148,7 @@
 
         DataElementCategoryOption categoryOption = dataElementCategoryService.getDataElementCategoryOption( id );
         categoryOption.setName( name );
+        categoryOption.setShortName( shortName );
         categoryOption.setCode( code );
         categoryOption.setStartDate( sDate );
         categoryOption.setEndDate( eDate );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ValidateDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ValidateDataElementCategoryOptionAction.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ValidateDataElementCategoryOptionAction.java	2014-11-15 13:26:06 +0000
@@ -69,6 +69,13 @@
     {
         this.name = name;
     }
+    
+    private String shortName;
+
+    public void setShortName( String shortName )
+    {
+        this.shortName = shortName;
+    }
 
     private String code;
 
@@ -114,6 +121,18 @@
             }
         }
 
+        if ( shortName != null )
+        {
+            DataElementCategoryOption match = dataElementCategoryService.getDataElementCategoryOptionByShortName( shortName );
+
+            if ( match != null && (id == null || match.getId() != id) )
+            {
+                message = i18n.getString( "short_name_in_use" );
+
+                return ERROR;
+            }
+        }
+
         if ( code != null )
         {
             DataElementCategoryOption match = dataElementCategoryService.getDataElementCategoryOptionByCode( code );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2014-10-21 07:03:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2014-11-15 13:26:06 +0000
@@ -474,6 +474,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm</param>
       <param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
+      <param name="javascripts">javascript/categoryOption.js</param>
       <param name="anyAuthorities">F_CATEGORY_OPTION_PUBLIC_ADD, F_CATEGORY_OPTION_PRIVATE_ADD</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js	2014-06-22 13:38:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js	2014-11-15 13:26:06 +0000
@@ -63,3 +63,22 @@
     $( "#moreOptions" ).toggle();
 }
 
+function showDataElementCategoryOptionDetails( context ) {
+	jQuery.post( 'getDataElementCategoryOption.action', { id: context.id } ,function ( json ) {		
+		setInnerHTML( 'nameField', json.dataElementCategoryOption.name );
+		setInnerHTML( 'shortNameField', json.dataElementCategoryOption.shortName );
+		setInnerHTML( 'codeField', json.dataElementCategoryOption.code );
+		setInnerHTML( 'startDateField', json.dataElementCategoryOption.startDate );
+		setInnerHTML( 'endDateField', json.dataElementCategoryOption.endDate );
+		setInnerHTML( 'idField', json.dataElementCategoryOption.uid );
+        showDetails();
+	});
+}
+
+function removeDataElementCategoryOption( context ) {
+	removeItem( context.id, context.name, i18n_confirm_delete, 'removeDataElementCategoryOption.action' );
+}
+
+function showUpdateDataElementCategoryOptionForm( context ) {
+    location.href = 'showUpdateDataElementCategoryOptionForm.action?id=' + context.id;
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm	2014-06-22 13:38:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm	2014-11-15 13:26:06 +0000
@@ -3,10 +3,6 @@
 		validation( 'addDataElementCategoryOptionForm', function(form){
 		form.submit();
 	});
-
-        dhis2.period.picker.createInstance('#startDate');
-        dhis2.period.picker.createInstance('#endDate');
-
         $('#startDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
         $('#endDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
 
@@ -16,7 +12,11 @@
         selection.clearSelected();
 
         checkValueIsExist( "name", "validateDataElementCategoryOption.action" );
+        checkValueIsExist( "shortName", "validateDataElementCategoryOption.action" );
         checkValueIsExist( "code", "validateDataElementCategoryOption.action" );
+        
+        dhis2.period.picker.createInstance('#startDate');
+        dhis2.period.picker.createInstance('#endDate');        
 	});
 
     var i18n_specify_category_option_name = '$encoder.jsEscape( $i18n.getString( "specify_category_option_name" ) , "'")';
@@ -43,7 +43,11 @@
     <tr>
       <td style="width: 100px"><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
       <td><input type="text" id="name" name="name" class="{validate:{required:true,rangelength:[2,150]}}"/></td>
-    </tr>   
+    </tr>
+    <tr>
+      <td style="width: 100px"><label>$i18n.getString( "short_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+      <td><input type="text" id="shortName" name="shortName" class="{validate:{rangelength:[2,50]}}"/></td>
+    </tr>
 	<tr>
 	  <td><label>$i18n.getString( "code" )</td>
 	  <td><input type="text" id="code" name="code"/></td>
@@ -60,7 +64,7 @@
       <td><input type="text" id="startDate" name="startDate"></td>
     </tr>
     <tr>
-      <td><label for="endDate">$i18n.getString( 'end_date' )</label></td>
+      <td style="width: 100px"><label for="endDate">$i18n.getString( 'end_date' )</label></td>
       <td><input type="text" id="endDate" name="endDate"></td>
     </tr>
   </table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm	2014-07-25 13:31:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm	2014-11-15 13:26:06 +0000
@@ -11,28 +11,6 @@
     });
 	});
 	
-	function showDataElementCategoryOptionDetails( context ) {
-		jQuery.post( 'getDataElementCategoryOption.action', { id: context.id } ,
-			function ( json ) {
-			
-				setInnerHTML( 'nameField', json.dataElementCategoryOption.name );
-				setInnerHTML( 'codeField', json.dataElementCategoryOption.code );
-				setInnerHTML( 'startDateField', json.dataElementCategoryOption.startDate );
-				setInnerHTML( 'endDateField', json.dataElementCategoryOption.endDate );
-				setInnerHTML( 'conceptField', json.dataElementCategoryOption.concept );
-				setInnerHTML( 'idField', json.dataElementCategoryOption.uid );
-
-                showDetails();
-		});
-	}
-	
-	function removeDataElementCategoryOption( context ) {
-		removeItem( context.id, context.name, i18n_confirm_delete, 'removeDataElementCategoryOption.action' );
-	}
-
-  function showUpdateDataElementCategoryOptionForm( context ) {
-    location.href = 'showUpdateDataElementCategoryOptionForm.action?id=' + context.id;
-  }
 
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_category_option" ) , "'" )';
 </script>
@@ -87,11 +65,11 @@
         <div id="hideDetailsArea">
         <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
       </div>
-      <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+          <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+          <p><label>$i18n.getString( "short_name" ):</label><br/><span id="shortNameField"></span></p>
           <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
           <p><label>$i18n.getString( "start_date" ):</label><br/><span id="startDateField"></span></p>
           <p><label>$i18n.getString( "end_date" ):</label><br/><span id="endDateField"></span></p>
-		  <p><label>$i18n.getString( "concept" ):</label><br/><span id="conceptField"></span></p>
 		  <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
 	  </div>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm	2014-11-15 12:54:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm	2014-11-15 13:26:06 +0000
@@ -5,9 +5,6 @@
 			'rules': getValidationRules("dateElementCategoryOption")
 		});
 
-        dhis2.period.picker.createInstance('#startDate');
-        dhis2.period.picker.createInstance('#endDate');
-
         $('#startDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
         $('#endDate').calendarsPicker('option', 'maxDate', dhis2.period.calendar.add(dhis2.period.calendar.today(), 100, 'y'));
 
@@ -19,6 +16,11 @@
         #if ( $moreOptionsPresent ) showMoreOrFewerOptions(); #end
 
         checkValueIsExist( "name", "validateDataElementCategoryOption.action", {id: $dataElementCategoryOption.id} );
+        checkValueIsExist( "shortName", "validateDataElementCategoryOption.action", {id: $dataElementCategoryOption.id} );
+        checkValueIsExist( "code", "validateDataElementCategoryOption.action", {id: $dataElementCategoryOption.id} );
+        
+        dhis2.period.picker.createInstance('#startDate');
+        dhis2.period.picker.createInstance('#endDate');
 	});
 
     var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_category_option" ) , "'")';
@@ -48,7 +50,11 @@
     <tr>
       <td style="width: 100px"><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
       <td><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $dataElementCategoryOption.name )" class="{validate:{required:true,rangelength:[2,150]}}"/></td>
-    </tr>      
+    </tr>
+    <tr>
+      <td style="width: 100px"><label>$i18n.getString( "short_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+      <td><input type="text" id="shortName" name="shortName" value="$!encoder.htmlEncode( $dataElementCategoryOption.shortName )" class="{validate:{rangelength:[2,50]}}"/></td>
+    </tr>
 	<tr>
 	  <td><label>$i18n.getString( "code" )</label></td>
 	  <td><input type="text" id="code" name="code" value="$!encoder.htmlEncode( $dataElementCategoryOption.code )" /></td>
@@ -65,7 +71,7 @@
       <td><input type="text" id="startDate" name="startDate" value="$!format.formatDate( $!dataElementCategoryOption.startDate )"></td>
     </tr>
     <tr>
-      <td><label for="endDate">$i18n.getString( 'end_date' )</label></td>
+      <td style="width: 100px"><label for="endDate">$i18n.getString( 'end_date' )</label></td>
       <td><input type="text" id="endDate" name="endDate" value="$!format.formatDate( $!dataElementCategoryOption.endDate )"></td>
     </tr>
   </table>