← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11394: Add program-indicator-values in data entry form.

 

------------------------------------------------------------
revno: 11394
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-07-15 15:04:11 +0700
message:
  Add program-indicator-values in data entry form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2013-06-07 02:07:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2013-07-15 08:04:11 +0000
@@ -44,6 +44,7 @@
 import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramDataEntryService;
+import org.hisp.dhis.program.ProgramIndicatorService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageInstance;
@@ -147,9 +148,16 @@
 
     private Map<String, Double> calAttributeValueMap = new HashMap<String, Double>();
 
+    private ProgramIndicatorService programIndicatorService;
+
     // -------------------------------------------------------------------------
     // Getters && Setters
     // -------------------------------------------------------------------------
+    
+    public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+    {
+        this.programIndicatorService = programIndicatorService;
+    }
 
     public void setOrganisationUnitId( Integer organisationUnitId )
     {
@@ -244,6 +252,13 @@
         return latitude;
     }
 
+    private Map<String, String> programIndicatorsMap = new HashMap<String, String>();
+
+    public Map<String, String> getProgramIndicatorsMap()
+    {
+        return programIndicatorsMap;
+    }
+
     // -------------------------------------------------------------------------
     // Implementation Action
     // -------------------------------------------------------------------------
@@ -281,26 +296,37 @@
         Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() );
 
         DataEntryForm dataEntryForm = programStage.getDataEntryForm();
-        Boolean displayProvidedOtherFacility = program.getDisplayProvidedOtherFacility() == null || !program.getDisplayProvidedOtherFacility();
+        Boolean displayProvidedOtherFacility = program.getDisplayProvidedOtherFacility() == null
+            || !program.getDisplayProvidedOtherFacility();
 
         if ( programStage.getDataEntryType().equals( ProgramStage.TYPE_SECTION ) )
         {
-            sections = new ArrayList<ProgramStageSection>(
-                programStageSectionService.getProgramStages( programStage ) );
+            sections = new ArrayList<ProgramStageSection>( programStageSectionService.getProgramStages( programStage ) );
 
             Collections.sort( sections, new ProgramStageSectionSortOrderComparator() );
         }
         else if ( programStage.getDataEntryType().equals( ProgramStage.TYPE_CUSTOM ) )
         {
             customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry(
-                dataEntryForm.getHtmlCode(), null, displayProvidedOtherFacility.toString(), i18n,
-                programStage, null, organisationUnit );
+                dataEntryForm.getHtmlCode(), null, displayProvidedOtherFacility.toString(), i18n, programStage, null,
+                organisationUnit );
         }
 
         if ( programStageInstance != null )
         {
-            organisationUnit = organisationUnitId == null ? selectedStateManager.getSelectedOrganisationUnit() :
-                organisationUnitService.getOrganisationUnit( organisationUnitId );
+            // ---------------------------------------------------------------------
+            // Get program indicators
+            // ---------------------------------------------------------------------
+
+            programIndicatorsMap.putAll( programIndicatorService.getProgramIndicatorValues( programStageInstance
+                .getProgramInstance() ) );
+
+            // ---------------------------------------------------------------------
+            // Get registration orgunit
+            // ---------------------------------------------------------------------
+
+            organisationUnit = organisationUnitId == null ? selectedStateManager.getSelectedOrganisationUnit()
+                : organisationUnitService.getOrganisationUnit( organisationUnitId );
 
             if ( program.isRegistration() )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-07-02 15:18:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-07-15 08:04:11 +0000
@@ -108,6 +108,8 @@
 			ref="org.hisp.dhis.program.ProgramStageSectionService" />
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="programIndicatorService"
+			ref="org.hisp.dhis.program.ProgramIndicatorService" />
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-05-29 10:19:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-07-15 08:04:11 +0000
@@ -65,6 +65,11 @@
 				</table>
 			</td>
 		</tr>
+		#foreach($key in $programIndicatorsMap.keySet())
+		<tr>
+			<td colspan='3' class='bold'>$key: $programIndicatorsMap.get($key)</td>
+		</tr>
+		#end
 	</table>
 	</table>
 	
@@ -102,7 +107,8 @@
 	var i18n_enter_a_value_greater_than_or_equal_to_nagetive_90 = '$encoder.jsEscape( $i18n.getString( "enter_a_value_greater_than_or_equal_to_nagetive_90" ) , "'" )';
 	var i18n_enter_values_for_longitude_and_latitude_fields = '$encoder.jsEscape( $i18n.getString( "enter_values_for_longitude_and_latitude_fields" ) , "'" )';
 	var i18n_enter_a_valid_number = '$encoder.jsEscape( $i18n.getString( "enter_a_valid_number" ) , "'" )';
-
+	var i18n_incomplete_confirm_message = '$encoder.jsEscape( $i18n.getString( "incomplete_confirm_message" ) , "'" )';
+	
 	if(getFieldValue('completed')=='true' && getFieldValue('blockEntryForm')=='true'){
 		blockEntryForm();
 	}