← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9738: Data entry, hiding min max values for bool and string data element types

 

------------------------------------------------------------
revno: 9738
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-05 17:43:30 +0200
message:
  Data entry, hiding min max values for bool and string data element types
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.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-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2013-02-05 13:30:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2013-02-05 15:43:30 +0000
@@ -173,6 +173,13 @@
     {
         return historyInvalid;
     }
+    
+    private boolean minMaxInvalid;
+
+    public boolean isMinMaxInvalid()
+    {
+        return minMaxInvalid;
+    }
 
     private DataValue dataValue;
 
@@ -220,7 +227,7 @@
 
         if ( dataElement == null )
         {
-            throw new Exception( "DataElement doesn't exist: " + dataElementId );
+            throw new IllegalArgumentException( "DataElement doesn't exist: " + dataElementId );
         }
 
         Period period = PeriodType.createPeriodExternalId( periodId );
@@ -239,6 +246,8 @@
 
         historyInvalid = dataElementHistory == null;
 
+        minMaxInvalid = !DataElement.VALUE_TYPE_INT.equals( dataElement.getType() );
+
         // ---------------------------------------------------------------------
         // Data Value Audit
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2013-02-05 15:17:57 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2013-02-05 15:43:30 +0000
@@ -36,7 +36,7 @@
                     <td style="background-color:#88be3b; height:26px;">&nbsp;</td>
                     <td>$encoder.htmlEncode( $i18n.getString( "min_limit" ) ) </td>
                     <td><input type="text" id="minLimit" style="width:10em" value="$!{dataElementHistory.minLimit}" class="{validate:{digits:true}}" 
-                        #if( !$auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) ) disabled="disabled"#end />
+                        #if( !$auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) || ${minMaxInvalid} ) disabled="disabled"#end />
 						<i><span id="minSpan" style="color:red"></span></i>
 					</td>
                 </tr>
@@ -44,7 +44,7 @@
                     <td style="background-color:#2e4e83; height:26px;">&nbsp;</td>
                     <td>$encoder.htmlEncode( $i18n.getString( "max_limit" ) ) </td>
                     <td><input type="text" id="maxLimit" style="width:10em" value="$!{dataElementHistory.maxLimit}" class="{validate:{digits:true}}" 
-                    	#if( !$auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) ) disabled="disabled"#end />
+                    	#if( !$auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) || ${minMaxInvalid} ) disabled="disabled"#end />
 						<i><span id="maxSpan" style="color:red"></span></i>
 					</td>
                 </tr>