← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8355: Link to completed single event program on dashboard - web light

 

------------------------------------------------------------
revno: 8355
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-10-03 14:43:08 +0700
message:
  Link to completed single event program on dashboard - web light
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/FindSingleEventOptionSetAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties
  dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.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/singleevent/action/FindSingleEventOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/FindSingleEventOptionSetAction.java	2012-09-28 09:17:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/FindSingleEventOptionSetAction.java	2012-10-03 07:43:08 +0000
@@ -123,6 +123,30 @@
     {
         return this.organisationUnitId;
     }
+    
+    private String isEditing;
+
+    public String getIsEditing()
+    {
+        return isEditing;
+    }
+
+    public void setIsEditing( String isEditing )
+    {
+        this.isEditing = isEditing;
+    }
+    
+    private int programStageInstanceId;
+
+    public int getProgramStageInstanceId()
+    {
+        return programStageInstanceId;
+    }
+
+    public void setProgramStageInstanceId( int programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
 
     @Override
     public String execute()

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2012-09-28 09:17:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2012-10-03 07:43:08 +0000
@@ -32,12 +32,23 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.util.SessionUtils;
 
 public class GetSingleEventFormAction
@@ -54,6 +65,34 @@
         this.programService = programService;
     }
 
+    private PatientDataValueService patientDataValueService;
+
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+
+    private ProgramStageInstanceService programStageInstanceService;
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    private ProgramInstanceService programInstanceService;
+
+    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+    {
+        this.programInstanceService = programInstanceService;
+    }
+
+    private PatientService patientService;
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+
     // -------------------------------------------------------------------------
     // Input Output
     // -------------------------------------------------------------------------
@@ -146,39 +185,102 @@
     {
         return prevDataValues;
     }
-    
+
     private String searchResult;
-    
+
     public void setSearchResult( String searchResult )
     {
         this.searchResult = searchResult;
     }
-    
+
     private int dataElementIdForSearching;
-    
+
     public void setDataElementIdForSearching( int dataElementIdForSearching )
     {
         this.dataElementIdForSearching = dataElementIdForSearching;
     }
-    
+
+    private String isEditing;
+
+    public String getIsEditing()
+    {
+        return isEditing;
+    }
+
+    public void setIsEditing( String isEditing )
+    {
+        this.isEditing = isEditing;
+    }
+
+    private int programStageInstanceId;
+
+    public int getProgramStageInstanceId()
+    {
+        return programStageInstanceId;
+    }
+
+    public void setProgramStageInstanceId( int programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
+
     @Override
     public String execute()
         throws Exception
     {
-        if( SessionUtils.getSessionVar( "prevDataValues" ) != null )
-        {
-            this.prevDataValues = (Map<String, String>) SessionUtils.getSessionVar( "prevDataValues" );
-        }
-        if( searchResult != null)
-        {
-            this.prevDataValues.put( "DE"+this.dataElementIdForSearching, searchResult );
-        }
-        
+
         Program program = programService.getProgram( programId );
         eventName = program.getName();
         ProgramStage programStage = program.getProgramStages().iterator().next();
         programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
         Collections.sort( programStageDataElements, OrderBySortOrder );
+
+        if ( SessionUtils.getSessionVar( "prevDataValues" ) != null )
+        {
+            this.prevDataValues = (Map<String, String>) SessionUtils.getSessionVar( "prevDataValues" );
+        }
+        if ( searchResult != null )
+        {
+            this.prevDataValues.put( "DE" + this.dataElementIdForSearching, searchResult );
+            System.out.println("ko co null");
+        }
+        else
+        {
+            // For editing if user finished the form
+            Patient patient = patientService.getPatient( this.patientId );
+
+            if ( programInstanceService.getProgramInstances( patient, program ) != null )
+            {
+                List<ProgramInstance> proInstanceList = (List<ProgramInstance>) programInstanceService
+                    .getProgramInstances( patient, program );
+
+                ProgramInstance proInstance = null;
+
+                if ( proInstanceList.size() != 0 )
+                {
+                    proInstance = proInstanceList.iterator().next();
+                }
+
+                ProgramStageInstance proStageInstance = programStageInstanceService.getProgramStageInstance(
+                    proInstance, programStage );
+                
+                this.programStageInstanceId = proStageInstance.getId();
+
+                for ( ProgramStageDataElement each : programStageDataElements )
+                {
+                    DataElement dataElement = each.getDataElement();
+
+                    PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( proStageInstance,
+                        dataElement );
+
+                    if ( patientDataValue != null )
+                    {
+                        this.prevDataValues.put( "DE" + dataElement.getId(), patientDataValue.getValue() );
+                    }
+                }
+            }
+        }
+
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java	2012-09-28 09:17:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java	2012-10-03 07:43:08 +0000
@@ -70,7 +70,7 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-
+    
     private ProgramInstanceService programInstanceService;
 
     public void setProgramInstanceService( ProgramInstanceService programInstanceService )
@@ -289,12 +289,35 @@
         return dataElementIdForSearching;
     }
     
-
+    private String isEditing;
+
+    public String getIsEditing()
+    {
+        return isEditing;
+    }
+
+    public void setIsEditing( String isEditing )
+    {
+        this.isEditing = isEditing;
+    }
+    
+    private int programStageInstanceId;
+
+    public int getProgramStageInstanceId()
+    {
+        return programStageInstanceId;
+    }
+
+    public void setProgramStageInstanceId( int programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
 
     @Override
     public String execute()
         throws Exception
     {
+
         Program program = programService.getProgram( programId );
         eventName = program.getName();
 
@@ -308,7 +331,7 @@
         HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
             ServletActionContext.HTTP_REQUEST );
         Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
-        
+
         typeViolations.clear();
 
         prevDataValues.clear();
@@ -371,42 +394,84 @@
             return REDIRECT;
         }
         
-        ProgramInstance programInstance = new ProgramInstance();
-        programInstance.setEnrollmentDate( new Date() );
-        programInstance.setDateOfIncident( new Date() );
-        programInstance.setProgram( program );
-        programInstance.setPatient( patient );
-        programInstance.setCompleted( false );
-        programInstanceService.addProgramInstance( programInstance );
-
-        ProgramStageInstance programStageInstance = new ProgramStageInstance();
-        programStageInstance.setOrganisationUnit( organisationUnit );
-        programStageInstance.setProgramInstance( programInstance );
-        programStageInstance.setProgramStage( programStage );
-        programStageInstance.setDueDate( new Date() );
-        programStageInstance.setExecutionDate( new Date() );
-        programStageInstance.setCompleted( false );
-        programStageInstanceService.addProgramStageInstance( programStageInstance );
-
-        for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
-        {
-            DataElement dataElement = programStageDataElement.getDataElement();
-
-            PatientDataValue patientDataValue = new PatientDataValue();
-
-            patientDataValue.setDataElement( dataElement );
-
-            String id = "DE" + dataElement.getId();
-
-            patientDataValue.setValue( parameterMap.get( id ) );
-
-            patientDataValue.setProgramStageInstance( programStageInstance );
-
-            patientDataValue.setProvidedElsewhere( false );
-
-            patientDataValue.setTimestamp( new Date() );
-
-            patientDataValueService.savePatientDataValue( patientDataValue );
+        if( this.isEditing.equals( "true" ) )
+        {
+            ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( this.programStageInstanceId );
+            
+            for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
+            {
+                DataElement dataElement = programStageDataElement.getDataElement();
+                
+                PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, dataElement );
+                
+                String id = "DE" + dataElement.getId();
+                
+                String value = parameterMap.get( id );
+                
+                if ( patientDataValue == null && value != null )
+                {
+
+                    patientDataValue = new PatientDataValue( programStageInstance, dataElement, new Date(), value );
+                    
+                    patientDataValue.setProvidedElsewhere( false );
+
+                    patientDataValueService.savePatientDataValue( patientDataValue );
+                }
+                if( patientDataValue != null && value == null )
+                {
+                    patientDataValueService.deletePatientDataValue( patientDataValue );
+                }
+                else if( patientDataValue != null && value != null )
+                {
+                    patientDataValue.setValue( value );
+                    
+                    patientDataValue.setTimestamp( new Date() );
+                    
+                    patientDataValue.setProvidedElsewhere( false );
+                    
+                    patientDataValueService.updatePatientDataValue( patientDataValue );
+                }
+            }
+        }
+        else
+        {
+            ProgramInstance programInstance = new ProgramInstance();
+            programInstance.setEnrollmentDate( new Date() );
+            programInstance.setDateOfIncident( new Date() );
+            programInstance.setProgram( program );
+            programInstance.setPatient( patient );
+            programInstance.setCompleted( true );
+            programInstanceService.addProgramInstance( programInstance );
+    
+            ProgramStageInstance programStageInstance = new ProgramStageInstance();
+            programStageInstance.setOrganisationUnit( organisationUnit );
+            programStageInstance.setProgramInstance( programInstance );
+            programStageInstance.setProgramStage( programStage );
+            programStageInstance.setDueDate( new Date() );
+            programStageInstance.setExecutionDate( new Date() );
+            programStageInstance.setCompleted( true );
+            programStageInstanceService.addProgramStageInstance( programStageInstance );
+    
+            for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
+            {
+                DataElement dataElement = programStageDataElement.getDataElement();
+    
+                PatientDataValue patientDataValue = new PatientDataValue();
+    
+                patientDataValue.setDataElement( dataElement );
+    
+                String id = "DE" + dataElement.getId();
+    
+                patientDataValue.setValue( parameterMap.get( id ) );
+    
+                patientDataValue.setProgramStageInstance( programStageInstance );
+    
+                patientDataValue.setProvidedElsewhere( false );
+    
+                patientDataValue.setTimestamp( new Date() );
+    
+                patientDataValueService.savePatientDataValue( patientDataValue );
+            }
         }
         SessionUtils.removeSessionVar( "prevDataValues" );
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2012-10-03 07:23:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2012-10-03 07:43:08 +0000
@@ -176,6 +176,7 @@
 		<property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 		<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="programValidationService" ref="org.hisp.dhis.program.ProgramValidationService" />
+
 	</bean>
 
 	<bean
@@ -198,7 +199,8 @@
 
 	<bean
 		id="org.hisp.dhis.light.namebaseddataentry.action.GetPatientProgramListAction"
-		class="org.hisp.dhis.light.namebaseddataentry.action.GetPatientProgramListAction" scope="prototype">
+		class="org.hisp.dhis.light.namebaseddataentry.action.GetPatientProgramListAction"
+		scope="prototype">
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
@@ -208,7 +210,6 @@
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
 		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
-		
 	</bean>
 
 	<bean
@@ -244,14 +245,15 @@
 
 	<bean
 		id="org.hisp.dhis.light.namebaseddataentry.action.AddNewRalationshipAction"
-		class="org.hisp.dhis.light.namebaseddataentry.action.AddNewRalationshipAction" scope="prototype">
+		class="org.hisp.dhis.light.namebaseddataentry.action.AddNewRalationshipAction"
+		scope="prototype">
 		<property name="relationshipTypeService"
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="relationshipService"
 			ref="org.hisp.dhis.relationship.RelationshipService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.light.namebaseddataentry.action.RegisterPatientLocationAction"
 		class="org.hisp.dhis.light.namebaseddataentry.action.RegisterPatientLocationAction">
@@ -259,15 +261,14 @@
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.light.namebaseddataentry.action.GetPatientLocationFormAction"
 		class="org.hisp.dhis.light.namebaseddataentry.action.GetPatientLocationFormAction">
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
-		<property name="currentUserService"
-			ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 	</bean>
-	
+
 	<!-- Beneficiary Registration -->
 
 	<bean
@@ -281,8 +282,10 @@
 		id="org.hisp.dhis.light.beneficiaryregistration.action.RegisterBeneficiaryAction"
 		class="org.hisp.dhis.light.beneficiaryregistration.action.RegisterBeneficiaryAction"
 		scope="prototype">
-		<property name="patientIdentifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
-		<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="patientIdentifierTypeService"
+			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
@@ -293,10 +296,14 @@
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
-		<property name="patientIdentifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
-		<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
-		<property name="patientAttributeOptionService" ref="org.hisp.dhis.patient.PatientAttributeOptionService" />
-		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
+		<property name="patientIdentifierTypeService"
+			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="patientAttributeOptionService"
+			ref="org.hisp.dhis.patient.PatientAttributeOptionService" />
+		<property name="patientIdentifierService"
+			ref="org.hisp.dhis.patient.PatientIdentifierService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
@@ -385,6 +392,12 @@
 		class="org.hisp.dhis.light.singleevent.action.GetSingleEventFormAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="patientDataValueService"
+			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.light.singleevent.action.SaveSingleEventAction"
@@ -401,11 +414,14 @@
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+		<property name="programStageDataElementService"
+			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
 
-	
-	<bean id="org.hisp.dhis.light.singleevent.action.FindSingleEventOptionSetAction" class="org.hisp.dhis.light.singleevent.action.FindSingleEventOptionSetAction">
+
+	<bean
+		id="org.hisp.dhis.light.singleevent.action.FindSingleEventOptionSetAction"
+		class="org.hisp.dhis.light.singleevent.action.FindSingleEventOptionSetAction">
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 	</bean>
 	<!-- Dashboard -->
@@ -495,13 +511,17 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-		<property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+		<property name="patientDataValueService"
+			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+		<property name="programStageDataElementService"
+			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
-	
-	<bean id="org.hisp.dhis.light.namebaseddataentry.action.DeleteRelationshipAction"
+
+	<bean
+		id="org.hisp.dhis.light.namebaseddataentry.action.DeleteRelationshipAction"
 		class="org.hisp.dhis.light.namebaseddataentry.action.DeleteRelationshipAction">
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="relationshipService"

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2012-10-01 04:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2012-10-03 07:43:08 +0000
@@ -53,6 +53,7 @@
 activity_list=Activity List
 successfully_saved=Successfully Saved
 select_option=Select Option
+option_set_searching_result=Option Set Searching Result
 id=ID
 gender=Gender
 date_of_birth=Date of Birth

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2012-09-28 08:13:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2012-10-03 07:43:08 +0000
@@ -314,7 +314,7 @@
         /light/selectSingleEventBeneficiary.action?programId=${programId}&amp;organisationUnitId=${organisationUnitId}&amp;validated=true
       </result>
       <result name="error" type="velocity">/dhis-web-light/main.vm</result>
-      <result name="redirect" type="redirect">findSingleEventOptionSet.action?keyword=${keyword}&amp;dataElementIdForSearching=${dataElementIdForSearching}&amp;organisationUnitId=${organisationUnitId}&amp;patientId=${patientId}&amp;programId=${programId}</result>
+      <result name="redirect" type="redirect">findSingleEventOptionSet.action?keyword=${keyword}&amp;dataElementIdForSearching=${dataElementIdForSearching}&amp;organisationUnitId=${organisationUnitId}&amp;patientId=${patientId}&amp;programId=${programId}&amp;programStageInstanceId=${programStageInstanceId}&amp;isEditing=${isEditing}</result>
       <param name="page">/dhis-web-light/singleevent/singleEventForm.vm</param>
     </action>
     

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-09-28 09:17:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-10-03 07:43:08 +0000
@@ -35,7 +35,11 @@
 	<ul>
 		#if( $listOfCompletedProgram.size() != 0 )
 			#foreach( $programInstance in $listOfCompletedProgram )
-				$programInstance.getProgram().getName()
+				#if( $programInstance.getProgram().getProgramStages().size() > 1)
+					$programInstance.getProgram().getName()
+				#else
+					<a href="showSingleEventForm.action?programId=$programInstance.program.id&patientId=$patient.id&organisationUnitId=$patient.organisationUnit.id&isEditing=true">$programInstance.getProgram().getName()</a>
+				#end	
 			#end
 		#else
 			<li>$i18n.getString("no_completed_programs")</li>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2012-09-28 08:13:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2012-10-03 07:43:08 +0000
@@ -3,7 +3,6 @@
 <form method="post" action="saveSingleEvent.action">
 	<div class="header-box" align="center">
 		<p style="text-align: left;">
-		
 	#foreach( $programStageDataElement in $programStageDataElements)
 		#set($dataElement = $programStageDataElement.getDataElement())
 		#set( $key = "DE${dataElement.id}" )
@@ -54,6 +53,8 @@
 		<input type="hidden" name="organisationUnitId" value="$organisationUnitId" />
 		<input type="hidden" name="programId" value="$programId" />
 		<input type="hidden" name="patientId" value="$patientId" />
+		<input type="hidden" name="isEditing" value="$isEditing" />
+		<input type="hidden" name="programStageInstanceId" value="$programStageInstanceId" />	
 		<input type="submit" value=$i18n.getString("Submit") />
 	    </p>
 	</div>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.vm	2012-09-28 08:13:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.vm	2012-10-03 07:43:08 +0000
@@ -1,11 +1,12 @@
-<h2>Option Set Searching Result</h2>
+<h2>$i18n.getString("option_set_searching_result")</h2>
 <p>
 	#if( $searchingResultList.size() == 0 )
 		No result
 	#else
 		<ul>
+		$isEditing
 		#foreach( $option in $searchingResultList )
-			<li><a href="showSingleEventForm.action?searchResult=$option&dataElementIdForSearching=$dataElementIdForSearching&organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId">$option</a></li>
+			<li><a href="showSingleEventForm.action?searchResult=$option&dataElementIdForSearching=$dataElementIdForSearching&organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId&programStageInstanceId=$programStageInstanceId&isEditing=$!isEditing">$option</a></li>
 		#end	
 		</ul>
 	#end
@@ -13,7 +14,7 @@
 <div id="footer">
 	<h2>$i18n.getString( "navigate_to" )</h2>
 	<ul>
-		<li><a href="showSingleEventForm.action?organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId">$i18n.getString("back_single_event_form")</a></li>
+		<li><a href="showSingleEventForm.action?organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId&isEditing=$!isEditing">$i18n.getString("back_single_event_form")</a></li>
 		<li><a href="index.action">$i18n.getString("home")</a></li>
 	</ul>
 </div>
\ No newline at end of file