← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8934: [mobile] Provided elsewhere check option for program stage form

 

------------------------------------------------------------
revno: 8934
committer: Homg Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-07 19:55:09 +0700
message:
  [mobile] Provided elsewhere check option for program stage form
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.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/namebaseddataentry/action/GetProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java	2012-10-23 07:56:15 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java	2012-11-07 12:55:09 +0000
@@ -27,6 +27,7 @@
 
 package org.hisp.dhis.light.namebaseddataentry.action;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -55,7 +56,7 @@
     implements Action
 {
     private static final String REDIRECT = "redirect";
-    
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -95,9 +96,9 @@
     {
         this.patientDataValueService = patientDataValueService;
     }
-    
+
     private PatientService patientService;
-    
+
     public PatientService getPatientService()
     {
         return patientService;
@@ -107,9 +108,9 @@
     {
         this.patientService = patientService;
     }
-    
+
     private ProgramStageSectionService programStageSectionService;
-    
+
     public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
     {
         this.programStageSectionService = programStageSectionService;
@@ -246,9 +247,9 @@
     {
         return prevDataValues;
     }
-    
+
     private Patient patient;
-    
+
     public Patient getPatient()
     {
         return patient;
@@ -258,7 +259,7 @@
     {
         this.patient = patient;
     }
-    
+
     private Integer programStageSectionId;
 
     public void setProgramStageSectionId( Integer programStageSectionId )
@@ -272,19 +273,19 @@
     }
 
     private List<ProgramStageSection> listOfProgramStageSections;
-    
+
     public List<ProgramStageSection> getListOfProgramStageSections()
     {
         return listOfProgramStageSections;
     }
-    
+
     public ProgramStageSection programStageSection;
 
     public ProgramStageSection getProgramStageSection()
     {
         return programStageSection;
     }
-    
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -299,6 +300,13 @@
         this.current = current;
     }
 
+    private List<ProgramStageDataElement> listOfProgramStageDataElement;
+
+    public List<ProgramStageDataElement> getListOfProgramStageDataElement()
+    {
+        return listOfProgramStageDataElement;
+    }
+
     @Override
     public String execute()
         throws Exception
@@ -306,20 +314,26 @@
         prevDataValues.clear();
         programStage = util.getProgramStage( programId, programStageId );
         patient = patientService.getPatient( patientId );
-        
-        if( programStageSectionId != null && programStageSectionId != 0 )
+
+        if ( programStageSectionId != null && programStageSectionId != 0 )
         {
             this.programStageSection = programStageSectionService.getProgramStageSection( this.programStageSectionId );
-            
-            List<ProgramStageDataElement> listOfProgramStageDataElement = programStageSection.getProgramStageDataElements();
-            
+
+            listOfProgramStageDataElement = programStageSection.getProgramStageDataElements();
+
             dataElements = util.transformDataElementsToMobileModel( listOfProgramStageDataElement );
+
         }
         else
         {
+            listOfProgramStageDataElement = new ArrayList<ProgramStageDataElement>(
+                programStage.getProgramStageDataElements() );
+
             dataElements = util.transformDataElementsToMobileModel( programStageId );
         }
-        program = programStageInstanceService.getProgramStageInstance( programStageInstanceId ).getProgramInstance().getProgram();
+
+        program = programStageInstanceService.getProgramStageInstance( programStageInstanceId ).getProgramInstance()
+            .getProgram();
         Collection<PatientDataValue> patientDataValues = patientDataValueService
             .getPatientDataValues( programStageInstanceService.getProgramStageInstance( programStageInstanceId ) );
         for ( PatientDataValue patientDataValue : patientDataValues )

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2012-11-06 07:45:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2012-11-07 12:55:09 +0000
@@ -301,6 +301,15 @@
     {
         return programStage;
     }
+    
+    private ProgramStageDataElement programStageDataElement;
+    
+    
+
+    public ProgramStageDataElement getProgramStageDataElement()
+    {
+        return programStageDataElement;
+    }
 
     private boolean current;
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java	2012-10-12 09:22:44 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java	2012-11-07 12:55:09 +0000
@@ -86,7 +86,7 @@
         }
         return null;
     }
-
+  
     public String getTypeViolation( DataElement dataElement, String value )
     {
         String type = dataElement.getType();

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2012-11-06 07:09:13 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2012-11-07 12:55:09 +0000
@@ -35,6 +35,7 @@
 
 <div class="header-box" align="center">
 	<p style="text-align: left;">
+
 		#foreach( $dataElement in $dataElements)
 			#set( $key = "DE${dataElement.id}" )
 			#if( $dataElement.shortName )
@@ -42,50 +43,68 @@
 			#else
 				#set( $dataElementName = $dataElement.name )
 			#end
-			
+
 			<label>$encoder.htmlEncode( $dataElementName )
 					#if($dataElement.isCompulsory())*#end
 					#if($dataElement.type=="date") [yyyy-MM-dd] #end
 			</label>
 			
+			
 			#if( $typeViolations.get( $key ) )
-                		#set( $typeViolation = $typeViolations.get( $key ) )
-            			<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
+				#set( $typeViolation = $typeViolations.get( $key ) )
+				<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
             #end
-			
-				#if (! $dataElement.getOptionSet())			
-					
-					#if($dataElement.type=="bool")
-						<select name="$key">
-							<option value="">$i18n.getString("please_select")</option>
-							<option #if( $prevDataValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
-							<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
-						</select>
-					#else
-						<input type="text" name="$key" value="$!prevDataValues.get($key)" />
-					#end
-
-				#elseif ($dataElement.getOptionSet())
-					#set( $options = $dataElement.getOptionSet().getOptions() )
-					<select type="text" name="$key" />
-					#set( $selected=false )
-					#foreach ($option in $options)
-						<option value="$option"
-						#if( $prevDataValues.get( $key ) == $option ) 
-							selected
-							#set( $selected=true )
-						#end
-						> $option </option>
-					#end
-
-					#if( !$selected ) 
-						<option selected > $i18n.getString("select_option") </option>
-					#end
-					
+
+			#if ( !$dataElement.getOptionSet() )			
+				
+				#if($dataElement.type=="bool")
+					<select name="$key">
+						<option value="">$i18n.getString("please_select")</option>
+						<option #if( $prevDataValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
+						<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
 					</select>
-				#end
+				#else
+					<input type="text" name="$key" value="$!prevDataValues.get($key)" />
+				#end
+	
+
+
+			#elseif ($dataElement.getOptionSet())
+				#set( $options = $dataElement.getOptionSet().getOptions() )
+				<select type="text" name="$key" />
+				#set( $selected=false )
+				#foreach ($option in $options)
+					<option value="$option"
+					#if( $prevDataValues.get( $key ) == $option ) 
+						selected
+						#set( $selected=true )
+					#end
+					> $option </option>
+				#end
+
+				#if( !$selected ) 
+					<option selected > $i18n.getString("select_option") </option>
+				#end
+				
+				</select>		
+				
+			#end
+			
+			#if( $programStage.program.displayProvidedOtherFacility=='true' )
+				#foreach( $programStageDataElement in $listOfProgramStageDataElement )
+				#if( $programStageDataElement.allowProvidedElsewhere == 'true' && $programStageDataElement.dataElement.id == $dataElement.id )
+					<input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
+				#end
+				#end
+			#end
+			
 		#end
+
 	</p>
+	
+	
+	
+		
 </div>
 
 <div class="header-box" align="center">