← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5620: minor refactor, and start of new dataentry screen for mobile

 

------------------------------------------------------------
revno: 5620
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-27 11:32:41 +0100
message:
  minor refactor, and start of new dataentry screen for mobile
removed:
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm
added:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetSectionFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml


--
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
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java	2011-12-27 10:32:41 +0000
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.dataentry.action;
+
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.dataset.CompleteDataSetRegistration;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.light.dataentry.utils.FormUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.user.CurrentUserService;
+
+import java.util.Date;
+
+/**
+ * @author mortenoh
+ */
+public class GetDataSetOverviewAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    private CompleteDataSetRegistrationService registrationService;
+
+    public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
+    {
+        this.registrationService = registrationService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private FormUtils formUtils;
+
+    public void setFormUtils( FormUtils formUtils )
+    {
+        this.formUtils = formUtils;
+    }
+
+    public FormUtils getFormUtils()
+    {
+        return formUtils;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+
+    public Integer getOrganisationUnitId()
+    {
+        return organisationUnitId;
+    }
+
+    private String periodId;
+
+    public void setPeriodId( String periodId )
+    {
+        this.periodId = periodId;
+    }
+
+    public String getPeriodId()
+    {
+        return periodId;
+    }
+
+    private Integer dataSetId;
+
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    public Integer getDataSetId()
+    {
+        return dataSetId;
+    }
+
+    private DataSet dataSet;
+
+    public DataSet getDataSet()
+    {
+        return dataSet;
+    }
+
+    private Boolean complete;
+
+    public void setComplete( Boolean complete )
+    {
+        this.complete = complete;
+    }
+
+    public Boolean getComplete()
+    {
+        return complete;
+    }
+
+    private Boolean markComplete;
+
+    public Boolean getMarkComplete()
+    {
+        return markComplete;
+    }
+
+    public void setMarkComplete( Boolean markComplete )
+    {
+        this.markComplete = markComplete;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+        Period period = periodService.getPeriodByExternalId( periodId );
+
+        dataSet = dataSetService.getDataSet( dataSetId );
+
+        CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dataSet, period,
+            organisationUnit );
+
+        complete = registration != null ? true : false;
+
+        if ( markComplete != null )
+        {
+            if ( markComplete && !complete )
+            {
+                registration = new CompleteDataSetRegistration();
+                registration.setDataSet( dataSet );
+                registration.setPeriod( period );
+                registration.setSource( organisationUnit );
+                registration.setDate( new Date() );
+                registration.setStoredBy( currentUserService.getCurrentUsername() );
+
+                registrationService.saveCompleteDataSetRegistration( registration );
+
+                complete = true;
+            }
+            else if ( !markComplete && complete )
+            {
+                registrationService.deleteCompleteDataSetRegistration( registration );
+
+                complete = false;
+            }
+        }
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetSectionFormAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetSectionFormAction.java	2011-12-27 10:32:41 +0000
@@ -27,17 +27,9 @@
 
 package org.hisp.dhis.light.dataentry.action;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataset.CompleteDataSetRegistration;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.dataset.Section;
+import org.hisp.dhis.dataset.*;
 import org.hisp.dhis.datavalue.DeflatedDataValue;
 import org.hisp.dhis.light.dataentry.utils.FormUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -45,7 +37,10 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author mortenoh
@@ -190,14 +185,15 @@
     {
         return greyedFields;
     }
-    
+
     // FIXME: Not in use, but seems to be referenced in html.
     private Map<String, String> typeViolations = new HashMap<String, String>();
-    
-    public Map<String, String> getTypeViolations() {
-         return typeViolations;
-     }
-    
+
+    public Map<String, String> getTypeViolations()
+    {
+        return typeViolations;
+    }
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -222,7 +218,7 @@
 
         complete = registration != null ? true : false;
 
-        if ( dataSet.getDataSetType() == DataSet.TYPE_SECTION )
+        if ( dataSet.getDataSetType().equals( DataSet.TYPE_SECTION ) )
         {
             setGreyedFields();
         }
@@ -239,6 +235,6 @@
                 greyedFields.put( operand.getDataElement().getId() + ":" + operand.getCategoryOptionCombo().getId(),
                     true );
             }
-        }        
+        }
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2011-12-20 13:57:04 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2011-12-27 10:32:41 +0000
@@ -37,6 +37,16 @@
     <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
   </bean>
 
+  <bean id="org.hisp.dhis.light.dataentry.action.GetDataSetOverviewAction" class="org.hisp.dhis.light.dataentry.action.GetDataSetOverviewAction"
+        scope="prototype">
+    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+    <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
+    <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+    <property name="formUtils" ref="org.hisp.dhis.light.dataentry.utils.FormUtils" />
+  </bean>
+
   <bean id="org.hisp.dhis.light.dataentry.action.GetSectionFormAction" class="org.hisp.dhis.light.dataentry.action.GetSectionFormAction"
     scope="prototype">
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2011-12-20 13:57:04 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2011-12-27 10:32:41 +0000
@@ -29,9 +29,9 @@
       <param name="page">/dhis-web-light/selectPeriod.vm</param>
     </action>
 
-    <action name="dataEntry" class="org.hisp.dhis.light.dataentry.action.GetSectionFormAction">
+    <action name="dataEntry" class="org.hisp.dhis.light.dataentry.action.GetDataSetOverviewAction">
       <result name="success" type="velocity">/dhis-web-light/main.vm</result>
-      <param name="page">/dhis-web-light/dataEntry.vm</param>
+      <param name="page">/dhis-web-light/dataEntryOverview.vm</param>
     </action>
 
     <action name="saveSectionForm" class="org.hisp.dhis.light.dataentry.action.SaveSectionFormAction">

=== removed file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm	2011-12-08 16:03:30 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm	1970-01-01 00:00:00 +0000
@@ -1,141 +0,0 @@
-
-#set( $Integer = 0 )
-
-#if( $dataSet.alternativeName )
-	#set( $dataSetName = $dataSet.alternativeName )
-#else
-	#set( $dataSetName = $dataSet.name )
-#end
-
-<h2>$encoder.htmlEncode( $dataSetName )</h2>
-
-#set( $validationRuleViolationsSize = $validationRuleViolations.size() )
-#set( $validationViolationsSize = $validationViolations.size() )
-#set( $typeViolationsSize = $typeViolations.size() )
-
-#if( $validationRuleViolationsSize > 0 || $validationViolationsSize > 0 || $typeViolationsSize > 0 )
-<div class="header-box" align="center">
-	<h3 style="text-align: left; background-color: #990000; color: white;">$i18n.getString("warnings_and_errors")</h3>
-	<p style="text-align: left;">
-		#if( $validationRuleViolationsSize > 0 )
-			$validationRuleViolationsSize $i18n.getString("validation_rule_violation_warnings"). <br />
-		#end
-		#if( $validationViolationsSize > 0 )
-			$validationViolationsSize $i18n.getString("minmax_violation_warnings"). <br />
-		#end
-		#if( $typeViolationsSize > 0 )
-			$typeViolationsSize $i18n.getString("type_violation_errors"). <br />
-		#end
-	</p>
-</div>
-#end
-
-#if( $validationRuleViolationsSize > 0 )
-<div class="header-box" align="center">
-	<h3 style="text-align: left; background-color: #990000; color: white;">$i18n.getString("validation_rule_violations")</h3>
-	<p style="text-align: left;">
-	#foreach( $validationRuleViolation in $validationRuleViolations )
-		$validationRuleViolation <br />
-	#end
-	</p>
-</div>
-#end
-
-<form action="saveSectionForm.action" method="POST">
-
-<input type="hidden" id="organisationUnitId" name="organisationUnitId" value="$organisationUnitId" />
-<input type="hidden" id="dataSetId" name="dataSetId" value="$dataSetId" />
-<input type="hidden" id="periodId" name="periodId" value="$periodId" />
-<input type="hidden" id="validated" name="validated" value="#if($validated)true#{else}false#end" />
-
-#macro( createSection $sectionName $dataElements )
-<div class="header-box" align="center">
-	<h3 style="text-align: left;">$sectionName</h3>
-	<p style="text-align: left;">
-		#foreach( $dataElement in $dataElements)
-			#if( $dataElement.shortName )
-				#set( $dataElementName = $dataElement.shortName )
-			#else
-				#set( $dataElementName = $dataElement.name )
-			#end
-
-			#foreach( $optionCombo in $dataElement.categoryCombo.optionCombos )
-                
-                #if( !$greyedFields.get( "$dataElement.id:$optionCombo.id" ) ) 
-				#set( $key = "DE${dataElement.id}OC${optionCombo.id}" )
-
-				<label>$encoder.htmlEncode( $dataElementName ) #if( $optionCombo.name!="(default)")$encoder.htmlEncode( $optionCombo.name )#end</label>
-
-				#if( $validationViolations.get( $key ) )
-					#set( $validationViolation = $validationViolations.get( $key ) )
-
-	                #if( $formUtils.valueHigher( $validationViolation.value, $validationViolation.max ) )
-	                    <br /><span style="color: #990000;">Too high (max $validationViolation.max)</span>
-	                #elseif( $formUtils.valueLower( $validationViolation.value, $validationViolation.min ) )
-	                    <br /><span style="color: red;">Too low (min $validationViolation.min)</span>
-	                #else
-	                    <br /><span style="color: red;">Not a number</span>
-	                #end
-                #end
-
-				#if( $typeViolations.get( $key ) )
-					#set( $typeViolation = $typeViolations.get( $key ) )
-                    <br /><span style="color: #990000;">$typeViolation</span>
-                #end
-
-				#if( $dataElement.type == "string" )
-					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
-				#elseif( $dataElement.type == "bool" )
-					<select name="$key" style="width: 100%;">
-						<option value="">[ No Value ]</option>
-						<option value="true" #if($!dataValues.get($key) == "true")selected="selected"#end>Yes</option>
-						<option value="false" #if($!dataValues.get($key) == "false")selected="selected"#end>No</option>
-					</select>
-				#elseif( $dataElement.type == "date" )
-					<input type="date" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
-				#elseif( $dataElement.type == "int" && $dataElement.numberType == "number" )
-					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
-				#elseif( $dataElement.type == "int" && $dataElement.numberType == "int" )
-					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
-				#elseif( $dataElement.type == "int" && $dataElement.numberType == "positiveNumber" )
-					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
-				#elseif( $dataElement.type == "int" && $dataElement.numberType == "negativeNumber" )
-					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
-				#end
-				#end
-			#end
-		#end
-	</p>
-</div>
-#end
-
-#if( $dataSet.sections.size() > 0 )
-    #foreach( $section in $dataSet.sections )
-        #createSection( $section.name $section.dataElements )
-    #end
-#else
-    #createSection( "Default" $dataSet.dataElements )
-#end
-
-<div class="header-box" align="center">
-	<p style="text-align: left;">
-		<input type="checkbox" id="complete" name="complete" value="true" #if($complete)checked="true"#end style="width: 15px; height: 15px; vertical-align: middle;" />
-        <label for="complete" style="vertical-align: middle; width: auto;">$i18n.getString("dataset_is_complete")</label>
-	</p>
-</div>
-
-<div class="header-box" align="center">
-	<p>
-		<input type="submit" style="width: 100%;" value="$i18n.getString("save")" />
-	</p>
-</div>
-
-</form>
-
-<div id="footer">
-<h2>$i18n.getString( "navigate_to" )</h2>
-<ul>
-	<li><a href="selectPeriod.action?organisationUnitId=$organisationUnitId&dataSetId=$dataSetId&periodId=$periodId">$i18n.getString("available_periods")</a></li>
-	<li><a href="index.action">$i18n.getString("home")</a></li>
-</ul>
-</div>

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm	2011-12-27 10:32:41 +0000
@@ -0,0 +1,41 @@
+
+<h2>$encoder.htmlEncode( "Sections" )</h2>
+
+<p>
+<ul>
+#if( $dataSet.sections.size() > 0 )
+    #foreach( $section in $dataSet.sections )
+        <li><a href="entry">$i18n.getString( $section.name )</a></li>
+    #end
+#else
+    <li><a href="entry">$i18n.getString( "Default" )</a></li>
+#end
+</ul>
+</p>
+
+<form method="GET" action="dataEntry.action">
+
+<input type="hidden" id="organisationUnitId" name="organisationUnitId" value="$organisationUnitId" />
+<input type="hidden" id="dataSetId" name="dataSetId" value="$dataSetId" />
+<input type="hidden" id="periodId" name="periodId" value="$periodId" />
+
+<div class="header-box" align="center">
+    <p>
+        #if($complete)
+            <input type="hidden" name="markComplete" value="false" />
+            <input type="submit" style="width: 100%;" value="$i18n.getString("mark_as_not_complete")" />
+        #else
+            <input type="hidden" name="markComplete" value="true" />
+            <input type="submit" style="width: 100%;" value="$i18n.getString("mark_as_complete")" />
+        #end
+    </p>
+</div>
+</form>
+
+<div id="footer">
+    <h2>$i18n.getString( "navigate_to" )</h2>
+    <ul>
+        <li><a href="selectPeriod.action?organisationUnitId=$organisationUnitId&dataSetId=$dataSetId&periodId=$periodId">$i18n.getString("available_periods")</a></li>
+        <li><a href="index.action">$i18n.getString("home")</a></li>
+    </ul>
+</div>

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm	2011-12-27 10:32:41 +0000
@@ -0,0 +1,141 @@
+
+#set( $Integer = 0 )
+
+#if( $dataSet.alternativeName )
+	#set( $dataSetName = $dataSet.alternativeName )
+#else
+	#set( $dataSetName = $dataSet.name )
+#end
+
+<h2>$encoder.htmlEncode( $dataSetName )</h2>
+
+#set( $validationRuleViolationsSize = $validationRuleViolations.size() )
+#set( $validationViolationsSize = $validationViolations.size() )
+#set( $typeViolationsSize = $typeViolations.size() )
+
+#if( $validationRuleViolationsSize > 0 || $validationViolationsSize > 0 || $typeViolationsSize > 0 )
+<div class="header-box" align="center">
+	<h3 style="text-align: left; background-color: #990000; color: white;">$i18n.getString("warnings_and_errors")</h3>
+	<p style="text-align: left;">
+		#if( $validationRuleViolationsSize > 0 )
+			$validationRuleViolationsSize $i18n.getString("validation_rule_violation_warnings"). <br />
+		#end
+		#if( $validationViolationsSize > 0 )
+			$validationViolationsSize $i18n.getString("minmax_violation_warnings"). <br />
+		#end
+		#if( $typeViolationsSize > 0 )
+			$typeViolationsSize $i18n.getString("type_violation_errors"). <br />
+		#end
+	</p>
+</div>
+#end
+
+#if( $validationRuleViolationsSize > 0 )
+<div class="header-box" align="center">
+	<h3 style="text-align: left; background-color: #990000; color: white;">$i18n.getString("validation_rule_violations")</h3>
+	<p style="text-align: left;">
+	#foreach( $validationRuleViolation in $validationRuleViolations )
+		$validationRuleViolation <br />
+	#end
+	</p>
+</div>
+#end
+
+<form action="saveSectionForm.action" method="POST">
+
+<input type="hidden" id="organisationUnitId" name="organisationUnitId" value="$organisationUnitId" />
+<input type="hidden" id="dataSetId" name="dataSetId" value="$dataSetId" />
+<input type="hidden" id="periodId" name="periodId" value="$periodId" />
+<input type="hidden" id="validated" name="validated" value="#if($validated)true#{else}false#end" />
+
+#macro( createSection $sectionName $dataElements )
+<div class="header-box" align="center">
+	<h3 style="text-align: left;">$sectionName</h3>
+	<p style="text-align: left;">
+		#foreach( $dataElement in $dataElements)
+			#if( $dataElement.shortName )
+				#set( $dataElementName = $dataElement.shortName )
+			#else
+				#set( $dataElementName = $dataElement.name )
+			#end
+
+			#foreach( $optionCombo in $dataElement.categoryCombo.optionCombos )
+                
+                #if( !$greyedFields.get( "$dataElement.id:$optionCombo.id" ) ) 
+				#set( $key = "DE${dataElement.id}OC${optionCombo.id}" )
+
+				<label>$encoder.htmlEncode( $dataElementName ) #if( $optionCombo.name!="(default)")$encoder.htmlEncode( $optionCombo.name )#end</label>
+
+				#if( $validationViolations.get( $key ) )
+					#set( $validationViolation = $validationViolations.get( $key ) )
+
+	                #if( $formUtils.valueHigher( $validationViolation.value, $validationViolation.max ) )
+	                    <br /><span style="color: #990000;">Too high (max $validationViolation.max)</span>
+	                #elseif( $formUtils.valueLower( $validationViolation.value, $validationViolation.min ) )
+	                    <br /><span style="color: red;">Too low (min $validationViolation.min)</span>
+	                #else
+	                    <br /><span style="color: red;">Not a number</span>
+	                #end
+                #end
+
+				#if( $typeViolations.get( $key ) )
+					#set( $typeViolation = $typeViolations.get( $key ) )
+                    <br /><span style="color: #990000;">$typeViolation</span>
+                #end
+
+				#if( $dataElement.type == "string" )
+					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "bool" )
+					<select name="$key" style="width: 100%;">
+						<option value="">[ No Value ]</option>
+						<option value="true" #if($!dataValues.get($key) == "true")selected="selected"#end>Yes</option>
+						<option value="false" #if($!dataValues.get($key) == "false")selected="selected"#end>No</option>
+					</select>
+				#elseif( $dataElement.type == "date" )
+					<input type="date" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "number" )
+					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "int" )
+					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "positiveNumber" )
+					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "negativeNumber" )
+					<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+				#end
+				#end
+			#end
+		#end
+	</p>
+</div>
+#end
+
+#if( $dataSet.sections.size() > 0 )
+    #foreach( $section in $dataSet.sections )
+        #createSection( $section.name $section.dataElements )
+    #end
+#else
+    #createSection( "Default" $dataSet.dataElements )
+#end
+
+<div class="header-box" align="center">
+	<p style="text-align: left;">
+		<input type="checkbox" id="complete" name="complete" value="true" #if($complete)checked="true"#end style="width: 15px; height: 15px; vertical-align: middle;" />
+        <label for="complete" style="vertical-align: middle; width: auto;">$i18n.getString("dataset_is_complete")</label>
+	</p>
+</div>
+
+<div class="header-box" align="center">
+	<p>
+		<input type="submit" style="width: 100%;" value="$i18n.getString("save")" />
+	</p>
+</div>
+
+</form>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="selectPeriod.action?organisationUnitId=$organisationUnitId&dataSetId=$dataSetId&periodId=$periodId">$i18n.getString("available_periods")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>