← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8504: Display sections of program stage in web-light

 

------------------------------------------------------------
revno: 8504
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-10-12 16:22:44 +0700
message:
  Display sections of program stage in web-light
added:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageSectionAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/MarkCompleteProgramStageAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/selectProgramStageSection.vm
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
  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/singleevent/action/GetSingleEventFormAction.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/resources/META-INF/dhis/beans.xml
  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/dataEntryOverview.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm
  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/beneficiaryProgramStageList.vm
  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/selectDataSet.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectPeriod.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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java	2012-04-10 06:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java	2012-10-12 09:22:44 +0000
@@ -44,7 +44,7 @@
     public ActivityPlan getActivitiesByIdentifier( String keyword )
         throws NotAllowedException;
 
-    public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue )
+    public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue, Integer programStageSectionId )
         throws NotAllowedException;
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2012-10-09 04:45:29 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2012-10-12 09:22:44 +0000
@@ -67,6 +67,8 @@
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
 import org.hisp.dhis.system.util.DateUtils;
 import org.joda.time.DateTime;
 import org.joda.time.Period;
@@ -101,6 +103,13 @@
     private PatientMobileSettingService patientMobileSettingService;
 
     private PatientIdentifierService patientIdentifierService;
+    
+    private ProgramStageSectionService programStageSectionService;
+    
+    public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+    {
+        this.programStageSectionService = programStageSectionService;
+    }
 
     // -------------------------------------------------------------------------
     // MobileDataSetService
@@ -238,7 +247,7 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue )
+    public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue, Integer programStageSectionId )
         throws NotAllowedException
     {
 
@@ -251,10 +260,22 @@
 
         programStageInstance.getProgramStage();
         Collection<org.hisp.dhis.dataelement.DataElement> dataElements = new ArrayList<org.hisp.dhis.dataelement.DataElement>();
-
-        for ( ProgramStageDataElement de : programStageInstance.getProgramStage().getProgramStageDataElements() )
-        {
-            dataElements.add( de.getDataElement() );
+        
+        ProgramStageSection programStageSection = programStageSectionService.getProgramStageSection( programStageSectionId );
+        
+        if ( programStageSectionId != null && programStageSectionId != 0 )
+        {
+            for ( ProgramStageDataElement de : programStageSection.getProgramStageDataElements() )
+            {
+                dataElements.add( de.getDataElement() );
+            }
+        }
+        else
+        {
+            for ( ProgramStageDataElement de : programStageInstance.getProgramStage().getProgramStageDataElements() )
+            {
+                dataElements.add( de.getDataElement() );
+            }
         }
 
         programStageInstance.getProgramStage().getProgramStageDataElements();
@@ -266,7 +287,7 @@
         }
 
         if ( dataElements.size() != dataElementIds.size() )
-        {
+        {;
             throw NotAllowedException.INVALID_PROGRAM_STAGE;
         }
 
@@ -281,8 +302,12 @@
         }
 
         // Set ProgramStageInstance to completed
-        programStageInstance.setCompleted( true );
-        programStageInstanceService.updateProgramStageInstance( programStageInstance );
+        if ( programStageSectionId == 0 )
+        {
+            programStageInstance.setCompleted( true );
+            programStageInstanceService.updateProgramStageInstance( programStageInstance );
+        }
+            
         // Everything is fine, hence save
         saveDataValues( activityValue, programStageInstance, dataElementMap );
 
@@ -441,7 +466,6 @@
 
             dataElement = dataElementMap.get( dv.getId() );
             PatientDataValue dataValue = dataValueService.getPatientDataValue( programStageInstance, dataElement );
-
             if ( dataValue == null )
             {
                 if ( value != null )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-10-09 04:45:29 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-10-12 09:22:44 +0000
@@ -24,6 +24,7 @@
     <property name="dataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
     <property name="patientMobileSettingService" ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
     <property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
+    <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService"/>
 	<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
   </bean>
 

=== 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-07-13 09:18:09 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java	2012-10-12 09:22:44 +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;
@@ -35,7 +36,7 @@
 import org.hisp.dhis.api.mobile.model.Activity;
 import org.hisp.dhis.api.mobile.model.ActivityPlan;
 import org.hisp.dhis.api.mobile.model.DataElement;
-import org.hisp.dhis.api.mobile.model.ProgramStage;
+
 import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
@@ -43,14 +44,19 @@
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
 import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
 
 import com.opensymphony.xwork2.Action;
 
 public class GetProgramStageFormAction
     implements Action
 {
-
+    private static final String REDIRECT = "redirect";
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -103,6 +109,12 @@
         this.patientService = patientService;
     }
     
+    private ProgramStageSectionService programStageSectionService;
+    
+    public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+    {
+        this.programStageSectionService = programStageSectionService;
+    }
 
     // -------------------------------------------------------------------------
     // Input & Output
@@ -247,7 +259,33 @@
     {
         this.patient = patient;
     }
-
+    
+    private Integer programStageSectionId;
+
+    public void setProgramStageSectionId( Integer programStageSectionId )
+    {
+        this.programStageSectionId = programStageSectionId;
+    }
+
+    public Integer getProgramStageSectionId()
+    {
+        return programStageSectionId;
+    }
+
+    private List<ProgramStageSection> listOfProgramStageSections;
+    
+    public List<ProgramStageSection> getListOfProgramStageSections()
+    {
+        return listOfProgramStageSections;
+    }
+    
+    public ProgramStageSection programStageSection;
+
+    public ProgramStageSection getProgramStageSection()
+    {
+        return programStageSection;
+    }
+    
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -269,7 +307,19 @@
         prevDataValues.clear();
         programStage = util.getProgramStage( programId, programStageId );
         patient = patientService.getPatient( patientId );
-        dataElements = programStage.getDataElements();
+        
+        if( programStageSectionId != null && programStageSectionId != 0 )
+        {
+            this.programStageSection = programStageSectionService.getProgramStageSection( this.programStageSectionId );
+            
+            List<ProgramStageDataElement> listOfProgramStageDataElement = programStageSection.getProgramStageDataElements();
+            
+            dataElements = util.transformDataElementsToMobileModel( listOfProgramStageDataElement );
+        }
+        else
+        {
+            dataElements = util.transformDataElementsToMobileModel( programStageId );
+        }
         program = programStageInstanceService.getProgramStageInstance( programStageInstanceId ).getProgramInstance().getProgram();
         Collection<PatientDataValue> patientDataValues = patientDataValueService
             .getPatientDataValues( programStageInstanceService.getProgramStageInstance( programStageInstanceId ) );

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageSectionAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageSectionAction.java	2012-10-12 09:22:44 +0000
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+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.program.ProgramStageSection;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version $ GetProgramStageSectionAction.java Oct 10, 2012 $
+ */
+public class GetProgramStageSectionAction implements Action
+{
+    private static final String REDIRECT = "redirect";
+    private static final String REDIRECT_COMPLETED_FORM = "redirectCompletedForm";
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private NamebasedUtils util;
+    
+    public void setUtil( NamebasedUtils util )
+    {
+        this.util = util;
+    }
+    
+    private PatientService patientService;
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+    
+    private ProgramStageInstanceService programStageInstanceService;
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer programInstanceId;
+
+    public Integer getProgramInstanceId()
+    {
+        return programInstanceId;
+    }
+
+    public void setProgramInstanceId( Integer programInstanceId )
+    {
+        this.programInstanceId = programInstanceId;
+    }
+    
+    private Integer programStageInstanceId;
+
+    public Integer getProgramStageInstanceId()
+    {
+        return programStageInstanceId;
+    }
+
+    public void setProgramStageInstanceId( Integer programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
+    
+    private Integer patientId;
+
+    public Integer getPatientId()
+    {
+        return patientId;
+    }
+
+    public void setPatientId( Integer patientId )
+    {
+        this.patientId = patientId;
+    }
+    
+    private Patient patient;
+    
+    public Patient getPatient()
+    {
+        return patient;
+    }
+    
+    private Integer programId;
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    public Integer getProgramId()
+    {
+        return programId;
+    }
+    
+    private Integer programStageId;
+
+    public void setProgramStageId( Integer programStageId )
+    {
+        this.programStageId = programStageId;
+    }
+
+    public Integer getProgramStageId()
+    {
+        return programStageId;
+    }
+    
+    private Integer orgUnitId;
+
+    public void setOrgUnitId( Integer orgUnitId )
+    {
+        this.orgUnitId = orgUnitId;
+    }
+
+    public Integer getOrgUnitId()
+    {
+        return this.orgUnitId;
+    }
+    
+    private ProgramStage programStage;
+
+    public ProgramStage getProgramStage()
+    {
+        return this.programStage;
+    }
+    
+    private List<ProgramStageSection> listOfProgramStageSections;
+    
+    public List<ProgramStageSection> getListOfProgramStageSections()
+    {
+        return listOfProgramStageSections;
+    }
+
+    private List<ProgramStageDataElement> listOfProgramStageDataElement;
+
+    public List<ProgramStageDataElement> getListOfProgramStageDataElement()
+    {
+        return listOfProgramStageDataElement;
+    }
+    
+    public DateFormat getDateFormat()
+    {
+        return new SimpleDateFormat( "yyyy-MM-dd" );
+    }
+    
+    public ProgramStageInstance programStageInstance;
+    
+    public ProgramStageInstance getProgramStageInstance()
+    {
+        return programStageInstance;
+    }
+
+    @Override
+    public String execute()
+        throws Exception
+    {   
+        programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
+        
+        patient = patientService.getPatient( patientId );
+        
+        programStage = util.getProgramStage( programId, programStageId );
+        
+        this.listOfProgramStageSections = new ArrayList<ProgramStageSection>(programStage.getProgramStageSections());
+        
+        if( this.listOfProgramStageSections.size() == 0 && programStageInstance.isCompleted() == false)
+        {
+            return REDIRECT;
+        }
+        else if( this.listOfProgramStageSections.size() == 0 && programStageInstance.isCompleted() == true )
+        {
+            return REDIRECT_COMPLETED_FORM;
+        }
+             
+        //this.listOfProgramStageDataElement = listOfProgramStageSections.get( 0 ).getProgramStageDataElements();
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/MarkCompleteProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/MarkCompleteProgramStageAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/MarkCompleteProgramStageAction.java	2012-10-12 09:22:44 +0000
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version $ MarkCompleteProgramStageHasSection.java Oct 12, 2012 $
+ */
+public class MarkCompleteProgramStageAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private ProgramStageInstanceService programStageInstanceService;
+    
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer programStageInstanceId;
+    
+    public void setProgramStageInstanceId( Integer programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
+    
+    private Integer patientId;
+
+    public void setPatientId( Integer patientId )
+    {
+        this.patientId = patientId;
+    }
+
+    public Integer getPatientId()
+    {
+        return patientId;
+    }
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
+        programStageInstance.setCompleted( true );
+        programStageInstanceService.updateProgramStageInstance( programStageInstance );
+        return SUCCESS;
+    }
+    
+}

=== 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-10-01 04:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2012-10-12 09:22:44 +0000
@@ -45,7 +45,7 @@
 import org.hisp.dhis.api.mobile.model.ActivityValue;
 import org.hisp.dhis.api.mobile.model.DataElement;
 import org.hisp.dhis.api.mobile.model.DataValue;
-import org.hisp.dhis.api.mobile.model.ProgramStage;
+//import org.hisp.dhis.api.mobile.model.ProgramStage;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.i18n.I18n;
@@ -57,10 +57,13 @@
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.program.ProgramValidation;
 import org.hisp.dhis.program.ProgramValidationService;
@@ -199,6 +202,13 @@
     {
         this.programStageInstanceService = programStageInstanceService;
     }
+    
+    private ProgramStageSectionService programStageSectionService;
+    
+    public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+    {
+        this.programStageSectionService = programStageSectionService;
+    }
 
     // -------------------------------------------------------------------------
     // Input & Output
@@ -378,6 +388,25 @@
     {
         this.rightsideFormulaMap = rightsideFormulaMap;
     }
+    
+    private Integer programStageSectionId;
+
+    public void setProgramStageSectionId( Integer programStageSectionId )
+    {
+        this.programStageSectionId = programStageSectionId;
+    }
+
+    public Integer getProgramStageSectionId()
+    {
+        return programStageSectionId;
+    }
+    
+    public ProgramStageSection programStageSection;
+
+    public ProgramStageSection getProgramStageSection()
+    {
+        return programStageSection;
+    }
 
     private I18n i18n;
 
@@ -401,7 +430,18 @@
         org.hisp.dhis.program.ProgramStage dhisProgramStage = programStageService.getProgramStage( programStageId );
 
         patient = patientService.getPatient( patientId );
-        dataElements = programStage.getDataElements();
+        if( programStageSectionId != null && programStageSectionId != 0 )
+        {
+            this.programStageSection = programStageSectionService.getProgramStageSection( this.programStageSectionId );
+            
+            List<ProgramStageDataElement> listOfProgramStageDataElement = programStageSection.getProgramStageDataElements();
+            
+            dataElements = util.transformDataElementsToMobileModel( listOfProgramStageDataElement );
+        }
+        else
+        {
+            dataElements = util.transformDataElementsToMobileModel( programStageId );
+        }
 
         int defaultCategoryOptionId = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo().getId();
         HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
@@ -469,7 +509,7 @@
 
         try
         {
-            activityReportingService.saveActivityReport( organisationUnit, activityValue );
+            activityReportingService.saveActivityReport( organisationUnit, activityValue, programStageSectionId );
         }
         catch ( NotAllowedException e )
         {
@@ -520,7 +560,7 @@
                 }
             }
         }
-
+        
         if ( !programValidations.isEmpty() )
         {
             leftsideFormulaMap = new HashMap<Integer, String>( programValidations.size() );

=== 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-10-09 04:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2012-10-12 09:22:44 +0000
@@ -240,7 +240,6 @@
         if ( searchResult != null )
         {
             this.prevDataValues.put( "DE" + this.dataElementIdForSearching, searchResult );
-            System.out.println("ko co null");
         }
         else
         {

=== 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-07-29 10:56:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java	2012-10-12 09:22:44 +0000
@@ -27,13 +27,18 @@
 
 package org.hisp.dhis.light.utils;
 
-import org.hisp.dhis.api.mobile.IProgramService;
-import org.hisp.dhis.api.mobile.model.Program;
-import org.hisp.dhis.api.mobile.model.ProgramStage;
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.program.Program;
+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.ProgramStageService;
+import org.springframework.beans.factory.annotation.Required;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.Set;
 
 public class NamebasedUtils
@@ -42,16 +47,33 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private IProgramService programService;
+    //private IProgramService IprgramService;   
+    private ProgramService programService;
 
-    public void setProgramService( IProgramService programService )
+    public void setProgramService( ProgramService programService )
     {
         this.programService = programService;
     }
+    
+    private ProgramStageService programStageService;
+    
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
+    }
+    
+    private org.hisp.dhis.mobile.service.ModelMapping modelMapping;
+    
+    @Required
+    public void setModelMapping( org.hisp.dhis.mobile.service.ModelMapping modelMapping )
+    {
+        this.modelMapping = modelMapping;
+    }
 
     public ProgramStage getProgramStage( int programId, int programStageId )
     {
-        Program program = programService.getProgram( programId, "" );
+        //Program program = programService.getProgram( programId, "" );
+        Program program = programService.getProgram( programId );
 
         Collection<ProgramStage> stages = program.getProgramStages();
 
@@ -130,4 +152,35 @@
 
         return null;
     }
+    
+    public List<org.hisp.dhis.api.mobile.model.DataElement> transformDataElementsToMobileModel( Integer programStageId )
+    {
+        ProgramStage programStage = programStageService.getProgramStage( programStageId );
+        
+        List<org.hisp.dhis.api.mobile.model.DataElement> des = new ArrayList<org.hisp.dhis.api.mobile.model.DataElement>();
+
+        List<ProgramStageDataElement> programStageDataElements =  new ArrayList<ProgramStageDataElement>(programStage.getProgramStageDataElements());
+
+        des = transformDataElementsToMobileModel( programStageDataElements );
+        
+        return des;
+    }
+    public List<org.hisp.dhis.api.mobile.model.DataElement> transformDataElementsToMobileModel( List<ProgramStageDataElement> programStageDataElements)
+    {
+        List<org.hisp.dhis.api.mobile.model.DataElement> des = new ArrayList<org.hisp.dhis.api.mobile.model.DataElement>();
+
+        for ( ProgramStageDataElement programStagedataElement : programStageDataElements )
+        {
+            //programStagedataElement = i18n( i18nService, locale, programStagedataElement );
+
+            DataElement dataElement = programStagedataElement.getDataElement();
+
+            org.hisp.dhis.api.mobile.model.DataElement de = modelMapping.getDataElement( dataElement );
+
+            de.setCompulsory( programStagedataElement.isCompulsory() );
+
+            des.add( de );
+        }
+        return des;
+    }
 }

=== 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:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2012-10-12 09:22:44 +0000
@@ -146,6 +146,22 @@
 	</bean>
 
 	<bean
+		id="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageSectionAction"
+		class="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageSectionAction">
+		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />	
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.light.namebaseddataentry.action.MarkCompleteProgramStageAction"
+		class="org.hisp.dhis.light.namebaseddataentry.action.MarkCompleteProgramStageAction">
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService"/>
+	</bean>
+
+	<bean
 		id="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageFormAction"
 		class="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageFormAction">
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
@@ -154,10 +170,14 @@
 		<property name="patientDataValueService"
 			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="programStageSectionService"
+			ref="org.hisp.dhis.program.ProgramStageSectionService"/>
 	</bean>
 
 	<bean id="org.hisp.dhis.light.utils.NamebasedUtils" class="org.hisp.dhis.light.utils.NamebasedUtils">
-		<property name="programService" ref="org.hisp.dhis.mobile.api.IProgramService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="modelMapping" ref="org.hisp.dhis.mobile.service.ModelMapping" />
 	</bean>
 
 	<bean
@@ -176,6 +196,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" />
+		<property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService"/>
 
 	</bean>
 

=== 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-10-03 07:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2012-10-12 09:22:44 +0000
@@ -103,7 +103,15 @@
       <result name="success" type="velocity">/dhis-web-light/main.vm</result>
       <param name="page">/dhis-web-light/namebased/selectActivity.vm</param>
     </action>
-
+    
+    <action name="showProgramStageSection"
+		class="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageSectionAction">
+	  <result name="redirect" type="redirect">showProgramStageForm.action?programStageSectionId=0&amp;programId=${programId}&amp;programStageId=${programStageInstance.getProgramStage().getId()}&amp;programStageInstanceId=${programStageInstance.getId()}&amp;patientId=${patient.getId()}&amp;programInstanceId=${programStageInstance.getProgramInstance().getId()}&amp;orgUnitId=0</result>
+	  <result name="redirectCompletedForm" type="redirect">showCompletedProgramStageForm.action?programStageSectionId=0&amp;programId=${programId}&amp;programStageId=${programStageInstance.getProgramStage().getId()}&amp;programStageInstanceId=${programStageInstance.getId()}&amp;patientId=${patient.getId()}&amp;programInstanceId=${programStageInstance.getProgramInstance().getId()}&amp;orgUnitId=0</result>
+	  <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+	  <param name="page">/dhis-web-light/namebased/selectProgramStageSection.vm</param>		
+	</action>
+	
     <action name="showProgramStageForm"
         class="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageFormAction">
       <result name="success" type="velocity">/dhis-web-light/main.vm</result>
@@ -115,6 +123,11 @@
       <result name="success" type="velocity">/dhis-web-light/main.vm</result>
       <param name="page">/dhis-web-light/namebased/completedProgramStageForm.vm</param>
     </action>
+    
+    <action name="markCompleteProgramStageHasSection"
+        class="org.hisp.dhis.light.namebaseddataentry.action.MarkCompleteProgramStageAction">
+      <result name="success" type="redirect">showPatientProgramList.action?patientId=${patientId}</result>
+    </action>
 
     <action name="saveProgramStageForm"
         class="org.hisp.dhis.light.namebaseddataentry.action.SaveProgramStageFormAction">

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm	2012-01-23 13:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm	2012-10-12 09:22:44 +0000
@@ -61,17 +61,6 @@
     </ul>
 </div>
 
-
-
-
-
-
-
-
-
-
-
-
 #* This might get reactivated later, as configurable setting? *#
 
 #*

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm	2012-06-28 08:44:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm	2012-10-12 09:22:44 +0000
@@ -8,7 +8,6 @@
 #end
 
 <h2>$encoder.htmlEncode( $dataSetName )</h2>
-
 #set( $validationViolationsSize = $validationViolations.size() )
 #set( $typeViolationsSize = $typeViolations.size() )
 
@@ -35,7 +34,6 @@
 #if( $sectionId)
 <input type="hidden" id="sectionId" name="sectionId" value="$sectionId" />
 #end
-
 <input type="hidden" id="validated" name="validated" value="#if($validated)true#{else}false#end" />
 
 #macro( createSection $sectionName $dataElements )

=== 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-10-03 07:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-10-12 09:22:44 +0000
@@ -21,7 +21,7 @@
 
           			#if($nextStage)
           				<li>
-          					<a href="showProgramStageForm.action?programId=$programInstance.getProgram().getId()&programStageId=$nextStage.getProgramStage().getId()&programStageInstanceId=$nextStage.getId()&patientId=$patient.getId()&programInstanceId=$programInstance.getId()&orgUnitId=0"> - Next: $nextStage.getProgramStage().getName()</a>
+          					<a href="showProgramStageSection.action?programId=$programInstance.getProgram().getId()&programStageId=$nextStage.getProgramStage().getId()&programStageInstanceId=$nextStage.getId()&patientId=$patient.getId()&programInstanceId=$programInstance.getId()&orgUnitId=0"> - Next: $nextStage.getProgramStage().getName()</a>
           				</li>
           			#end
           		#end

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramStageList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramStageList.vm	2012-07-16 07:53:40 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramStageList.vm	2012-10-12 09:22:44 +0000
@@ -17,10 +17,10 @@
 	#end
 	<li>
 		 #if( $programStageInstance.isCompleted() == true )
-		 	<a href="showCompletedProgramStageForm.action?programId=$programId&programStageId=$programStageInstance.getProgramStage().getId()&programStageInstanceId=$programStageInstance.getId()&patientId=$patient.getId()&programInstanceId=$programStageInstance.getProgramInstance().getId()&orgUnitId=0">
+		 	<a href="showProgramStageSection.action?programId=$programId&programStageId=$programStageInstance.getProgramStage().getId()&programStageInstanceId=$programStageInstance.getId()&patientId=$patient.getId()&programInstanceId=$programStageInstance.getProgramInstance().getId()&orgUnitId=0">
 			$programStageInstance.getProgramStage().getName() (${dateFormat.format( $programStageInstance.executionDate )}) <img src="../dhis-web-light/images/checkmark.jpg" /></a>
-		 #else 
-		 	<a href="showProgramStageForm.action?programId=$programId&programStageId=$programStageInstance.getProgramStage().getId()&programStageInstanceId=$programStageInstance.getId()&patientId=$patient.getId()&programInstanceId=$programStageInstance.getProgramInstance().getId()&orgUnitId=0">
+		 #else
+		 	<a href="showProgramStageSection.action?programId=$programId&programStageId=$programStageInstance.getProgramStage().getId()&programStageInstanceId=$programStageInstance.getId()&patientId=$patient.getId()&programInstanceId=$programStageInstance.getProgramInstance().getId()&orgUnitId=0">
 		 	$programStageInstance.getProgramStage().getName() (${dateFormat.format( $programStageInstance.dueDate)})</a>
 		 #end
 	</li>

=== 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-10-01 04:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2012-10-12 09:22:44 +0000
@@ -1,5 +1,12 @@
-<h2>$encoder.htmlEncode( $programStage.name )</h2>
-
+<div class="header-box" align="center">
+	<h3 style="text-align: left; background-color: #719953; border-color: #719953; color: white;">$patient.firstName $patient.lastName</h3>
+	<p style="text-align: left;">
+	Program Stage: $encoder.htmlEncode( $programStage.name )<br/>
+	#if( $programStageSectionId != 0 )	
+		Section:$encoder.htmlEncode( $programStageSection.name )
+    #end
+	</p>
+</div>
 #set( $typeViolationsSize = $typeViolations.size() )
 #set( $programViolationsSize = $programValidations.size() )
 
@@ -15,7 +22,6 @@
 	</p>
 </div>	
 #end
-
 <form action="saveProgramStageForm.action" method="POST">
 
 <input type="hidden" value=$programInstanceId name="programInstanceId"/>
@@ -25,6 +31,7 @@
 <input type="hidden" value=$programId name="programId" />
 <input type="hidden" value=$patientId name="patientId" />
 <input type="hidden" id="current" name="current" value=$current />
+<input type="hidden" name="programStageSectionId" value="$programStageSectionId"/>
 
 <div class="header-box" align="center">
 	<p style="text-align: left;">
@@ -102,4 +109,4 @@
 	<li><a href="index.action">$i18n.getString("home")</a></li>
 	
 </ul>
-</div>
+</div>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/selectProgramStageSection.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/selectProgramStageSection.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/selectProgramStageSection.vm	2012-10-12 09:22:44 +0000
@@ -0,0 +1,30 @@
+<div class="header-box" align="center">
+    <h3 style="text-align: left; background-color: #719953; border-color: #719953; color: white;">$patient.firstName $patient.lastName</h3>
+    <p style="text-align: left;">
+        $programStage.name (${dateFormat.format( $programStageInstance.dueDate)})
+    </p>
+</div>
+
+<h2>$i18n.getString( "sections" )</h2>
+<div>
+	<ul>
+	#foreach( $each in $listOfProgramStageSections )
+		<li><a href="showProgramStageForm.action?programStageSectionId=$each.Id&programId=$programId&programStageId=$programStageInstance.getProgramStage().getId()&programStageInstanceId=$programStageInstance.getId()&patientId=$patient.getId()&programInstanceId=$programStageInstance.getProgramInstance().getId()&orgUnitId=0">$each.name</a></li>
+	#end
+	</ul>
+</div>
+
+<form method="POST" action="markCompleteProgramStageHasSection.action">
+<input type="hidden" name="programStageInstanceId" value="$programStageInstance.id"/>
+<input type="hidden" name="patientId" value="$patient.id"/>
+<div class="header-box" align="center">
+    <p>
+        <input type="submit" style="width: 100%;" value="$i18n.getString("form_complete")" />
+    </p>
+</div>
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectDataSet.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectDataSet.vm	2012-01-23 10:49:32 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectDataSet.vm	2012-10-12 09:22:44 +0000
@@ -9,11 +9,11 @@
 <h2>$i18n.getString( "available_datasets" )</h2>
 
 <p>
-<ul>
-#foreach( $dataSet in $dataSets )
-<li><a href="selectPeriod.action?organisationUnitId=$organisationUnitId&dataSetId=$dataSet.id">$!encoder.htmlEncode( ${dataSet.name} )</a></li>
-#end
-</ul>
+	<ul>
+		#foreach( $dataSet in $dataSets )
+			<li><a href="selectPeriod.action?organisationUnitId=$organisationUnitId&dataSetId=$dataSet.id">$!encoder.htmlEncode( ${dataSet.name} )</a></li>
+		#end
+	</ul>
 </p>
 
 <div id="footer">

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectPeriod.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectPeriod.vm	2012-01-23 10:49:32 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectPeriod.vm	2012-10-12 09:22:44 +0000
@@ -20,8 +20,8 @@
 <li>
     #if( ! $lockedPeriods.contains( $period ) && ! $periodCompletedMap.get($period) )
         <a href="dataEntry.action?organisationUnitId=$organisationUnitId&dataSetId=$dataSetId&periodId=$period.getExternalId()">$!encoder.htmlEncode( ${period.name} )</a>
-    #else
-        $!encoder.htmlEncode( ${period.name} )
+    #elseif( $periodCompletedMap.get($period) )
+        <a href="dataEntry.action?organisationUnitId=$organisationUnitId&dataSetId=$dataSetId&periodId=$period.getExternalId()">$!encoder.htmlEncode( ${period.name} )</a>
     #end
 
 	#if( $periodCompletedMap.get($period) )<img src="../dhis-web-light/images/checkmark.jpg" />#end

=== 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-10-03 07:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.vm	2012-10-12 09:22:44 +0000
@@ -4,9 +4,8 @@
 		No result
 	#else
 		<ul>
-		$isEditing
 		#foreach( $option in $searchingResultList )
-			<li><a href="showSingleEventForm.action?searchResult=$option&dataElementIdForSearching=$dataElementIdForSearching&organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId&programStageInstanceId=$programStageInstanceId&isEditing=$!isEditing">$option</a></li>
+			<li><a href="showSingleEventForm.action?searchResult=$option&dataElementIdForSearching=$dataElementIdForSearching&organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId&programStageInstanceId=$programStageInstanceId&isEditing=$!isEditing">$!encoder.htmlEncode( ${option} )</a></li>
 		#end	
 		</ul>
 	#end
@@ -14,7 +13,7 @@
 <div id="footer">
 	<h2>$i18n.getString( "navigate_to" )</h2>
 	<ul>
-		<li><a href="showSingleEventForm.action?organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId&isEditing=$!isEditing">$i18n.getString("back_single_event_form")</a></li>
+		<li><a href="showSingleEventForm.action?dataElementIdForSearching=$dataElementIdForSearching&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