← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5317: WIP experimental support for single events in the mobile browser interface. Done by

 

Merge authors:
  Eirik Caspari (eirikcas)
  Eirik Caspari (eirikcas)
  Eirik Vada (eiriktva)
  Eirik Vada <eirik.vada@xxxxxxxxx>
  Espen Gundersen (espen11)...

------------------------------------------------------------
revno: 5317 [merge]
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-06 23:23:13 +0100
message:
  WIP experimental support for single events in the mobile browser interface. Done by 
  student group 1, see http://dhis2.wikkii.com/w/images/dhis2/uploads/4/4e/Rapport.pdf
added:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddBeneficiaryAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddSingleEventAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/EditBeneficiaryAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetBeneficiaryChoicesAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyEditChoicesAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyRegisteredSingleEventsAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSelectOrgUnitSingleEventsAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventChoicesAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventsAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewBeneficiaryAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewSingleEventAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RenderResultPageAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/UpdateBeneficiaryAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/beneficiaryChoices.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/editBeneficiary.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newBeneficiary.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newSingleEvent.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyEditChoices.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyRegisteredSingleEvents.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/selectOrgUnitSingleEvents.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventChoices.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventResultPage.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEvents.vm
modified:
  dhis-2/dhis-web/dhis-web-light/pom.xml
  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/menu.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/pom.xml'
--- dhis-2/dhis-web/dhis-web-light/pom.xml	2011-11-14 12:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-light/pom.xml	2011-11-21 12:44:20 +0000
@@ -42,6 +42,10 @@
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-mobile</artifactId>
+    </dependency>
 
     <!-- Other -->
     <dependency>

=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents'
=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action'
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddBeneficiaryAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddBeneficiaryAction.java	2011-12-02 22:49:31 +0000
@@ -0,0 +1,671 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.math.NumberUtils;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.light.dataentry.utils.FormUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
+import org.hisp.dhis.patient.PatientAttributeOption;
+import org.hisp.dhis.patient.PatientAttributeOptionService;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class AddBeneficiaryAction implements Action  {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+		
+    private I18nFormat format;
+    
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+    	this.patientService = patientService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+    
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+    
+    private PatientAttributeGroupService patientAttributeGroupService;
+
+    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
+    {
+        this.patientAttributeGroupService = patientAttributeGroupService;
+    }
+    
+    private PatientAttributeOptionService patientAttributeOptionService;
+    
+    public void setPatientAttributeOptionService( PatientAttributeOptionService patientAttributeOptionService )
+    {
+        this.patientAttributeOptionService = patientAttributeOptionService;
+    }
+    
+    // -------------------------------------------------------------------------
+	// Input Output
+	// -------------------------------------------------------------------------   
+    
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private Patient patient;
+    
+    public Patient getPatient()
+    {
+    	return patient;
+    }
+
+    private String fullName;
+    
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+    
+    public String getFullName(){
+    	return fullName;
+    }
+
+    private String birthDate;
+    
+    public void setBirthDate( String birthDate )
+    {
+        this.birthDate = birthDate;
+    }
+    
+    public String getBirthDate()
+    {
+    	return birthDate;
+    }
+
+    private Character dobType;
+    
+    public void setDobType( Character dobType )
+    {
+    	this.dobType = dobType;
+    }
+    //
+    public char getDobType(){
+    	return dobType;
+    }
+
+    private String gender;
+    
+    public void setGender( String gender )
+    {
+    	this.gender = gender;
+    }
+    //
+    public String getGender(){
+    	return gender;
+    }
+
+    private String bloodGroup;
+    
+    public void setBloodGroup( String bloodGroup ){
+    	this.bloodGroup = bloodGroup;
+    }
+    //
+    public String getBloodGroup(){
+    	return bloodGroup;
+    }
+    
+    private String registrationDate;
+    
+    public void setRegistrationDate( String registrationDate ){
+    	this.registrationDate = registrationDate;
+    }
+    
+    public String getRegistrationDate()
+    {
+    	return registrationDate;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+    private Integer patientId;
+    
+    public Integer getPatientId(){
+    	return this.patientId;
+    }
+    
+    private List<PatientAttributeGroup> attributeGroups;
+    
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+    
+    private Collection<PatientAttribute> noGroupAttributes;
+
+    public Collection<PatientAttribute> getNoGroupAttributes()
+    {
+        return noGroupAttributes;
+    }
+    
+    private String dynForm[];
+    
+    public void setDynForm(String[] dynForm) {
+    	this.dynForm = dynForm;
+    }
+    
+    public String[] getDynForm()
+    {
+    	return dynForm;
+    }
+    
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Validation
+	// -------------------------------------------------------------------------
+
+    private Date rD,bD;
+    
+    private boolean fullNameIsToLong;
+    private boolean invalidFullName;
+    private boolean invalidRegistrationDate;
+    private boolean invalidBirthDate;
+    private boolean noGender;
+    private boolean noDobType;
+    private boolean invalidDobType;
+    private boolean invalidBloodGroup;
+    private boolean invalidGender;
+       
+	private ArrayList<Validate> validList = new ArrayList<Validate>();
+    
+    public ArrayList<Validate> getValidList()
+    {
+    	return this.validList;
+    }
+    
+    public boolean getFullNameIsToLong()
+    {
+    	return fullNameIsToLong;
+    }
+    
+    public boolean getInvalidFullName()
+    {
+    	return invalidFullName;
+    }
+    
+    public boolean getInvalidRegistrationDate()
+    {
+    	return invalidRegistrationDate;
+    }
+    
+    public boolean getInvalidBirthDate()
+    {
+    	return invalidBirthDate;
+    }
+    
+    public boolean getNoGender()
+    {
+    	return noGender;
+    }
+    
+    public boolean getNoDobType()
+    {
+    	return noDobType;
+    }
+    
+    public boolean getInvalidDobType()
+    {
+    	return invalidDobType;
+    }
+    
+    public boolean getInvalidGender()
+    {
+    	return invalidGender;
+    }
+    
+    public boolean getInvalidBloodGroup()
+    {
+    	return invalidBloodGroup;
+    }
+    
+    private boolean validate()
+    {
+    	boolean valid = true;
+    	
+    	if(validateStringLength(fullName,7,50) == false){
+    		fullNameIsToLong = true;
+    		valid = false;
+    	}
+    	
+    	if(validName(fullName) == false){
+    		invalidFullName = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDateNotNull(rD) == false){
+    		invalidRegistrationDate = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDateNotNull(bD) == false){
+    		invalidBirthDate = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDropDown(gender) == false){
+    		noGender = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDropDown(dobType) == false){
+    		noDobType = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDobType(dobType) == false){
+    		invalidDobType = true;
+    		valid = false;
+    	}
+    	
+    	if(validateGender(gender) == false){
+    		invalidGender = true;
+    		valid = false;
+    	}
+    	
+    	if(validateBloodGroup(bloodGroup) == false){
+    		invalidBloodGroup = true;
+    		valid = false;
+    	}
+    	
+    	return valid;
+    }
+    
+    private boolean validateStringLength(String s, int min, int max)
+    {
+    	return ((s.length() >= min) && (s.length() <= max));
+    }
+    
+    private boolean validName(String s)
+    {
+    	return (s.matches("^[\\p{L}|\\s]*$"));
+    }
+    
+    private boolean validateDateNotNull(Date d){
+    	if(d == null){
+    		return false;
+    	}else{
+    		return true;
+    	}
+    }
+    
+    private boolean validateDropDown(String s){
+    	if(s.equalsIgnoreCase("please_select")){
+    		return false;
+    	}else{
+    		return true;
+    	}
+    }
+    
+    private boolean validateDropDown(Character c){
+    	if(c.equals('p')){
+    		return false;
+    	}else{
+    		return true;
+    	}
+    }
+    
+    private boolean validateDobType(Character c)
+    {
+    	if(c == 'D' || c == 'V'){
+    		return true;
+    	}else{
+    		return false;
+    	}
+    }
+
+    private boolean validateGender(String s)
+    {
+    	if(s.equals("M") || s.equals("F") || s.equals("T")){
+    		return true;
+    	}else{
+    		return false;
+    	}
+    }
+    
+    private boolean validateBloodGroup(String s)
+    {
+    	if(s.matches("^\\w{1,2}\\-?\\+?$") || s.equalsIgnoreCase("please_select")){
+    		return true;
+    	}else{
+    		return false;
+    	}
+    }
+    
+
+    private boolean validateDynForm(String value, PatientAttribute patientAttribute){
+    	
+    	boolean valid = true;
+    	
+    	String type = patientAttribute.getValueType();
+    	Integer id = patientAttribute.getId();
+    	
+		if(value.isEmpty()){
+			if(patientAttribute.isMandatory()){
+				validList.add(new Validate(id, i18n.getString( "is_required" )));
+				valid = false;
+			}
+		}else if(type.equals("DATE")){
+			if(!FormUtils.isDate( value )) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_date" )));
+				valid = false;
+			}
+		}else if(type.equals("TEXT")){
+			if(!value.matches("^[\\p{L}|\\s|0-9]*$")) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_string" )));
+				valid = false;
+			}
+		}else if(type.equals("NUMBER")){
+			if(!FormUtils.isNumber( value )) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_number" )));
+				valid = false;
+			}
+		}else if(type.equals("YES/NO")){
+			if(!FormUtils.isBoolean( value )) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_boolean" )));
+				valid = false;
+			}
+		}else if(type.equals("COMBO")){
+			Set<PatientAttributeOption> attributeOptions = patientAttribute.getAttributeOptions();
+			boolean contains = false;
+			for(PatientAttributeOption attributeOption : attributeOptions){
+				if(attributeOption.getId() ==  NumberUtils.toInt( value, 0 ) ){	
+					contains = true;
+				}
+			}
+			if(!contains){
+				validList.add(new Validate(id, value));
+			}
+			valid = contains;
+		}
+    	
+    	return valid;
+    }
+    
+	public class Validate {	
+		private Integer _id;
+		private String _errormessage;
+		
+		public String getErrorMessage(){
+			return this._errormessage;
+		}
+		public Integer getId(){
+			return this._id;
+		}
+		
+		public Validate(Integer id, String errormessage)
+		{
+			this._id = id;
+			this._errormessage = errormessage;
+		}
+		
+	}
+
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+    
+	@Override
+	public String execute() {
+		//
+	    eventName = programService.getProgram(singleEventId).getName();
+	    
+		fullNameIsToLong = false;
+		invalidFullName = false;
+	    invalidRegistrationDate = false;
+	    invalidBirthDate = false;
+	    noGender = false;
+	    noDobType = false;
+	    invalidDobType = false;
+	    invalidBloodGroup = false;
+	    invalidGender = false;
+
+		Patient patient = new Patient();
+		// ---------------------------------------------------------------------
+        // Set FirstName, MiddleName, LastName by FullName
+        // ---------------------------------------------------------------------
+
+        fullName = fullName.trim();
+
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+
+        String firstName = fullName.toString();
+        String middleName = "";
+        String lastName = "";
+
+        if ( fullName.indexOf( ' ' ) != -1 )
+        {
+            firstName = fullName.substring( 0, startIndex );
+            if ( startIndex == endIndex )
+            {
+                middleName = "";
+                lastName = fullName.substring( startIndex + 1, fullName.length() );
+            }
+            else
+            {
+                middleName = fullName.substring( startIndex + 1, endIndex );
+                lastName = fullName.substring( endIndex + 1, fullName.length() );
+            }
+        }
+        patient.setFirstName( firstName );
+        patient.setMiddleName( middleName );
+        patient.setLastName( lastName );
+        
+        // ---------------------------------------------------------------------
+        // Set Other information for patient
+        // ---------------------------------------------------------------------
+        
+		OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( getOrganisationUnitId() );
+		
+		patient.setOrganisationUnit( organisationUnit );
+		patient.setGender( gender );		
+		patient.setDobType( dobType );
+		patient.setIsDead( false );
+		if(!bloodGroup.equalsIgnoreCase("please_select")){
+			patient.setBloodGroup( bloodGroup );
+		}
+        birthDate = birthDate.trim();
+        bD = format.parseDate( birthDate );
+        patient.setBirthDate( bD );
+        
+        registrationDate = registrationDate.trim();
+        rD = format.parseDate( registrationDate );
+        patient.setRegistrationDate( rD );
+        
+        // ---------------------------------------------------------------------
+        // Dynamic form
+        // ---------------------------------------------------------------------
+        
+        noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
+
+        attributeGroups = new ArrayList<PatientAttributeGroup>( patientAttributeGroupService
+            .getAllPatientAttributeGroups() );
+        Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+        
+        boolean validInGroup = true;
+        List<PatientAttributeValue> patientAttributeValues = new ArrayList<PatientAttributeValue>();
+        PatientAttributeValue attributeValue = null;
+        validList.clear();
+        int i = 0;
+        
+        //Attributes in groups
+        
+        for (PatientAttributeGroup patientAttributeGroup : attributeGroups) {
+        	List<PatientAttribute> patientAttributeList = patientAttributeGroup.getAttributes();
+        	for(PatientAttribute patientAttribute : patientAttributeList){
+        		       		
+        		String value = dynForm[i];
+        		
+   			 	if(!validateDynForm(value, patientAttribute)){
+   			 		validInGroup = false;
+   			 	}
+    			
+    			if(validInGroup){
+    				attributeValue = new PatientAttributeValue();
+                    attributeValue.setPatient( patient );
+                    attributeValue.setPatientAttribute( patientAttribute );
+                    
+                    if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) )
+                    {
+                        PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value, 0 ) );
+                        if ( option != null )
+                        {
+                            attributeValue.setPatientAttributeOption( option );
+                            attributeValue.setValue( option.getName() );
+                        }
+                    }
+                    else
+                    {
+                        attributeValue.setValue( value.trim() );
+                    }
+                    patientAttributeValues.add( attributeValue );
+    			}
+        		
+        		i++;
+        	}
+		}
+        
+        //Attributes not in groups
+        
+        boolean validNoGroup = true;
+        
+        for (PatientAttribute patientAttribute : noGroupAttributes) {
+			String value = dynForm[i];			
+			
+			 if(!validateDynForm(value, patientAttribute)){
+				 validNoGroup = false;
+			 }
+						 
+			if(validNoGroup){
+				attributeValue = new PatientAttributeValue();
+                attributeValue.setPatient( patient );
+                attributeValue.setPatientAttribute( patientAttribute );
+                
+                if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) ){
+                    PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value, 0 ) );
+                    if ( option != null ){
+                        attributeValue.setPatientAttributeOption( option );
+                        attributeValue.setValue( option.getName() );
+                    }
+                }else{
+                    attributeValue.setValue( value.trim() );
+                }
+                patientAttributeValues.add( attributeValue );
+			}
+			
+        	i++;
+		}
+        
+		if((validate() == false)||(!validNoGroup)||(!validInGroup)) {
+			return ERROR;
+		}else{
+	        patientId = patientService.createPatient( patient, 0, 0,patientAttributeValues );
+	        return SUCCESS;
+		}
+        
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddSingleEventAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/AddSingleEventAction.java	2011-12-02 22:49:31 +0000
@@ -0,0 +1,407 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.light.dataentry.utils.FormUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+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 com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class AddSingleEventAction implements Action  {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+	
+	private ProgramInstanceService programInstanceService;
+
+    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+    {
+        this.programInstanceService = programInstanceService;
+    }
+    
+	private ProgramStageInstanceService programStageInstanceService;
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+    
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+    
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+    	this.patientService = patientService;
+    }
+    
+    private PatientDataValueService patientDataValueService;
+
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private FormUtils formUtils;
+
+    public void setFormUtils( FormUtils formUtils )
+    {
+        this.formUtils = formUtils;
+    }
+
+    public FormUtils getFormUtils()
+    {
+        return formUtils;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+    
+    // -------------------------------------------------------------------------
+	// Input Output
+	// -------------------------------------------------------------------------
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId ){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return singleEventId;
+    }
+    
+    private Integer patientId;
+    
+    public void  setPatientId( Integer patientId ){
+    	this.patientId = patientId;
+    }
+    
+    public Integer getPatientId(){
+    	return this.patientId;
+    }
+ 
+    private Patient patient;
+    public Patient getPatient()
+    {
+    	return patient;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private boolean update;
+    
+    public void setUpdate( boolean update )
+    {
+    	this.update = update;
+    }
+    
+    public boolean getUpdate()
+    {
+    	return this.update;
+    }
+    
+    private Integer instId;
+    
+    public void setInstId( Integer instId )
+    {
+    	this.instId = instId;
+    }
+    
+    public Integer getInstId()
+    {
+    	return this.instId;
+    }
+    
+    private List<String> dynForm = new ArrayList<String>() ;
+    
+    public void setDynForm(List<String> dynForm) {
+    	this.dynForm = dynForm;
+    }
+    
+    public List<String> getDynForm()
+    {
+    	return dynForm;
+    }
+    
+    private String resultString;
+    
+    public void setResultString(String resultString){
+    	this.resultString = resultString;
+    }
+    
+    public String getResultString(){
+    	return this.resultString;
+    }
+    
+    private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
+    
+    public ArrayList<ProgramStageDataElement> getProgramStageDataElements(){
+    	return this.programStageDataElements;
+    }
+    
+	 static final Comparator<ProgramStageDataElement> OrderBySortOrder =
+		 	new Comparator<ProgramStageDataElement>() {
+		 public int compare(ProgramStageDataElement i1, ProgramStageDataElement i2) {
+			 return i1.getSortOrder().compareTo(i2.getSortOrder());
+		 }
+	};
+	 
+	// -------------------------------------------------------------------------
+	// Validation
+	// -------------------------------------------------------------------------
+	
+	public class Validate {	
+		private Integer _id;
+		private String _errormessage;
+		
+		public String getErrorMessage(){
+			return this._errormessage;
+		}
+		public Integer getId(){
+			return this._id;
+		}
+		
+		public Validate(Integer id, String errormessage)
+		{
+			this._id = id;
+			this._errormessage = errormessage;
+		}
+		
+	}
+	
+	private ArrayList<Validate> validList = new ArrayList<Validate>();
+    
+    public ArrayList<Validate> getValidList()
+    {
+    	return this.validList;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+    
+	@Override
+	public String execute() {
+		
+		Program program = programService.getProgram(singleEventId);
+		eventName = program.getName();
+		
+		Patient patient = patientService.getPatient(patientId);
+		ProgramStage programStage = program.getProgramStages().iterator().next();
+		OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit(organisationUnitId);
+
+		programStageDataElements = new ArrayList<ProgramStageDataElement>(programStage.getProgramStageDataElements());
+		Collections.sort(programStageDataElements, OrderBySortOrder);
+        
+		// -------------------------------------------------------------------------
+		// Validation
+		// -------------------------------------------------------------------------
+		
+		boolean valid = true;
+		validList.clear();
+        int i = 0;
+		for (ProgramStageDataElement programStageDataElement : programStageDataElements) {
+			
+			DataElement dataElement = programStageDataElement.getDataElement();
+			String value = dynForm.get(i).trim();
+			String type = dataElement.getType();
+			String numbertype = dataElement.getNumberType();
+			
+			if(value.isEmpty()) {
+					validList.add(new Validate(dataElement.getId(),i18n.getString( "is_required" )));
+					valid = false;
+				
+			} else if(type.equals( DataElement.VALUE_TYPE_DATE)) {
+				if(!FormUtils.isDate( value )) {
+					validList.add(new Validate(dataElement.getId(), value+ " " +i18n.getString( "is_invalid_date" )));
+					valid = false;
+				}
+				
+			} else if(type.equals( DataElement.VALUE_TYPE_STRING)) {
+				if(!value.matches("^[\\p{L}|\\s|0-9]*$")) {
+					validList.add(new Validate(dataElement.getId(), value+" "+i18n.getString( "is_invalid_string" )));
+					valid = false;
+				}
+				
+			} else if(type.equals( DataElement.VALUE_TYPE_INT)) {
+				
+				if(numbertype.equals(DataElement.VALUE_TYPE_POSITIVE_INT))
+				{
+					if(!FormUtils.isPositiveInteger( value )) {
+						validList.add(new Validate(dataElement.getId(), value+" "+i18n.getString( "is_invalid_positive_integer" )));
+						valid = false;
+					}
+				}
+				
+				if(numbertype.equals(DataElement.VALUE_TYPE_NEGATIVE_INT))
+				{
+					if(!FormUtils.isNegativeInteger( value )) {
+						validList.add(new Validate(dataElement.getId(), value+" "+i18n.getString( "is_invalid_negative_integer" )));
+						valid = false;
+					}
+				}
+				
+				if(numbertype.equals(DataElement.VALUE_TYPE_INT))
+				{
+					if(!FormUtils.isInteger( value )) {
+						validList.add(new Validate(dataElement.getId(), value+" "+i18n.getString( "is_invalid_integer" )));
+						valid = false;
+					}
+				}
+				
+				if(numbertype.equals(DataElement.VALUE_TYPE_NUMBER))
+				{
+					if(!FormUtils.isNumber( value )) {
+						validList.add(new Validate(dataElement.getId(), value+" "+i18n.getString( "is_invalid_number" )));
+						valid = false;
+					}
+				}
+			
+			} else if(type.equals( DataElement.VALUE_TYPE_BOOL)) {
+				if(!FormUtils.isBoolean( value )) {
+					validList.add(new Validate(dataElement.getId(), value+" "+i18n.getString( "is_invalid_boolean" )));
+					valid = false;
+				}
+			}
+			i++;
+		}
+		
+		if(valid) {
+
+	        if(!update)
+	        {
+		        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.setProgramInstance(programInstance);
+		        programStageInstance.setProgramStage(programStage);
+		        programStageInstance.setDueDate(new Date());
+		        programStageInstance.setExecutionDate(new Date());
+		        programStageInstance.setCompleted(false);
+				programStageInstanceService.addProgramStageInstance(programStageInstance);
+				
+				i = 0;
+				for (ProgramStageDataElement programStageDataElement : programStageDataElements) {
+					DataElement dataElement = programStageDataElement.getDataElement();
+				
+					PatientDataValue patientDataValue = new PatientDataValue();
+					patientDataValue.setDataElement(dataElement);
+					patientDataValue.setProgramStageInstance(programStageInstance);
+					patientDataValue.setOrganisationUnit(organisationUnit);
+					patientDataValue.setValue(dynForm.get(i).trim());
+					patientDataValueService.savePatientDataValue(patientDataValue);
+					i++;
+				}
+	        }
+	        else
+	        {
+				ProgramInstance programInstance = programInstanceService.getProgramInstance(instId);
+				programStage = program.getProgramStages().iterator().next(); // Fetch first, There exists only 1!
+				ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance(programInstance, programStage);
+	        	
+				i = 0;
+				for (ProgramStageDataElement programStageDataElement : programStageDataElements) {
+					PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue(programStageInstance, programStageDataElement.getDataElement(), organisationUnit);
+					patientDataValue.setValue(dynForm.get(i).trim());
+					patientDataValueService.updatePatientDataValue(patientDataValue);
+					i++;
+				}
+	        }
+
+	        if(update){
+	        	setResultString("updateSingleEvent");
+	        }else{
+	        	setResultString("newSingleEvent");
+	        }	        	
+			return SUCCESS;
+		} else {
+			return ERROR;
+		}
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/EditBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/EditBeneficiaryAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/EditBeneficiaryAction.java	2011-12-02 17:39:56 +0000
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
+import org.hisp.dhis.patient.PatientAttributeOption;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class EditBeneficiaryAction implements Action  {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+    
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+    	this.patientService = patientService;
+    }
+    
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+    
+    private PatientAttributeGroupService patientAttributeGroupService;
+
+    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
+    {
+        this.patientAttributeGroupService = patientAttributeGroupService;
+    }
+    
+    private PatientAttributeValueService patientAttributeValueService;
+    
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
+    
+    // -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------   
+    
+    private Integer patientId;
+    
+    public void setPatientId( Integer patientId )
+    {
+    	this.patientId = patientId;
+    }
+    
+    public Integer getPatientId()
+    {
+    	return patientId;
+    }
+    
+    private Patient patient;
+    
+    public Patient getPatient(){
+    	return patient;
+    }
+    
+    private OrganisationUnit organisationUnit;
+    
+    public OrganisationUnit getOrganisationUnit()
+    {
+    	return organisationUnit;
+    }
+    
+    private Integer organisationUnitId;
+    
+    public Integer getOrganisationUnitId(){
+    	return organisationUnitId;
+    }
+
+    private String birthDate;
+    
+    public String getBirthDate()
+    {
+        return birthDate;
+    }
+    
+    private String registrationDate;
+    
+    public String getRegistrationDate(){
+    	return registrationDate;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+       
+    private List<PatientAttributeGroup> attributeGroups;
+    
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+    
+    private Collection<PatientAttribute> noGroupAttributes;
+
+    public Collection<PatientAttribute> getNoGroupAttributes()
+    {
+        return noGroupAttributes;
+    }
+    
+    private String dynForm[];
+    
+    public void setDynForm(String[] dynForm) {
+    	this.dynForm = dynForm;
+    }
+    
+    public String[] getDynForm()
+    {
+    	return dynForm;
+    }
+        
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+    
+	@Override
+	public String execute() {
+		
+		patient = patientService.getPatient(patientId);
+        
+        organisationUnit = patient.getOrganisationUnit();
+        
+        organisationUnitId = organisationUnit.getId();
+        
+        Date date = patient.getBirthDate();
+        SimpleDateFormat DFyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
+        
+        birthDate = DFyyyyMMdd.format(date);
+        
+        date = patient.getRegistrationDate();
+        registrationDate = DFyyyyMMdd.format(date);
+        
+        noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
+
+        attributeGroups = new ArrayList<PatientAttributeGroup>( patientAttributeGroupService
+            .getAllPatientAttributeGroups() );
+        Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+        
+        int size = noGroupAttributes.size();
+        
+        for (PatientAttributeGroup patientAttributeGroup : attributeGroups) {
+        	size += patientAttributeGroup.getAttributes().size();
+        }
+
+        dynForm = new String[size];
+        
+        int i = 0;
+        
+        for (PatientAttributeGroup patientAttributeGroup : attributeGroups) {
+        	List<PatientAttribute> patientAttributeList = patientAttributeGroup.getAttributes();
+        	for(PatientAttribute patientAttribute : patientAttributeList){
+        		PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
+
+        		try{
+        			if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) ){
+        				PatientAttributeOption option = attributeValue.getPatientAttributeOption();
+        				Integer id = option.getId();
+        				dynForm[i] = id.toString();
+        			}else if (attributeValue.getValue().equals("")){
+        				dynForm[i] = "";
+        			}else{
+        				dynForm[i] = attributeValue.getValue();
+        			}
+        		}catch (NullPointerException e){
+        			dynForm[i] = "";
+        		}
+        		i++;
+        	}
+        }
+        
+        for (PatientAttribute patientAttribute : noGroupAttributes){
+    		PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
+
+    		try{
+    			if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) ){
+    				PatientAttributeOption option = attributeValue.getPatientAttributeOption();
+    				Integer id = option.getId();
+    				dynForm[i] = id.toString();
+    			}else if (attributeValue.getValue().equals("")){
+    				dynForm[i] = "";
+    			}else{
+    				dynForm[i] = attributeValue.getValue();
+    			}
+    		}catch (NullPointerException e){
+    			dynForm[i] = "";
+    		}
+    		i++;
+        }
+        
+        
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetBeneficiaryChoicesAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetBeneficiaryChoicesAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetBeneficiaryChoicesAction.java	2011-11-03 11:59:25 +0000
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import org.hisp.dhis.program.ProgramService;
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class GetBeneficiaryChoicesAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+	
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+	
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+	
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+	@Override
+	public String execute() {
+		eventName = programService.getProgram(singleEventId).getName();
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyEditChoicesAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyEditChoicesAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyEditChoicesAction.java	2011-12-02 15:22:44 +0000
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetRecentlyEditChoicesAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+	
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+	
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+	
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return organisationUnitId;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return singleEventId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return eventName;
+    }
+	
+    private Integer patientId;
+    
+    public void setPatientId( Integer patientId )
+    {
+    	this.patientId = patientId;
+    }
+    
+    public Integer getPatientId(){
+    	return patientId;
+    }
+    
+    private Integer instId;
+    
+    public void setInstId( Integer instId )
+    {
+    	this.instId = instId;
+    }
+    
+    public Integer getInstId(){
+    	return instId;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+	@Override
+	public String execute() {
+		eventName = programService.getProgram(singleEventId).getName();
+		return SUCCESS;
+	}
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyRegisteredSingleEventsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyRegisteredSingleEventsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetRecentlyRegisteredSingleEventsAction.java	2011-12-02 15:22:44 +0000
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+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 com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class GetRecentlyRegisteredSingleEventsAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+    
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+    
+    private ProgramInstanceService programInstanceService;
+
+    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+    {
+        this.programInstanceService = programInstanceService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+	
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+	
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+	private List<ProgramInstance> proInst = new ArrayList<ProgramInstance>();
+	
+	public List<ProgramInstance> getProInst() {
+		return this.proInst;
+	}
+    
+	 static final Comparator<ProgramInstance> OrderByDate =
+             new Comparator<ProgramInstance>() {
+		 public int compare(ProgramInstance i1, ProgramInstance i2) {
+			 return i2.getDateOfIncident().compareTo(i1.getDateOfIncident());
+		 }
+	 };
+	
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+	@Override
+	public String execute() {
+		
+		OrganisationUnit org = organisationUnitService.getOrganisationUnit(organisationUnitId);
+		Program pro = programService.getProgram(singleEventId);
+		eventName = pro.getName();
+		
+		proInst.clear();
+		proInst = (List<ProgramInstance>) programInstanceService.getProgramInstances(pro, org);
+		
+		if(!proInst.isEmpty())
+		{
+			Collections.sort(proInst, OrderByDate);
+			if(proInst.size() > 6)
+			{
+				proInst = proInst.subList(0, 6);
+			}
+		}
+		
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSelectOrgUnitSingleEventsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSelectOrgUnitSingleEventsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSelectOrgUnitSingleEventsAction.java	2011-11-26 21:31:43 +0000
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.light.dataentry.utils.FormUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class GetSelectOrgUnitSingleEventsAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+
+	private CurrentUserService currentUserService;
+
+	public void setCurrentUserService(CurrentUserService currentUserService) {
+		this.currentUserService = currentUserService;
+	}
+	
+    private FormUtils formUtils;
+
+    public void setFormUtils( FormUtils formUtils )
+    {
+        this.formUtils = formUtils;
+    }
+
+    public FormUtils getFormUtils()
+    {
+        return formUtils;
+    }
+
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+
+	private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
+
+	public List<OrganisationUnit> getOrganisationUnits() {
+		return organisationUnits;
+	}
+
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+	@Override
+	public String execute() {
+		User user = currentUserService.getCurrentUser();
+
+        if ( user != null )
+        {
+            organisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
+            Collections.sort( organisationUnits, new OrganisationUnitNameComparator() );
+        }
+		
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventChoicesAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventChoicesAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventChoicesAction.java	2011-11-01 18:33:48 +0000
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import org.hisp.dhis.program.ProgramService;
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class GetSingleEventChoicesAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+	
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+	
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+	
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+	@Override
+	public String execute() {
+		eventName = programService.getProgram(singleEventId).getName();
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/GetSingleEventsAction.java	2011-10-30 21:07:19 +0000
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import java.util.Collection;
+import java.util.HashSet;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class GetSingleEventsAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+	
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+	
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+
+	private Collection<Program> singleEvents = new HashSet<Program>();
+	
+	public Collection<Program> getSingleEvents() {
+		return singleEvents;
+	}
+	
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+	@Override
+	public String execute() {
+		boolean singleEvent = true;
+		singleEvents = programService.getPrograms(singleEvent);
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewBeneficiaryAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewBeneficiaryAction.java	2011-12-02 17:30:16 +0000
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class RegisterNewBeneficiaryAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+	
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+    
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+    
+    private PatientAttributeGroupService patientAttributeGroupService;
+
+    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
+    {
+        this.patientAttributeGroupService = patientAttributeGroupService;
+    }
+	
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+	
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+    private List<PatientAttributeGroup> attributeGroups;
+    
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+    
+    private Collection<PatientAttribute> noGroupAttributes;
+
+    public Collection<PatientAttribute> getNoGroupAttributes()
+    {
+        return noGroupAttributes;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+    private String todayDate;
+    
+    public String getTodayDate(){
+    	SimpleDateFormat dateFormatYYYYMMDD = new SimpleDateFormat("yyyy-MM-dd");
+    	Date d = new Date();
+    	todayDate = dateFormatYYYYMMDD.format(d);
+    	return todayDate;
+    }
+    
+	@Override
+	public String execute() {
+		
+        noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
+
+        attributeGroups = new ArrayList<PatientAttributeGroup>( patientAttributeGroupService
+            .getAllPatientAttributeGroups() );
+        Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+		
+		eventName = programService.getProgram(singleEventId).getName();
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewSingleEventAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RegisterNewSingleEventAction.java	2011-12-02 15:22:44 +0000
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+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 com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class RegisterNewSingleEventAction implements Action  {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+    
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        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 OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    // -------------------------------------------------------------------------
+	// Input Output
+	// -------------------------------------------------------------------------   
+    
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId ){
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+    private Integer patientId;
+    
+    public Integer getPatientId(){
+    	return this.patientId;
+    }
+    
+    public void setPatientId(Integer patientId){
+    	this.patientId = patientId;
+    }
+    
+    private Integer instId;
+    
+    public void setInstId( Integer instId )
+    {
+    	this.instId = instId;
+    }
+    
+    public Integer getInstId()
+    {
+    	return this.instId;
+    }
+    
+    private boolean update;
+    
+    public void setUpdate( boolean update )
+    {
+    	this.update = update;
+    }
+    
+    public boolean getUpdate()
+    {
+    	return this.update;
+    }
+    
+    private List<String> dynForm = new ArrayList<String>(100);
+
+    public List<String> getDynForm()
+    {
+    	return dynForm;
+    }
+    
+    private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
+    
+    public ArrayList<ProgramStageDataElement> getProgramStageDataElements(){
+    	return this.programStageDataElements;
+    }
+    
+	 static final Comparator<ProgramStageDataElement> OrderBySortOrder =
+             new Comparator<ProgramStageDataElement>() {
+		 public int compare(ProgramStageDataElement i1, ProgramStageDataElement i2) {
+			 return i1.getSortOrder().compareTo(i2.getSortOrder());
+		 }
+	 };
+    
+
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+    
+	@Override
+	public String execute() {
+
+        // ---------------------------------------------------------------------
+        // Set Data for SingleEventForm
+        // ---------------------------------------------------------------------
+		
+		Program program = programService.getProgram(singleEventId);
+	    eventName = program.getName();
+	    OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit(organisationUnitId);
+        ProgramStage programStage = program.getProgramStages().iterator().next(); // Fetch first, There exists only 1!
+        programStageDataElements = new ArrayList<ProgramStageDataElement>(programStage.getProgramStageDataElements());
+        Collections.sort(programStageDataElements, OrderBySortOrder);
+		
+        dynForm.clear();
+        
+        if(update)
+		{
+			ProgramInstance programInstance = programInstanceService.getProgramInstance(instId);
+			ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance(programInstance, programStage);
+
+			int i = 0;
+			for (ProgramStageDataElement programStageDataElement : programStageDataElements) {
+				dynForm.add(i,patientDataValueService.getPatientDataValue(programStageInstance, programStageDataElement.getDataElement(), organisationUnit).getValue());
+			i++;
+			}
+		}
+
+        return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RenderResultPageAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RenderResultPageAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/RenderResultPageAction.java	2011-12-02 20:27:58 +0000
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.ProgramService;
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class RenderResultPageAction implements Action {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+	
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+    
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+    	this.patientService = patientService;
+    }
+	
+	// -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------
+	
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId(){
+    	return this.organisationUnitId;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+    private Integer patientId;
+    
+    public void  setPatientId( Integer patientId ){
+    	this.patientId = patientId;
+    }
+    
+    private String eventName;
+    
+    public String getEventName(){
+    	return this.eventName;
+    }
+    
+    private String patientName;
+    
+    public String getPatientName(){
+    	return this.patientName;
+    }
+    
+    private String resultString;
+    
+    public void setResultString(String resultString){
+    	this.resultString = resultString;
+    }
+    
+    public String getResultString(){
+    	return this.resultString;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+
+	@Override
+	public String execute() {
+		eventName = programService.getProgram(singleEventId).getName();
+		patientName = patientService.getPatient(patientId).getFullName();
+		return SUCCESS;
+	}
+}

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/UpdateBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/UpdateBeneficiaryAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevents/action/UpdateBeneficiaryAction.java	2011-12-02 22:49:31 +0000
@@ -0,0 +1,725 @@
+/*
+ * Copyright (c) 2004-2011, 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.singleevents.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.math.NumberUtils;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.light.dataentry.utils.FormUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
+import org.hisp.dhis.patient.PatientAttributeOption;
+import org.hisp.dhis.patient.PatientAttributeOptionService;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Group1 Fall 2011
+ */
+public class UpdateBeneficiaryAction implements Action  {
+	
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+		
+    private I18nFormat format;
+    
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+    	this.patientService = patientService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+    
+    private PatientAttributeGroupService patientAttributeGroupService;
+
+    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
+    {
+        this.patientAttributeGroupService = patientAttributeGroupService;
+    }
+    
+    private PatientAttributeOptionService patientAttributeOptionService;
+    
+    public void setPatientAttributeOptionService( PatientAttributeOptionService patientAttributeOptionService )
+    {
+        this.patientAttributeOptionService = patientAttributeOptionService;
+    }
+    
+    private PatientAttributeValueService patientAttributeValueService;
+    
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
+    
+    // -------------------------------------------------------------------------
+	// Input & Output
+	// -------------------------------------------------------------------------   
+    
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+    
+    public Integer getOrganisationUnitId()
+    {
+        return this.organisationUnitId;
+    }
+    
+    private Integer patientId;
+    
+    public void setPatientId( Integer patientId )
+    {
+    	this.patientId = patientId;
+    }
+    
+    private Patient patient;
+    
+    public Patient getPatient()
+    {
+    	return patient;
+    }
+
+    private String fullName;
+    
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+
+    private String birthDate;
+    
+    public void setBirthDate( String birthDate )
+    {
+        this.birthDate = birthDate;
+    }
+    
+    public String getBirthDate()
+    {
+    	return birthDate;
+    }
+
+    private Character dobType;
+    
+    public void setDobType( Character dobType )
+    {
+    	this.dobType = dobType;
+    }
+
+    private String gender;
+    
+    public void setGender( String gender )
+    {
+    	this.gender = gender;
+    }
+
+    private String bloodGroup;
+    
+    public void setBloodGroup( String bloodGroup ){
+    	this.bloodGroup = bloodGroup;
+    }
+    
+    private String registrationDate;
+    
+    public void setRegistrationDate( String registrationDate ){
+    	this.registrationDate = registrationDate;
+    }
+    
+    public String getRegistrationDate()
+    {
+    	return registrationDate;
+    }
+    
+    private List<PatientAttributeGroup> attributeGroups;
+    
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+    
+    private Collection<PatientAttribute> noGroupAttributes;
+
+    public Collection<PatientAttribute> getNoGroupAttributes()
+    {
+        return noGroupAttributes;
+    }
+    
+    private String dynForm[];
+    
+    public void setDynForm(String[] dynForm) {
+    	this.dynForm = dynForm;
+    }
+    
+    public String[] getDynForm()
+    {
+    	return dynForm;
+    }
+    
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+    
+    private Integer singleEventId;
+    
+    public void setSingleEventId( Integer singleEventId){
+    	this.singleEventId = singleEventId;
+    }
+    
+    public Integer getSingleEventId(){
+    	return this.singleEventId;
+    }
+    
+	// -------------------------------------------------------------------------
+	// Validation
+	// -------------------------------------------------------------------------
+    
+    private Date rD,bD;
+    
+    private boolean fullNameIsToLong;
+    private boolean invalidFullName;
+    private boolean invalidRegistrationDate;
+    private boolean invalidBirthDate;
+    private boolean noGender;
+    private boolean noDobType;
+    private boolean invalidDobType;
+    private boolean invalidBloodGroup;
+    private boolean invalidGender;
+    
+	private ArrayList<Validate> validList = new ArrayList<Validate>();
+    
+    public ArrayList<Validate> getValidList()
+    {
+    	return this.validList;
+    }
+    
+    public boolean getFullNameIsToLong()
+    {
+    	return fullNameIsToLong;
+    }
+    
+    public boolean getInvalidFullName()
+    {
+    	return invalidFullName;
+    }
+    
+    public boolean getInvalidRegistrationDate()
+    {
+    	return invalidRegistrationDate;
+    }
+    
+    public boolean getInvalidBirthDate()
+    {
+    	return invalidBirthDate;
+    }
+    
+    public boolean getNoGender()
+    {
+    	return noGender;
+    }
+    
+    public boolean getNoDobType()
+    {
+    	return noDobType;
+    }
+    
+    public boolean getInvalidDobType()
+    {
+    	return invalidDobType;
+    }
+    
+    public boolean getInvalidGender()
+    {
+    	return invalidGender;
+    }
+    
+    public boolean getInvalidBloodGroup()
+    {
+    	return invalidBloodGroup;
+    }
+    
+    private boolean validate()
+    {
+    	boolean valid = true;
+    	
+    	if(validateStringLength(fullName,7,50) == false){
+    		fullNameIsToLong = true;
+    		valid = false;
+    	}
+    	
+    	if(validName(fullName) == false){
+    		invalidFullName = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDateNotNull(rD) == false){
+    		invalidRegistrationDate = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDateNotNull(bD) == false){
+    		invalidBirthDate = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDropDown(gender) == false){
+    		noGender = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDropDown(dobType) == false){
+    		noDobType = true;
+    		valid = false;
+    	}
+    	
+    	if(validateDobType(dobType) == false){
+    		invalidDobType = true;
+    		valid = false;
+    	}
+    	
+    	if(validateGender(gender) == false){
+    		invalidGender = true;
+    		valid = false;
+    	}
+    	
+    	if(validateBloodGroup(bloodGroup) == false){
+    		invalidBloodGroup = true;
+    		valid = false;
+    	}
+    	
+    	return valid;
+    }
+    
+    private boolean validateStringLength(String s, int min, int max)
+    {
+    	return ((s.length() >= min) && (s.length() <= max));
+    }
+    
+    private boolean validName(String s)
+    {
+    	return (s.matches("^[\\p{L}|\\s]*$"));
+    }
+    
+    private boolean validateDateNotNull(Date d){
+    	if(d == null){
+    		return false;
+    	}else{
+    		return true;
+    	}
+    }
+    
+    private boolean validateDropDown(String s){
+    	if(s.equalsIgnoreCase("please_select")){
+    		return false;
+    	}else{
+    		return true;
+    	}
+    }
+    
+    private boolean validateDropDown(Character c){
+    	if(c.equals('p')){
+    		return false;
+    	}else{
+    		return true;
+    	}
+    }
+    
+    private boolean validateDobType(Character c)
+    {
+    	if(c == 'D' || c == 'V'){
+    		return true;
+    	}else{
+    		return false;
+    	}
+    }
+
+    private boolean validateGender(String s)
+    {
+    	if(s.equals("M") || s.equals("F") || s.equals("T")){
+    		return true;
+    	}else{
+    		return false;
+    	}
+    }
+    
+    private boolean validateBloodGroup(String s)
+    {
+    	if(s.matches("^\\w{1,2}\\-?\\+?$") || s.equalsIgnoreCase("please_select")){
+    		return true;
+    	}else{
+    		return false;
+    	}
+    }
+    
+    private boolean validateDynForm(String value, PatientAttribute patientAttribute){
+    	
+    	boolean valid = true;
+    	
+    	String type = patientAttribute.getValueType();
+    	Integer id = patientAttribute.getId();
+    	
+		if(value.isEmpty()){
+			if(patientAttribute.isMandatory()){
+				validList.add(new Validate(id, i18n.getString( "is_required" )));
+				valid = false;
+			}
+		}else if(type.equals("DATE")){
+			if(!FormUtils.isDate( value )) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_date" )));
+				valid = false;
+			}
+		}else if(type.equals("TEXT")){
+			if(!value.matches("^[\\p{L}|\\s|0-9]*$")) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_string" )));
+				valid = false;
+			}
+		}else if(type.equals("NUMBER")){
+			if(!FormUtils.isNumber( value )) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_number" )));
+				valid = false;
+			}
+		}else if(type.equals("YES/NO")){
+			if(!FormUtils.isBoolean( value )) {
+				validList.add(new Validate(id, value+" "+i18n.getString( "is_invalid_boolean" )));
+				valid = false;
+			}
+		}else if(type.equals("COMBO")){
+			Set<PatientAttributeOption> attributeOptions = patientAttribute.getAttributeOptions();
+			boolean contains = false;
+			for(PatientAttributeOption attributeOption : attributeOptions){
+				if(attributeOption.getId() ==  NumberUtils.toInt( value, 0 ) ){	
+					contains = true;
+				}
+			}
+			if(!contains){
+				validList.add(new Validate(id, value));
+			}
+			valid = contains;
+		}
+    	
+    	return valid;
+    }
+    
+	public class Validate {	
+		private Integer _id;
+		private String _errormessage;
+		
+		public String getErrorMessage(){
+			return this._errormessage;
+		}
+		public Integer getId(){
+			return this._id;
+		}
+		
+		public Validate(Integer id, String errormessage)
+		{
+			this._id = id;
+			this._errormessage = errormessage;
+		}
+		
+	}
+    
+	// -------------------------------------------------------------------------
+	// Action Implementation
+	// -------------------------------------------------------------------------
+    
+	@Override
+	public String execute() {
+		
+		fullNameIsToLong = false;
+		invalidFullName = false;
+	    invalidRegistrationDate = false;
+	    invalidBirthDate = false;
+	    noGender = false;
+	    noDobType = false;
+	    invalidDobType = false;
+	    invalidBloodGroup = false;
+	    invalidGender = false;
+		
+		patient = patientService.getPatient(patientId);
+		 
+        // ---------------------------------------------------------------------
+        // Dynamic form
+        // ---------------------------------------------------------------------
+        
+        List<PatientAttributeValue> valuesForSave = new ArrayList<PatientAttributeValue>();
+        List<PatientAttributeValue> valuesForUpdate = new ArrayList<PatientAttributeValue>();
+        Collection<PatientAttributeValue> valuesForDelete = null;
+        
+        noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
+
+        attributeGroups = new ArrayList<PatientAttributeGroup>( patientAttributeGroupService
+            .getAllPatientAttributeGroups() );
+        Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+        
+        patient.getAttributes().clear();
+        valuesForDelete = patientAttributeValueService.getPatientAttributeValues( patient );
+        
+        boolean validInGroup = true;
+        PatientAttributeValue attributeValue = null;
+        validList.clear();
+        int i = 0;
+        
+        //Attributes in groups
+        
+        for (PatientAttributeGroup patientAttributeGroup : attributeGroups) {
+        	List<PatientAttribute> patientAttributeList = patientAttributeGroup.getAttributes();
+        	for(PatientAttribute patientAttribute : patientAttributeList){
+        		       		
+        		String value = dynForm[i];
+        		
+   			 	if(!validateDynForm(value, patientAttribute)){
+   			 		validInGroup = false;
+   			 	}
+    			
+    			if(validInGroup){
+    				
+    				attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
+    				
+                    if ( !patient.getAttributes().contains( patientAttribute ) )
+                    {
+                        patient.getAttributes().add( patientAttribute );
+                    }
+    				
+                    if ( attributeValue == null )
+                    {
+                    	attributeValue = new PatientAttributeValue();
+                    	attributeValue.setPatient( patient );
+                    	attributeValue.setPatientAttribute( patientAttribute );
+                    
+                    	if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) )
+                    	{
+                    		PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value, 0 ) );
+                    		if ( option != null )
+                    		{
+                    			attributeValue.setPatientAttributeOption( option );
+                    			attributeValue.setValue( option.getName() );
+                    		}
+                    	}
+                    	else
+                    	{
+                    		attributeValue.setValue( value.trim() );
+                    	}
+                    	valuesForSave.add( attributeValue );
+                    }else
+                    {
+                    	boolean resetCombo = false;
+                    	if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) )
+                    	{
+                    		PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value, 0 ) );
+                    		if ( option != null )
+                    		{
+                    			attributeValue.setPatientAttributeOption( option );
+                    			attributeValue.setValue( option.getName() );
+                    		}else{
+                    			resetCombo = true;
+                    		}
+                    	}
+                    	else
+                    	{
+                    		attributeValue.setValue( value.trim() );
+                    	}
+                    	valuesForUpdate.add( attributeValue );
+                    	if(!resetCombo){
+                    		valuesForDelete.remove( attributeValue );
+                    	}
+                    }
+    			}
+        		i++;
+        	}
+		}
+        
+        //Attributes not in groups
+        
+        boolean validNoGroup = true;
+        
+        for (PatientAttribute patientAttribute : noGroupAttributes) {
+			String value = dynForm[i];			
+			
+			 if(!validateDynForm(value, patientAttribute)){
+				 validNoGroup = false;
+			 }
+						 
+			if(validNoGroup){
+				attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
+				
+                if ( !patient.getAttributes().contains( patientAttribute ) )
+                {
+                    patient.getAttributes().add( patientAttribute );
+                }
+				
+                if ( attributeValue == null )
+                {
+                	attributeValue = new PatientAttributeValue();
+                	attributeValue.setPatient( patient );
+                	attributeValue.setPatientAttribute( patientAttribute );
+                
+                	if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) )
+                	{
+                		PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value, 0 ) );
+                		if ( option != null )
+                		{
+                			attributeValue.setPatientAttributeOption( option );
+                			attributeValue.setValue( option.getName() );
+                		}
+                	}
+                	else
+                	{
+                		attributeValue.setValue( value.trim() );
+                	}
+                	valuesForSave.add( attributeValue );
+                }else
+                {
+                	boolean resetCombo = false;
+                	if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttribute.getValueType() ) )
+                	{
+                		PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value, 0 ) );
+                		if ( option != null )
+                		{
+                			attributeValue.setPatientAttributeOption( option );
+                			attributeValue.setValue( option.getName() );
+                		}else{
+                			resetCombo = true;
+                		}
+                	}
+                	else
+                	{
+                		attributeValue.setValue( value.trim() );
+                	}
+                	valuesForUpdate.add( attributeValue );
+                	if(!resetCombo){
+                		valuesForDelete.remove( attributeValue );
+                	}
+                }
+			}
+			
+        	i++;
+		}
+        
+		 // ---------------------------------------------------------------------
+        // Set FirstName, MiddleName, LastName by FullName
+        // ---------------------------------------------------------------------
+
+        fullName = fullName.trim();
+
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+
+        String firstName = fullName.toString();
+        String middleName = "";
+        String lastName = "";
+
+        if ( fullName.indexOf( ' ' ) != -1 )
+        {
+            firstName = fullName.substring( 0, startIndex );
+            if ( startIndex == endIndex )
+            {
+                middleName = "";
+                lastName = fullName.substring( startIndex + 1, fullName.length() );
+            }
+            else
+            {
+                middleName = fullName.substring( startIndex + 1, endIndex );
+                lastName = fullName.substring( endIndex + 1, fullName.length() );
+            }
+        }
+        
+        patient.setFirstName( firstName );
+        patient.setMiddleName( middleName );
+        patient.setLastName( lastName );
+        
+        // ---------------------------------------------------------------------
+        // Set Other information for patient
+        // ---------------------------------------------------------------------
+        
+		patient.setGender( gender );		
+		patient.setDobType( dobType );
+		patient.setIsDead( false );
+		if(!bloodGroup.equalsIgnoreCase("please_select")){
+			patient.setBloodGroup( bloodGroup );
+		}
+		
+        birthDate = birthDate.trim();
+        bD = format.parseDate( birthDate );
+        patient.setBirthDate( bD );
+        
+        registrationDate = registrationDate.trim();
+        rD = format.parseDate( registrationDate );
+        patient.setRegistrationDate( rD );
+        
+		if((validate() == false)||(!validNoGroup)||(!validInGroup)){
+			return ERROR;
+		}else{
+			OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );		
+			patient.setOrganisationUnit( organisationUnit );
+			//patientService.updatePatient(patient);
+	        patientService.updatePatient( patient, 0, 0, valuesForSave, valuesForUpdate,valuesForDelete );
+			return SUCCESS;
+		}
+		
+	}
+}

=== 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	2011-11-01 18:28:36 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2011-12-02 16:45:53 +0000
@@ -97,5 +97,87 @@
     <property name="localeManagerInterface" ref="org.hisp.dhis.i18n.locale.LocaleManager" />
     <property name="localeManagerDB" ref="org.hisp.dhis.i18n.locale.LocaleManagerDb" />
   </bean>
+  
+  <!-- Single Events -->
+    
+  <bean id="org.hisp.dhis.light.singleevents.action.GetSelectOrgUnitSingleEventsAction" class="org.hisp.dhis.light.singleevents.action.GetSelectOrgUnitSingleEventsAction">
+    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+    <property name="formUtils" ref="org.hisp.dhis.light.dataentry.utils.FormUtils" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.GetSingleEventsAction" class="org.hisp.dhis.light.singleevents.action.GetSingleEventsAction">
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.GetSingleEventChoicesAction" class="org.hisp.dhis.light.singleevents.action.GetSingleEventChoicesAction">
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.GetBeneficiaryChoicesAction" class="org.hisp.dhis.light.singleevents.action.GetBeneficiaryChoicesAction">
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.RegisterNewBeneficiaryAction" class="org.hisp.dhis.light.singleevents.action.RegisterNewBeneficiaryAction">
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+    <property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
+	<property name="patientAttributeGroupService" ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.light.singleevents.action.GetRecentlyEditChoicesAction" class="org.hisp.dhis.light.singleevents.action.GetRecentlyEditChoicesAction">
+  	<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.light.singleevents.action.AddBeneficiaryAction" class="org.hisp.dhis.light.singleevents.action.AddBeneficiaryAction">
+  	<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+	<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+	<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+	<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
+	<property name="patientAttributeGroupService" ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
+	<property name="patientAttributeOptionService" ref="org.hisp.dhis.patient.PatientAttributeOptionService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.UpdateBeneficiaryAction" class="org.hisp.dhis.light.singleevents.action.UpdateBeneficiaryAction">
+  	<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+	<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+	<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
+	<property name="patientAttributeGroupService" ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
+	<property name="patientAttributeOptionService" ref="org.hisp.dhis.patient.PatientAttributeOptionService" />
+	<property name="patientAttributeValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.EditBeneficiaryAction" class="org.hisp.dhis.light.singleevents.action.EditBeneficiaryAction">
+	<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+	<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
+	<property name="patientAttributeGroupService" ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
+	<property name="patientAttributeValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.AddSingleEventAction" class="org.hisp.dhis.light.singleevents.action.AddSingleEventAction">
+   <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+   <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+   <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="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.GetRecentlyRegisteredSingleEventsAction" class="org.hisp.dhis.light.singleevents.action.GetRecentlyRegisteredSingleEventsAction">
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+    <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.RegisterNewSingleEventAction" class="org.hisp.dhis.light.singleevents.action.RegisterNewSingleEventAction">
+    <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+    <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+    <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.light.singleevents.action.RenderResultPageAction" class="org.hisp.dhis.light.singleevents.action.RenderResultPageAction">
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+    <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+  </bean>
 
 </beans>

=== 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	2011-10-27 17:40:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2011-12-06 22:23:13 +0000
@@ -36,3 +36,62 @@
 validation_rule_violation_warnings = Validation Rule Violation Warnings
 minmax_violation_warnings = Min/Max Violation Warnings
 type_violation_errors = Type Violation Errors
+
+# Single events
+
+edit_beneficiary = Edit Beneficiary
+find_benecifiary = Find beneficiary
+new_beneficiary= New beneficiary
+single_events = Single Events
+single_event = Single Event
+back = Back
+date_of_registration = Date of Registration (yyyy-MM-dd)
+date_of_birth = Date of Birth (yyyy-MM-dd)
+full_name = Full Name
+gender = Gender
+select_gender = please select a gender
+select_dob = please select a DOB type
+please_select = [Please Select]
+male = Male
+female = Female
+transgender = Transgender
+dob_type = DOB type
+verified = Verified
+declared = Declared
+blood_group = Blood Group
+bg_a_pluss = A+
+bg_a_minus = A-
+bg_b_pluss = B+
+bg_b_minus = B-
+bg_o_pluss = O+
+bg_o_minus = O-
+bg_ab_pluss = AB+
+bg_ab_minus = AB-
+recently_registered = Recently Registered
+recently_registered_options = Recently Registered options
+edit_person_details = Edit Person Details
+edit_single_event_details = Edit Single Event Details
+register = Register
+register_new_single_event = Register a new single event
+available_single_events = Available single events
+result = Result
+submit = Submit
+single_event_options = Single Event options
+beneficiary_options = Beneficiary options
+yes = Yes
+no = No
+registered_to_beneficiary = registered to beneficiary
+beneficiary = Beneficiary
+was_updated = was updated
+was_added_to_beneficiary = was added to beneficiary
+
+# validation messages
+
+is_invalid_string = is not a valid string
+is_required = is a required field
+
+is_invalid_name_length = the name must be between 7 and 50 characters
+is_invalid_name = is not a valid name
+is_invalid_gender = is not a valid gender
+is_invalid_dob_type = is not a valid dob type
+is_invalid_blood_group = is not a valid blood group

=== 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	2011-11-01 15:01:22 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2011-12-06 22:23:13 +0000
@@ -90,6 +90,76 @@
     <action name="saveSettingsForm" class="org.hisp.dhis.light.action.settings.action.SaveSettingsFormAction">
       <result name="success" type="redirect">/mobile/index.action</result>
     </action>
+    
+    <!-- Single Events -->
+	
+	<action name="selectOrgUnitSingleEvents" class="org.hisp.dhis.light.singleevents.action.GetSelectOrgUnitSingleEventsAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/selectOrgUnitSingleEvents.vm</param>
+    </action>
+    
+    <action name="singleEvents" class="org.hisp.dhis.light.singleevents.action.GetSingleEventsAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/singleEvents.vm</param>
+    </action>
+    
+    <action name="getSingleEventChoices" class="org.hisp.dhis.light.singleevents.action.GetSingleEventChoicesAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/singleEventChoices.vm</param>
+    </action>
+    
+    <action name="getBeneficiaryChoices" class="org.hisp.dhis.light.singleevents.action.GetBeneficiaryChoicesAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/beneficiaryChoices.vm</param>
+    </action>
+    
+    <action name="registerNewBeneficiary" class="org.hisp.dhis.light.singleevents.action.RegisterNewBeneficiaryAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/newBeneficiary.vm</param>
+    </action>
+	
+	<action name="addBeneficiary" class="org.hisp.dhis.light.singleevents.action.AddBeneficiaryAction">
+      <result name="success" type="redirect">/mobile/newSingleEvent.action?organisationUnitId=${organisationUnitId}&amp;patientId=${patientId}&amp;singleEventId=${singleEventId}&amp;update=false&amp;resultString=newSingleEvent</result>
+      <result name="error" type="velocity">/dhis-web-light/main.vm</result>
+	  <param name="page">/dhis-web-light/singleevents/newBeneficiary.vm</param>
+	</action>
+	
+	<action name="newSingleEvent" class="org.hisp.dhis.light.singleevents.action.RegisterNewSingleEventAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/newSingleEvent.vm</param>
+    </action>
+	
+    <action name="addSingleEvent" class="org.hisp.dhis.light.singleevents.action.AddSingleEventAction">
+      <result name="success" type="redirect">/mobile/resultPage.action?organisationUnitId=${organisationUnitId}&amp;patientId=${patientId}&amp;singleEventId=${singleEventId}&amp;resultString=${resultString}</result>
+      <result name="error" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/newSingleEvent.vm</param>
+    </action>
+    
+   	<action name="resultPage" class="org.hisp.dhis.light.singleevents.action.RenderResultPageAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/singleEventResultPage.vm</param>
+    </action>
+    
+    <action name="updateBeneficiary" class="org.hisp.dhis.light.singleevents.action.UpdateBeneficiaryAction">
+      <result name="success" type="redirect">/mobile/resultPage.action?organisationUnitId=${organisationUnitId}&amp;patientId=${patient.getId()}&amp;singleEventId=${singleEventId}&amp;resultString=updateBeneficiary</result>
+      <result name="error" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/editBeneficiary.vm</param>
+    </action>
+    
+    <action name="editBeneficiary" class="org.hisp.dhis.light.singleevents.action.EditBeneficiaryAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/editBeneficiary.vm</param>
+    </action>
+    
+    <action name="GetRecentlyRegisteredSingleEvents" class="org.hisp.dhis.light.singleevents.action.GetRecentlyRegisteredSingleEventsAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/recentlyRegisteredSingleEvents.vm</param>
+    </action>
+    
+    <action name="EditRecentlyRegistered" class="org.hisp.dhis.light.singleevents.action.GetRecentlyEditChoicesAction">
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/singleevents/recentlyEditChoices.vm</param>
+    </action>
 
   </package>
-</struts>
\ No newline at end of file
+</struts>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm	2011-10-14 11:42:11 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm	2011-12-06 22:23:13 +0000
@@ -8,6 +8,13 @@
 </ul>
 </p>
 
+<h2>Experimental</h2>
+<p>
+<ul>
+    <li><a href="selectOrgUnitSingleEvents.action">$i18n.getString( "single_events" )</a></li>
+</ul>
+</p>
+
 <div id="footer">
 <h2>$i18n.getString( "navigate_to" )</h2>
 <ul>

=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents'
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/beneficiaryChoices.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/beneficiaryChoices.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/beneficiaryChoices.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,21 @@
+
+<h2>$i18n.getString("single_event"): $eventName</h2>
+
+<p>
+<ul>
+	<li>$i18n.getString("find_beneficiary")</li>
+	<li>
+		<a href="registerNewBeneficiary.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">
+		$i18n.getString("new_beneficiary")
+		</a>
+	</li>
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="getSingleEventChoices.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">$i18n.getString("single_event_options")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/editBeneficiary.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/editBeneficiary.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/editBeneficiary.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,259 @@
+
+<h2>$i18n.getString("edit_beneficiary")</h2>
+
+<form method="post" action="updateBeneficiary.action">
+	<div class="header-box" align="center">
+		<p style="text-align: left;">
+		
+			<input type="hidden" name="organisationUnitId" value="$organisationUnitId" />
+			<input type="hidden" name="singleEventId" value="$singleEventId" />
+			<input type="hidden" name="patientId" value="$patientId" />
+		
+	    	
+	    	#if ( $invalidRegistrationDate )
+	    		<label>$i18n.getString("date_of_registration") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!registrationDate $i18n.getString("is_invalid_date")
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("date_of_registration") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+	    	<input type="date" maxlength="255" size="24" name="registrationDate" value="$registrationDate" />
+	    	
+	    	#if ( $fullNameIsToLong )
+	    		<label>$i18n.getString("full_name") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$i18n.getString("is_invalid_name_length")
+	    		</label>
+	    	#elseif( $invalidFullName )
+	    		<label>$i18n.getString("full_name") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!patient.getFullName() $i18n.getString("is_invalid_name")
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("full_name") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+	    	<input type="text" maxlength="255" size="24" name="fullName" value="$patient.getFullName()" />
+	    	
+	    	
+	    	#if ( $noGender )
+	    		<label>$i18n.getString("gender") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$i18n.getString("is_required")
+	    		</label>
+	    	#elseif ( $invalidGender )
+	    		<label>$i18n.getString("gender") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!patient.getGender() $i18n.getString("is_invalid_gender")
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("gender") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+	    	<br />    	
+	    	<select name="gender">
+	    		<option value="please_select">$i18n.getString("please_select")</option>
+	    		
+	    		#if ($patient.getGender() == "M")
+					<option value="M" selected="selected">$i18n.getString("male")</option>
+				#else
+					<option value="M">$i18n.getString("male")</option>
+				#end
+				
+				#if ($patient.getGender() == "F")
+					<option value="F" selected="selected">$i18n.getString("female")</option>
+				#else
+					<option value="F">$i18n.getString("female")</option>
+				#end
+				
+				#if ($patient.getGender() == "T")
+					<option value="T" selected="selected">$i18n.getString("transgender")</option>
+				#else
+					<option value="T">$i18n.getString("transgender")</option>
+				#end
+				
+			</select>
+			
+			<br />
+			
+			#if ( $noDobType )
+				<label>$i18n.getString("dob_type") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+				<label style="color:red;">
+					$i18n.getString("is_required")
+				</label>
+			#elseif ( $invalidDobType )
+				<label>$i18n.getString("dob_type") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+				<label style="color:red;">
+					$!patient.getDobType() $i18n.getString("is_invalid_dob_type")
+				</label>
+			#else
+				<label>$i18n.getString("dob_type") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+			#end					
+			<br />
+			<select name="dobType">
+				<option value="p">$i18n.getString("please_select")</option>
+				
+				#if ($patient.getDobType() == "V")
+					<option value="V" selected="selected">$i18n.getString("verified")</option>
+				#else
+					<option value="V">$i18n.getString("verified")</option>
+				#end
+				
+				#if ($patient.getDobType() == "D")
+					<option value="D" selected="selected">$i18n.getString("declared")</option>
+				#else
+					<option value="D">$i18n.getString("declared")</option>
+				#end
+				
+			</select>
+			
+			<br />
+			
+			#if ( $invalidBirthDate )
+				<label>$i18n.getString("date_of_birth") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!birthDate $i18n.getString("is_invalid_date")</label>
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("date_of_birth") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+			<input type="date" maxlength="255" size="24" name="birthDate" value="$birthDate" />
+			
+			#if ( $invalidBloodGroup )
+				<label>$i18n.getString("blood_group")</label>
+	    		<label style="color:red;">
+	    			$!patient.getBloodGroup() $i18n.getString("is_invalid_blood_group")
+	    		</label>
+	    	#else
+				<label>$i18n.getString("blood_group")</label>
+			#end
+			<br />
+			<select name="bloodGroup">
+				<option value="please_select">$i18n.getString("please_select")</option>
+				
+				#if ($patient.getBloodGroup() == "A+")
+					<option value="A+" selected="selected">$i18n.getString("bg_a_pluss")</option>
+				#else
+					<option value="A+">$i18n.getString("bg_a_pluss")</option>
+				#end
+				
+				#if ($patient.getBloodGroup() == "A-")
+					<option value="A-" selected="selected">$i18n.getString("bg_a_minus")</option>
+				#else
+					<option value="A-">$i18n.getString("bg_a_minus")</option>
+				#end
+
+				#if ($patient.getBloodGroup() == "AB+")
+					<option value="AB+" selected="selected">$i18n.getString("bg_ab_pluss")</option>
+				#else
+					<option value="AB+">$i18n.getString("bg_ab_pluss")</option>
+				#end
+				
+				#if ($patient.getBloodGroup() == "AB-")
+					<option value="AB-" selected="selected">$i18n.getString("bg_ab_minus")</option>
+				#else
+					<option value="AB-">$i18n.getString("bg_ab_minus")</option>
+				#end
+				
+				#if ($patient.getBloodGroup() == "B+")
+					<option value="B+" selected="selected">$i18n.getString("bg_b_pluss")</option>
+				#else
+					<option value="B+">$i18n.getString("bg_b_pluss")</option>
+				#end
+				
+				#if ($patient.getBloodGroup() == "B-")
+					<option value="B-" selected="selected">$i18n.getString("bg_b_minus")</option>
+				#else
+					<option value="B-">$i18n.getString("bg_b_minus")</option>
+				#end
+				
+				#if ($patient.getBloodGroup() == "O+")
+					<option value="O+" selected="selected">$i18n.getString("bg_o_pluss")</option>
+				#else
+					<option value="O+">$i18n.getString("bg_o_pluss")</option>
+				#end
+				
+				#if ($patient.getBloodGroup() == "O-")
+					<option value="O-" selected="selected">$i18n.getString("bg_o_minus")</option>
+				#else
+					<option value="O-">$i18n.getString("bg_o_minus")</option>
+				#end
+				
+			</select>
+			
+			<br />
+			
+						#set( $i = 0 )
+			<!-- ATTRIBUTES IN GROUPS -->
+			
+			#foreach ($attributeGroup in $attributeGroups )
+
+				#foreach($attribute in $attributeGroup.attributes )
+
+					<label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" style="color:red;">*</em> #end</label>
+					#foreach( $validate in $validList )				
+						#if($attribute.id == $validate.id)<label style="color:red;"> $validate.getErrorMessage() </label> #end
+					#end
+					#if( $attribute.valueType == "YES/NO" )
+						<select name="dynForm"> 
+							<option value="" >$i18n.getString( "please_select" )</option>           
+							<option value="true" #if($!dynForm[$i] == "true") selected="selected" #end >$i18n.getString( "yes" )</option>
+							<option value="false" #if($!dynForm[$i] == "false") selected="selected" #end >$i18n.getString( "no" )</option>
+						</select> 
+					#elseif( $attribute.valueType == "DATE" )
+						<input type="date" maxlength="255" size="24" name="dynForm" value="$!dynForm[$i]" />
+					#elseif( $attribute.valueType == "COMBO" )
+							<select name="dynForm">
+								<option value="">$i18n.getString( "please_select" )</option>
+								#foreach ($option in $attribute.attributeOptions )
+									<option value="$option.id" #if($!dynForm[$i] == $option.id) selected="selected" #end >$option.name</option>
+								#end
+							</select>
+					#else 
+					<input type="text"  maxlength="255" size="24" name="dynForm"  value="$!dynForm[$i]"/>
+					#end
+					#set( $i = $i + 1)
+				#end
+				
+			#end
+			
+			<!-- ATTRIBUTES NOT IN GROUPS -->
+			
+			#foreach($attribute in $noGroupAttributes )
+
+				<label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" style="color:red;">*</em> #end</label>
+				#foreach( $validate in $validList )				
+					#if($attribute.id == $validate.id)<label style="color:red;"> $validate.getErrorMessage() </label> #end
+				#end
+				#if( $attribute.valueType == "YES/NO" )
+					<select name="dynForm"> 
+						<option value="" >$i18n.getString( "please_select" )</option>           
+						<option value="true" #if($!dynForm[$i] == "true") selected="selected" #end >$i18n.getString( "yes" )</option>
+						<option value="false" #if($!dynForm[$i] == "false") selected="selected" #end >$i18n.getString( "no" )</option>
+					</select> 
+				#elseif( $attribute.valueType == "DATE" )
+					<input type="date" maxlength="255" size="24" name="dynForm" value="$!dynForm[$i]" />
+				#elseif( $attribute.valueType == "COMBO" )
+						<select name="dynForm">
+							<option value="">$i18n.getString( "please_select" )</option>
+							#foreach ($option in $attribute.attributeOptions )
+								<option value="$option.id" #if($!dynForm[$i] == $option.id) selected="selected" #end >$option.name</option>
+							#end
+						</select>
+				#else 
+					<input type="text"  maxlength="255" size="24" name="dynForm"  value="$!dynForm[$i]"/>
+				#end
+				#set( $i = $i + 1)
+			#end
+			
+			<input type="submit" value="$i18n.getString("submit")" />
+	    </p>
+	</div>
+</form>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="EditRecentlyRegistered.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId&patientId=$patientId">$i18n.getString("recently_registered_options")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newBeneficiary.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newBeneficiary.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newBeneficiary.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,271 @@
+
+<h2>$i18n.getString("single_event"): $eventName</h2>
+
+<form method="post" action="addBeneficiary.action">
+	<div class="header-box" align="center">
+		<p style="text-align: left;">
+		
+			<input type="hidden" name="organisationUnitId" value="$organisationUnitId" />
+			<input type="hidden" name="singleEventId" value="$singleEventId" />
+		
+	    	#if ( $invalidRegistrationDate )
+	    		<label>$i18n.getString("date_of_registration") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!registrationDate $i18n.getString("is_invalid_date")
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("date_of_registration") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+	    	#if($registrationDate)
+	    		<input type="date" maxlength="255" size="24" name="registrationDate" value="$registrationDate" />
+	    	#else
+	    		<input type="date" maxlength="255" size="24" name="registrationDate" value="" />
+	    	#end
+	    	
+	    	#if ( $fullNameIsToLong )
+	    		<label>$i18n.getString("full_name") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$i18n.getString("is_invalid_name_length")
+	    		</label>
+	    	#elseif( $invalidFullName )
+	    		<label>$i18n.getString("full_name") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!fullName $i18n.getString("is_invalid_name")
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("full_name") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+	    	#if ($fullName)
+		    	<input type="text" maxlength="255" size="24" name="fullName" value="$fullName" />
+	    	#else
+	    		<input type="text" maxlength="255" size="24" name="fullName" value="" />
+	    	#end
+	    	
+	    	#if ( $noGender )
+	    		<label>$i18n.getString("gender") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$i18n.getString("is_required")
+	    		</label>
+	    	#elseif ( $invalidGender )
+	    		<label>$i18n.getString("gender") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!gender $i18n.getString("is_invalid_gender")
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("gender") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+	    	<br />    	
+	    	<select name="gender">
+	    		<option value="please_select">$i18n.getString("please_select")</option>
+	    		
+	    		#if ($gender == "M")
+					<option value="M" selected="selected">$i18n.getString("male")</option>
+				#else
+					<option value="M">$i18n.getString("male")</option>
+				#end
+				
+				#if ($gender == "F")
+					<option value="F" selected="selected">$i18n.getString("female")</option>
+				#else
+					<option value="F">$i18n.getString("female")</option>
+				#end
+				
+				#if ($gender == "T")
+					<option value="T" selected="selected">$i18n.getString("transgender")</option>
+				#else
+					<option value="T">$i18n.getString("transgender")</option>
+				#end
+				
+			</select>
+			
+			<br />
+			
+			#if ( $noDobType )
+				<label>$i18n.getString("dob_type") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+				<label style="color:red;">
+					$i18n.getString("is_required")
+				</label>
+			#elseif ( $invalidDobType )
+				<label>$i18n.getString("dob_type") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+				<label style="color:red;">
+					$!dobType $i18n.getString("is_invalid_dob_type")
+				</label>
+			#else
+				<label>$i18n.getString("dob_type") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+			#end
+			<br />
+			<select name="dobType">
+				<option value="p">$i18n.getString("please_select")</option>
+				
+				#if ($dobType == "V")
+					<option value="V" selected="selected">$i18n.getString("verified")</option>
+				#else
+					<option value="V">$i18n.getString("verified")</option>
+				#end
+				
+				#if ($dobType == "D")
+					<option value="D" selected="selected">$i18n.getString("declared")</option>
+				#else
+					<option value="D">$i18n.getString("declared")</option>
+				#end
+				
+			</select>
+			 
+			<br />
+			
+			#if ( $invalidBirthDate )
+				<label>$i18n.getString("date_of_birth") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    		<label style="color:red;">
+	    			$!birthDate $i18n.getString("is_invalid_date")</label>
+	    		</label>
+	    	#else
+	    		<label>$i18n.getString("date_of_birth") <em title="$i18n.getString( 'required' )" style="color:red;">*</em></label>
+	    	#end
+	    	#if($birthDate)
+				<input type="date" maxlength="255" size="24" name="birthDate" value="$birthDate"/>
+			#else
+				<input type="date" maxlength="255" size="24" name="birthDate" value=""/>
+			#end
+			
+			#if ( $invalidBloodGroup )
+				<label>$i18n.getString("blood_group")</label>
+	    		<label style="color:red;">
+	    			$!bloodGroup $i18n.getString("is_invalid_blood_group")
+	    		</label>
+	    	#else
+				<label>$i18n.getString("blood_group")</label>
+			#end
+			<br />
+			<select name="bloodGroup">
+				<option value="please_select">$i18n.getString("please_select")</option>
+				
+				#if ($bloodGroup == "A+")
+					<option value="A+" selected="selected">$i18n.getString("bg_a_pluss")</option>
+				#else
+					<option value="A+">$i18n.getString("bg_a_pluss")</option>
+				#end
+				
+				#if ($bloodGroup == "A-")
+					<option value="A-" selected="selected">$i18n.getString("bg_a_minus")</option>
+				#else
+					<option value="A-">$i18n.getString("bg_a_minus")</option>
+				#end
+
+				#if ($bloodGroup == "AB+")
+					<option value="AB+" selected="selected">$i18n.getString("bg_ab_pluss")</option>
+				#else
+					<option value="AB+">$i18n.getString("bg_ab_pluss")</option>
+				#end
+				
+				#if ($bloodGroup == "AB-")
+					<option value="AB-" selected="selected">$i18n.getString("bg_ab_minus")</option>
+				#else
+					<option value="AB-">$i18n.getString("bg_ab_minus")</option>
+				#end
+				
+				#if ($bloodGroup == "B+")
+					<option value="B+" selected="selected">$i18n.getString("bg_b_pluss")</option>
+				#else
+					<option value="B+">$i18n.getString("bg_b_pluss")</option>
+				#end
+				
+				#if ($bloodGroup == "B-")
+					<option value="B-" selected="selected">$i18n.getString("bg_b_minus")</option>
+				#else
+					<option value="B-">$i18n.getString("bg_b_minus")</option>
+				#end
+				
+				#if ($bloodGroup == "O+")
+					<option value="O+" selected="selected">$i18n.getString("bg_o_pluss")</option>
+				#else
+					<option value="O+">$i18n.getString("bg_o_pluss")</option>
+				#end
+				
+				#if ($bloodGroup == "O-")
+					<option value="O-" selected="selected">$i18n.getString("bg_o_minus")</option>
+				#else
+					<option value="O-">$i18n.getString("bg_o_minus")</option>
+				#end
+				
+			</select>
+			
+			<br />
+			
+			
+			#set( $i = 0 )
+			<!-- ATTRIBUTES IN GROUPS -->
+			
+			#foreach ($attributeGroup in $attributeGroups )
+
+				#foreach($attribute in $attributeGroup.attributes )
+
+					<label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" style="color:red;">*</em> #end</label>
+					#foreach( $validate in $validList )				
+						#if($attribute.id == $validate.id)<label style="color:red;"> $validate.getErrorMessage() </label> #end
+					#end
+					#if( $attribute.valueType == "YES/NO" )
+						<select name="dynForm"> 
+							<option value="" >$i18n.getString( "please_select" )</option>           
+							<option value="true" #if($!dynForm[$i] == "true") selected="selected" #end >$i18n.getString( "yes" )</option>
+							<option value="false" #if($!dynForm[$i] == "false") selected="selected" #end >$i18n.getString( "no" )</option>
+						</select> 
+					#elseif( $attribute.valueType == "DATE" )
+						<input type="date" maxlength="255" size="24" name="dynForm" value="$!dynForm[$i]" />
+					#elseif( $attribute.valueType == "COMBO" )
+							<select name="dynForm">
+								<option value="">$i18n.getString( "please_select" )</option>
+								#foreach ($option in $attribute.attributeOptions )
+									<option value="$option.id" #if($!dynForm[$i] == $option.id) selected="selected" #end >$option.name</option>
+								#end
+							</select>
+					#else 
+					<input type="text"  maxlength="255" size="24" name="dynForm"  value="$!dynForm[$i]"/>
+					#end
+					#set( $i = $i + 1)
+				#end
+				
+			#end
+			
+			<!-- ATTRIBUTES NOT IN GROUPS -->
+			
+			#foreach($attribute in $noGroupAttributes )
+
+				<label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" style="color:red;">*</em> #end</label>
+				#foreach( $validate in $validList )				
+					#if($attribute.id == $validate.id)<label style="color:red;"> $validate.getErrorMessage() </label> #end
+				#end
+				#if( $attribute.valueType == "YES/NO" )
+					<select name="dynForm"> 
+						<option value="" >$i18n.getString( "please_select" )</option>           
+						<option value="true" #if($!dynForm[$i] == "true") selected="selected" #end >$i18n.getString( "yes" )</option>
+						<option value="false" #if($!dynForm[$i] == "false") selected="selected" #end >$i18n.getString( "no" )</option>
+					</select> 
+				#elseif( $attribute.valueType == "DATE" )
+					<input type="date" maxlength="255" size="24" name="dynForm" value="$!dynForm[$i]" />
+				#elseif( $attribute.valueType == "COMBO" )
+						<select name="dynForm">
+							<option value="">$i18n.getString( "please_select" )</option>
+							#foreach ($option in $attribute.attributeOptions )
+								<option value="$option.id" #if($!dynForm[$i] == $option.id) selected="selected" #end >$option.name</option>
+							#end
+						</select>
+				#else 
+					<input type="text"  maxlength="255" size="24" name="dynForm"  value="$!dynForm[$i]"/>
+				#end
+				#set( $i = $i + 1)
+			#end
+			
+			<input type="submit" value="$i18n.getString("submit")" />
+	    </p>
+	</div>
+</form>
+
+
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="getBeneficiaryChoices.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">$i18n.getString("beneficiary_options")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newSingleEvent.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newSingleEvent.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/newSingleEvent.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,54 @@
+<h2>Single Event: $eventName</h2>
+
+<form method="post" action="addSingleEvent.action">
+	<div class="header-box" align="center">
+		<p style="text-align: left;">
+		
+		#set( $i = 0 )
+		#foreach( $element in $programStageDataElements )
+
+				<label>$element.getDataElement().getName() #if($element.getDataElement().getType() == "date") (yyyy-mm-dd) #end</label>
+				
+				#foreach( $validate in $validList )				
+					#if($element.getDataElement().getId() == $validate.id)<label style="color:red;"> $validate.getErrorMessage() </label> #end
+				#end
+	
+				#if ($element.getDataElement().getType() == "bool")
+					<br />
+			    	<select name="dynForm">
+					<option value="please_select">$i18n.getString("please_select")</option>
+					<option value="true" #if($dynForm.isEmpty() == false) #if($!dynForm.get($i) == "true") selected="selected" #end #end >$i18n.getString("Yes")</option>
+					<option value="false" #if($dynForm.isEmpty() == false) #if($!dynForm.get($i) == "false") selected="selected" #end #end >$i18n.getString("No")</option>
+					</select>
+					<br />
+				#elseif ($element.getDataElement().getType() == "date")
+					<input type="date" maxlength="255" size="24" name="dynForm" value="#if($dynForm.isEmpty() == false)$!dynForm.get($i)#end" />
+				#else
+					<input type="text" maxlength="255" size="24" name="dynForm" value="#if($dynForm.isEmpty() == false)$!dynForm.get($i)#end" />
+				#end
+				#set( $i = $i + 1)
+		#end
+		
+		<input type="hidden" name="organisationUnitId" value="$organisationUnitId" />
+		<input type="hidden" name="singleEventId" value="$singleEventId" />
+		<input type="hidden" name="patientId" value="$patientId" />
+		<input type="hidden" name="update" value="$update" />
+		<input type="hidden" name="instId" value="$instId" />
+
+		<input type="submit" value=$i18n.getString("Submit") />
+	    </p>
+	</div>
+</form>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	#if($update) 
+		<li><a href="EditRecentlyRegistered.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId&patientId=$patientId&instId=$instId">
+		$i18n.getString("recently_registered_options")
+		</a>
+		</li>
+	#end
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyEditChoices.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyEditChoices.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyEditChoices.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,25 @@
+
+<h2>$i18n.getString("recently_registered"): $eventName</h2>
+
+<p>
+<ul>
+		<li>
+			<a href="editBeneficiary.action?patientId=$patientId&singleEventId=$singleEventId">
+				$i18n.getString("edit_person_details")
+			</a>
+		</li>
+		<li>
+			<a href="newSingleEvent.action?organisationUnitId=${organisationUnitId}&amp;patientId=${patientId}&amp;singleEventId=${singleEventId}&amp;instId=${instId}&amp;update=true">
+				$i18n.getString("edit_single_event_details")
+			</a>
+		</li>
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="GetRecentlyRegisteredSingleEvents.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">$i18n.getString("recently_registered")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyRegisteredSingleEvents.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyRegisteredSingleEvents.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/recentlyRegisteredSingleEvents.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,21 @@
+
+<h2>$i18n.getString("recently_registered"): $eventName</h2>
+
+<p>
+<ul>
+#foreach( $instance in $proInst )
+		<li><a href="EditRecentlyRegistered.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId&patientId=$instance.getPatient().getId()&instId=$instance.getId()">
+		$instance.getPatient().getFullName()
+		</a>
+		</li>
+#end
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="getSingleEventChoices.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">$i18n.getString("single_event_options")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/selectOrgUnitSingleEvents.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/selectOrgUnitSingleEvents.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/selectOrgUnitSingleEvents.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,35 @@
+
+<h2>$i18n.getString( "available_organisation_units" )</h2>
+
+<p>
+<ul>
+#foreach( $organisationUnit in $organisationUnits )
+	#if( $organisationUnit.children.size() == 0 && $organisationUnit.dataSets.size() > 0 )
+		<li><a href="singleEvents.action?organisationUnitId=$organisationUnit.id">$!encoder.htmlEncode( ${organisationUnit.name} )</a></li>
+	#else
+		#if( $organisationUnit.children.size() > 0 )
+			#set( $children = $formUtils.organisationUnitWithDataSetsFilter( $organisationUnit.children ) )
+
+			#if( $organisationUnit.dataSets.size() > 0 )
+				<li><a href="singleEvents.action?organisationUnitId=$organisationUnit.id">$!encoder.htmlEncode( ${organisationUnit.name} )</a></li>
+			#else
+				<li>$!encoder.htmlEncode( ${organisationUnit.name} )</a></li>
+			#end
+
+			#foreach( $child in $children )
+				<li>- <a href="singleEvents.action?organisationUnitId=$child.id">$!encoder.htmlEncode( ${child.name} )</a></li>
+			#end
+		#end
+	#end
+#end
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
+
+

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventChoices.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventChoices.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventChoices.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,21 @@
+<h2>$i18n.getString("single_event"): $eventName</h2>
+
+<p>
+<ul>
+	<li>
+		<a href="getBeneficiaryChoices.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">$i18n.getString("register") $eventName</a>
+	</li>
+	<li>
+		<a href="GetRecentlyRegisteredSingleEvents.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">
+		$i18n.getString("recently_registered")</a>
+	</li>
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="singleEvents.action?organisationUnitId=$organisationUnitId">$i18n.getString("available_single_events")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventResultPage.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventResultPage.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEventResultPage.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,26 @@
+<h2>$i18n.getString( "result" )</h2>
+
+<p>
+	<ul>
+		#if($resultString == "updateSingleEvent")
+			$i18n.getString("single_event") $eventName $i18n.getString("registered_to_beneficiary") $patientName $i18n.getString("was_updated").
+		#elseif($resultString == "updateBeneficiary")
+			$i18n.getString("beneficiary") $patientName $i18n.getString("was_updated").
+		#elseif($resultString == "newSingleEvent")
+			$i18n.getString("single_event") $eventName $i18n.getString("was_added_to_beneficiary") $patientName.
+		#end
+		
+	</ul>
+</p>
+
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="GetRecentlyRegisteredSingleEvents.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">
+	$i18n.getString("recently_registered")</a></li>
+	<li><a href="getBeneficiaryChoices.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEventId">
+	$i18n.getString("register_new_single_event")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEvents.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEvents.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevents/singleEvents.vm	2011-12-06 22:23:13 +0000
@@ -0,0 +1,22 @@
+
+<h2>$i18n.getString("available_single_events")</h2>
+
+<p>
+<ul>
+#foreach( $singleEvent in $singleEvents )
+		<li>
+			<a href="getSingleEventChoices.action?organisationUnitId=$organisationUnitId&singleEventId=$singleEvent.getId()">
+				$singleEvent.getName()
+			</a>
+		</li>
+#end
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="selectOrgUnitSingleEvents.action">$i18n.getString("available_organisation_units")</a></li>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>