dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15117
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5333: Fixed bug https://bugs.launchpad.net/dhis2/+bug/901740
------------------------------------------------------------
revno: 5333
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-08 17:03:30 +0100
message:
Fixed bug https://bugs.launchpad.net/dhis2/+bug/901740
Greyed fields are now removed from mobile browser data entry
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/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/GetSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetSectionFormAction.java 2011-11-01 18:28:36 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetSectionFormAction.java 2011-12-08 16:03:30 +0000
@@ -32,10 +32,13 @@
import java.util.List;
import java.util.Map;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+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.datavalue.DeflatedDataValue;
import org.hisp.dhis.light.dataentry.utils.FormUtils;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -182,6 +185,13 @@
return page;
}
+ private Map<String, Boolean> greyedFields = new HashMap<String, Boolean>();
+
+ public Map<String, Boolean> getGreyedFields()
+ {
+ return greyedFields;
+ }
+
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@@ -206,6 +216,24 @@
complete = registration != null ? true : false;
+ if ( dataSet.getDataSetType() == DataSet.TYPE_SECTION )
+ {
+ setGreyedFields();
+ }
+
return SUCCESS;
}
+
+ private void setGreyedFields()
+ {
+ for ( Section section : dataSet.getSections() )
+ {
+ for ( DataElementOperand operand : section.getGreyedFields() )
+ {
+ greyedFields.put( operand.getDataElement().getId() + ":" + operand.getCategoryOptionCombo().getId(),
+ true );
+ }
+ }
+
+ }
}
=== 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-11-01 18:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm 2011-12-08 16:03:30 +0000
@@ -60,6 +60,8 @@
#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>
@@ -100,6 +102,7 @@
#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>