← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4740: (mobile) added support for default forms

 

------------------------------------------------------------
revno: 4740
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-28 13:01:51 +0200
message:
  (mobile) added support for default forms
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetsAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetsAction.java	2011-09-28 10:34:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetsAction.java	2011-09-28 11:01:51 +0000
@@ -89,7 +89,7 @@
         {
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
             dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
-            FilterUtils.filter( dataSets, new DataSetTypeFilter( DataSet.TYPE_SECTION ) );
+            FilterUtils.filter( dataSets, new DataSetTypeFilter( DataSet.TYPE_DEFAULT, DataSet.TYPE_SECTION ) );
         }
 
         return SUCCESS;

=== modified 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-09-28 09:35:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm	2011-09-28 11:01:51 +0000
@@ -8,12 +8,12 @@
 <input type="hidden" id="periodId" name="periodId" value="$periodId" />
 <input type="hidden" id="validated" name="validated" value="#if($validated)true#{else}false#end" />
 
-#foreach( $section in $dataSet.sections )
+#macro( createSection $sectionName $dataElements )
 <div class="header-box">
-	<h3>$section.name</h3>
+	<h3>$sectionName</h3>
 	<p>
-		#foreach( $dataElement in $section.dataElements)
-			#foreach( $optionCombo in $section.categoryCombo.optionCombos )
+		#foreach( $dataElement in $dataElements)
+			#foreach( $optionCombo in $dataElement.categoryCombo.optionCombos )
 				#set( $key = "DE${dataElement.id}OC${optionCombo.id}" )
 				<label>$dataElement.name $optionCombo.name</label>
 	
@@ -21,7 +21,7 @@
 				#set( $validationError = $validationErrors.get( $key ) ) 
 				<br /><span style="color: red;">Value is out of bounds [ $validationError.min, $validationError.max ]</span>
 				#end
-				
+
 				<input type="number" size="24" name="$key" value="$dataValues.get($key)" /> <br />
 			#end
 		#end
@@ -29,6 +29,14 @@
 </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">
 	<p>
 		<input type="checkbox" id="complete" name="complete" value="true" #if($complete)checked="true"#end style="width: 15px;" />