← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5039: (mobile) proper rendering of types in dataentry (no server side support yet)

 

------------------------------------------------------------
revno: 5039
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-10-26 10:43:56 +0200
message:
  (mobile) proper rendering of types in dataentry (no server side support yet)
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java
  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/style/light.css


--
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/SaveSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java	2011-10-14 07:58:27 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java	2011-10-26 08:43:56 +0000
@@ -204,6 +204,13 @@
         return validationRuleViolations;
     }
 
+    private Map<String, String> typeViolations = new HashMap<String, String>();
+
+    public Map<String, String> getTypeViolations()
+    {
+        return typeViolations;
+    }
+
     private Boolean complete = false;
 
     public void setComplete( Boolean complete )

=== 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-10-13 11:05:24 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm	2011-10-26 08:43:56 +0000
@@ -31,19 +31,35 @@
 				<label>$dataElement.name #if($optionCombo.name!="(default)")$optionCombo.name#end</label>
 
 				#if( $validationViolations.get( $key ) )
-				#set( $validationViolation = $validationViolations.get( $key ) )
-
-                #if( $sectionFormUtils.valueHigher( $validationViolation.value, $validationViolation.max ) )
-                    <br /><span style="color: #990000;">Too high (max $validationViolation.max)</span>
-                #elseif( $sectionFormUtils.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
-
-				<input type="number" size="24" name="$key" value="$!dataValues.get($key)" /> <br />
+					#set( $validationViolation = $validationViolations.get( $key ) )
+
+	                #if( $sectionFormUtils.valueHigher( $validationViolation.value, $validationViolation.max ) )
+	                    <br /><span style="color: #990000;">Too high (max $validationViolation.max)</span>
+	                #elseif( $sectionFormUtils.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( $dataElement.type == "string" )
+					<input type="text" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "bool" )
+					<select name="$key" style="width: 100%;">
+						<option value="true">Yes</option>
+						<option value="false">No</option>
+					</select>
+				#elseif( $dataElement.type == "date" )
+					<input type="date" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "number" )
+					<input type="text" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "int" )
+					<input type="number" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "positiveNumber" )
+					<input type="number" size="24" name="$key" value="$!dataValues.get($key)" />
+				#elseif( $dataElement.type == "int" && $dataElement.numberType == "negativeNumber" )
+					<input type="number" size="24" name="$key" value="$!dataValues.get($key)" />
+				#end
 			#end
 		#end
 	</p>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/style/light.css'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/style/light.css	2011-10-26 07:26:14 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/style/light.css	2011-10-26 08:43:56 +0000
@@ -366,7 +366,14 @@
 	font-size: 1.15em;
 }
 
-body input[type='text'] { 
+body input { 
+	font-size: 1.15em;
+	padding: 0.2em;
+	margin-bottom: .5em;
+	display: block;
+}
+
+body select {
 	font-size: 1.15em;
 	padding: 0.2em;
 	margin-bottom: .5em;
@@ -384,11 +391,7 @@
 	font-size: 1.15em;
 	margin:0.1em 0em;
 	padding: 0;
-}
-
-body select {
-	font-size: 1.15em;
-	margin-bottom: 0;
+	display: inline;
 }
 
 body input[type='button'] {