dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16858
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6531: Add mobile web-browser name-based tracking and beneficiary registration
------------------------------------------------------------
revno: 6531
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Tue 2012-04-10 13:49:47 +0700
message:
Add mobile web-browser name-based tracking and beneficiary registration
added:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/GetBeneficiaryRegistrationOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryDetailAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryListAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetNamebasedOrganisationUnitsAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryDetail.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryList.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryRegistrationForm.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programStageForm.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectActivity.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectActivityType.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectNamebasedOrganisationUnits.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectRegistrationOrganisationUnits.vm
modified:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java
dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties
dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2011-11-04 11:27:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2012-04-10 06:49:47 +0000
@@ -39,7 +39,10 @@
public ActivityPlan getCurrentActivityPlan( OrganisationUnit unit, String localeString );
- public ActivityPlan getActivitiesByIdentifier( String keyword ) throws NotAllowedException;
+ public ActivityPlan getAllActivityPlan( OrganisationUnit unit, String localeString );
+
+ public ActivityPlan getActivitiesByIdentifier( String keyword )
+ throws NotAllowedException;
public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue )
throws NotAllowedException;
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2012-03-22 14:17:16 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2012-04-10 06:49:47 +0000
@@ -109,6 +109,7 @@
private org.hisp.dhis.patient.PatientAttribute groupByAttribute;
+ @Override
public ActivityPlan getCurrentActivityPlan( OrganisationUnit unit, String localeString )
{
long time = System.currentTimeMillis();
@@ -140,6 +141,32 @@
}
@Override
+ public ActivityPlan getAllActivityPlan( OrganisationUnit unit, String localeString )
+ {
+ long time = System.currentTimeMillis();
+
+ List<Activity> items = new ArrayList<Activity>();
+
+ this.setGroupByAttribute( patientAttService.getPatientAttributeByGroupBy( true ) );
+
+ Collection<org.hisp.dhis.activityplan.Activity> activities = activityPlanService.getActivitiesByProvider( unit );
+
+ for ( org.hisp.dhis.activityplan.Activity activity : activities )
+ {
+ items.add( getActivity( activity.getTask(), activity.getDueDate().getTime() < time ) );
+ }
+
+ if ( items.isEmpty() )
+ {
+ return null;
+ }
+
+ Collections.sort( items, activityComparator );
+
+ return new ActivityPlan( items );
+ }
+
+ @Override
public ActivityPlan getActivitiesByIdentifier( String keyword )
throws NotAllowedException
{
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java 2012-02-16 12:58:37 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java 2012-04-10 06:49:47 +0000
@@ -37,7 +37,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.api.mobile.FacilityReportingService;
=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration'
=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action'
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/GetBeneficiaryRegistrationOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/GetBeneficiaryRegistrationOrganisationUnitAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/GetBeneficiaryRegistrationOrganisationUnitAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,81 @@
+/*
+ * 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.beneficiaryregistration.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetBeneficiaryRegistrationOrganisationUnitAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
+
+ public List<OrganisationUnit> getOrganisationUnits()
+ {
+ return organisationUnits;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ User user = currentUserService.getCurrentUser();
+
+ if ( user != null )
+ {
+ organisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
+ Collections.sort( organisationUnits, IdentifiableObjectNameComparator.INSTANCE );
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,55 @@
+/*
+ * 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.beneficiaryregistration.action;
+
+import com.opensymphony.xwork2.Action;
+
+public class RegisterBeneficiaryAction implements Action
+{
+
+ private String orgUnitId;
+
+ public String getOrgUnitId()
+ {
+ return orgUnitId;
+ }
+
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,188 @@
+/*
+ * 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.beneficiaryregistration.action;
+
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.ISODateTimeFormat;
+
+import com.opensymphony.xwork2.Action;
+
+public class SaveBeneficiaryAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private PatientService patientService;
+
+ public PatientService getPatientService()
+ {
+ return patientService;
+ }
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public OrganisationUnitService getOrganisationUnitService()
+ {
+ return organisationUnitService;
+ }
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String orgUnitId;
+
+ public String getOrgUnitId()
+ {
+ return orgUnitId;
+ }
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private String patientFullName;
+
+ public String getPatientFullName()
+ {
+ return patientFullName;
+ }
+
+ public void setPatientFullName( String patientFullName )
+ {
+ this.patientFullName = patientFullName;
+ }
+
+ private String bloodGroup;
+
+ public String getBloodGroup()
+ {
+ return bloodGroup;
+ }
+
+ public void setBloodGroup( String bloodGroup )
+ {
+ this.bloodGroup = bloodGroup;
+ }
+
+ private String gender;
+
+ public String getGender()
+ {
+ return gender;
+ }
+
+ public void setGender( String gender )
+ {
+ this.gender = gender;
+ }
+
+ private String dateOfBirth;
+
+ public String getDateOfBirth()
+ {
+ return dateOfBirth;
+ }
+
+ public void setDateOfBirth( String dateOfBirth )
+ {
+ this.dateOfBirth = dateOfBirth;
+ }
+
+ public boolean validated;
+
+ public boolean isValidated()
+ {
+ return validated;
+ }
+
+ public void setValidated( boolean validated )
+ {
+ this.validated = validated;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ Patient patient = new Patient();
+
+ patient.setOrganisationUnit( organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) ) );
+
+ String[] tokens = this.patientFullName.split( " " );
+
+ patient.setFirstName( tokens[0] );
+
+ if ( tokens.length == 2 )
+ {
+ patient.setLastName( tokens[1] );
+ }
+ else if ( tokens.length > 2 )
+ {
+ patient.setMiddleName( tokens[1] );
+ patient.setLastName( tokens[2] );
+ }
+
+ patient.setGender( gender );
+ patient.setBloodGroup( bloodGroup );
+
+ DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
+ DateTime date = sdf.parseDateTime( dateOfBirth );
+ try
+ {
+ patient.setBirthDate( date.toDate() );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ patientService.savePatient( patient );
+ validated = true;
+
+ return SUCCESS;
+ }
+
+}
=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry'
=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action'
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.api.mobile.model.Activity;
+import org.hisp.dhis.api.mobile.ActivityReportingService;
+import org.hisp.dhis.api.mobile.model.ActivityPlan;
+import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import com.opensymphony.xwork2.Action;
+
+public class GetActivityListAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ActivityReportingService activityReportingService;
+
+ public void setActivityReportingService( ActivityReportingService activityReportingService )
+ {
+ this.activityReportingService = activityReportingService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private NamebasedUtils util;
+
+ public void setUtil( NamebasedUtils util )
+ {
+ this.util = util;
+ }
+
+ public NamebasedUtils getUtil()
+ {
+ return util;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String beneficiaryId;
+
+ public void setBeneficiaryId( String beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ public String getBeneficiaryId()
+ {
+ return this.beneficiaryId;
+ }
+
+ private boolean current;
+
+ public boolean isCurrent()
+ {
+ return current;
+ }
+
+ public void setCurrent( boolean current )
+ {
+ this.current = current;
+ }
+
+ private OrganisationUnit organisationUnit;
+
+ public String getOrganisationUnitId()
+ {
+ return this.organisationUnitId;
+ }
+
+ private String organisationUnitId;
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ private List<Activity> activities;
+
+ public List<Activity> getActivities()
+ {
+ return activities;
+ }
+
+ public void setActivities( List<Activity> activities )
+ {
+ this.activities = activities;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ activities = new ArrayList<Activity>();
+ organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( organisationUnitId ) );
+ ActivityPlan activityPlan;
+ if ( current )
+ {
+ activityPlan = activityReportingService.getCurrentActivityPlan( organisationUnit, "" );
+ }
+ else
+ {
+ activityPlan = activityReportingService.getAllActivityPlan( organisationUnit, "" );
+ }
+ List<Activity> allActivities = activityPlan.getActivitiesList();
+ for ( Activity activity : allActivities )
+ {
+ if ( activity.getBeneficiary().getId() == Integer.parseInt( beneficiaryId ) )
+ {
+ activities.add( activity );
+ }
+ }
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryDetailAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryDetailAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryDetailAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,92 @@
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetBeneficiaryDetailAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private PatientService patientService;
+
+ public PatientService getPatientService()
+ {
+ return patientService;
+ }
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String organisationUnitId;
+
+ public String getOrganisationUnitId()
+ {
+ return organisationUnitId;
+ }
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ private String beneficiaryId;
+
+ public void setBeneficiaryId( String beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ public String getBeneficiaryId()
+ {
+ return this.beneficiaryId;
+ }
+
+ private Patient patient;
+
+ public Patient getPatient()
+ {
+ return patient;
+ }
+
+ public void setPatient( Patient patient )
+ {
+ this.patient = patient;
+ }
+
+ private boolean current;
+
+ public void setCurrent( boolean current )
+ {
+ this.current = current;
+ }
+
+ public boolean getCurrent()
+ {
+ return current;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ this.patient = patientService.getPatient( Integer.parseInt( beneficiaryId ) );
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetBeneficiaryListAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,167 @@
+/*
+ * 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.namebaseddataentry.action;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.hisp.dhis.api.mobile.ActivityReportingService;
+import org.hisp.dhis.api.mobile.model.Activity;
+import org.hisp.dhis.api.mobile.model.ActivityPlan;
+import org.hisp.dhis.api.mobile.model.Beneficiary;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import com.opensymphony.xwork2.Action;
+
+public class GetBeneficiaryListAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ActivityReportingService activityReportingService;
+
+ public void setActivityReportingService( ActivityReportingService activityReportingService )
+ {
+ this.activityReportingService = activityReportingService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private boolean current;
+
+ public boolean isCurrent()
+ {
+ return current;
+ }
+
+ public void setCurrent( boolean current )
+ {
+ this.current = current;
+ }
+
+ private boolean validated = false;
+
+ public boolean isValidated()
+ {
+ return validated;
+ }
+
+ public void setValidated( boolean validated )
+ {
+ this.validated = validated;
+ }
+
+ private List<Beneficiary> beneficiaries;
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return this.organisationUnit;
+ }
+
+ private String organisationUnitId;
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ public String getOrganisationUnitId( String organisationUnitId )
+ {
+ return this.organisationUnitId;
+ }
+
+ private ActivityPlan activityPlan;
+
+ public ActivityPlan getActivityPlan()
+ {
+ return this.activityPlan;
+ }
+
+ private List<Activity> activities;
+
+ public List<Activity> getActivities()
+ {
+ return this.activities;
+ }
+
+ public List<Beneficiary> getBeneficiaries()
+ {
+ return this.beneficiaries;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ beneficiaries = new ArrayList<Beneficiary>();
+
+ organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( organisationUnitId ) );
+
+ if ( current )
+ {
+ activityPlan = activityReportingService.getCurrentActivityPlan( organisationUnit, "" );
+ }
+ else
+ {
+ activityPlan = activityReportingService.getAllActivityPlan(organisationUnit, "");
+ }
+
+ if ( activityPlan == null )
+ return SUCCESS;
+
+ activities = activityPlan.getActivitiesList();
+
+ if ( activities == null )
+ return SUCCESS;
+
+ for ( Activity activity : activities )
+ {
+ beneficiaries.add( activity.getBeneficiary() );
+ }
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetNamebasedOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetNamebasedOrganisationUnitsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetNamebasedOrganisationUnitsAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,81 @@
+/*
+ * 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.namebaseddataentry.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import com.opensymphony.xwork2.Action;
+
+public class GetNamebasedOrganisationUnitsAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
+
+ public List<OrganisationUnit> getOrganisationUnits()
+ {
+ return organisationUnits;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ User user = currentUserService.getCurrentUser();
+
+ if ( user != null )
+ {
+ organisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
+ Collections.sort( organisationUnits, IdentifiableObjectNameComparator.INSTANCE );
+ }
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import java.util.List;
+import org.hisp.dhis.api.mobile.model.Activity;
+import org.hisp.dhis.api.mobile.model.ActivityPlan;
+import org.hisp.dhis.api.mobile.model.DataElement;
+import org.hisp.dhis.api.mobile.model.Program;
+import org.hisp.dhis.api.mobile.model.ProgramStage;
+import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetProgramStageFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private NamebasedUtils util;
+
+ public void setUtil( NamebasedUtils util )
+ {
+ this.util = util;
+ }
+
+ public NamebasedUtils getUtil()
+ {
+ return util;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String programStageInstanceId;
+
+ public String getProgramStageInstanceId()
+ {
+ return programStageInstanceId;
+ }
+
+ public void setProgramStageInstanceId( String programStageInstanceId )
+ {
+ this.programStageInstanceId = programStageInstanceId;
+ }
+
+ private String beneficiaryId;
+
+ public void setBeneficiaryId( String beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ public String getBeneficiaryId()
+ {
+ return this.beneficiaryId;
+ }
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return this.organisationUnit;
+ }
+
+
+ public void setOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+ this.organisationUnit = organisationUnit;
+ }
+
+ private List<DataElement> dataElements;
+
+ public List<DataElement> getDataElements()
+ {
+ return this.dataElements;
+ }
+
+ private ProgramStage programStage;
+
+ public ProgramStage getProgramStage()
+ {
+ return this.programStage;
+ }
+
+ private String programId;
+
+ public void setProgramId( String programId )
+ {
+ this.programId = programId;
+ }
+
+ public String getProgramId()
+ {
+ return programId;
+ }
+
+ private String programStageId;
+
+ public void setProgramStageId( String programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ public String getProgramStageId()
+ {
+ return programStageId;
+ }
+
+ private String orgUnitId;
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ public String getOrgUnitId()
+ {
+ return this.orgUnitId;
+ }
+
+ private ActivityPlan activityPlan;
+
+ public ActivityPlan getActivityPlan()
+ {
+ return this.activityPlan;
+ }
+
+ private List<Activity> activities;
+
+ public List<Activity> getActivities()
+ {
+ return this.activities;
+ }
+
+ private Program program;
+
+ public Program getProgram()
+ {
+ return this.program;
+ }
+
+ private boolean current;
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public boolean isCurrent()
+ {
+ return current;
+ }
+
+ public void setCurrent( boolean current )
+ {
+ this.current = current;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) );
+
+ programStage = util.getProgramStage( Integer.parseInt( programId ), Integer.parseInt( programStageId ) );
+
+ dataElements = programStage.getDataElements();
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.api.mobile.ActivityReportingService;
+import org.hisp.dhis.api.mobile.NotAllowedException;
+import org.hisp.dhis.api.mobile.model.ActivityValue;
+import org.hisp.dhis.api.mobile.model.DataElement;
+import org.hisp.dhis.api.mobile.model.DataValue;
+import org.hisp.dhis.api.mobile.model.ProgramStage;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.util.ContextUtils;
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+public class SaveProgramStageFormAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private NamebasedUtils util;
+
+ public NamebasedUtils getUtil()
+ {
+ return util;
+ }
+
+ public void setUtil( NamebasedUtils util )
+ {
+ this.util = util;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private ActivityReportingService activityReportingService;
+
+ public void setActivityReportingService( ActivityReportingService activityReportingService )
+ {
+ this.activityReportingService = activityReportingService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String orgUnitId;
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ public String getOrgUnitId()
+ {
+ return orgUnitId;
+ }
+
+ private OrganisationUnit organisationUnit;
+
+ private String programStageInstanceId;
+
+ public String getProgramStageInstanceId()
+ {
+ return programStageInstanceId;
+ }
+
+ public void setProgramStageInstanceId( String programStageInstanceId )
+ {
+ this.programStageInstanceId = programStageInstanceId;
+ }
+
+ private String beneficiaryId;
+
+ public void setBeneficiaryId( String beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ public String getBeneficiaryId()
+ {
+ return beneficiaryId;
+ }
+
+ private String programId;
+
+ public void setProgramId( String programId )
+ {
+ this.programId = programId;
+ }
+
+ public String getProgramId()
+ {
+ return programId;
+ }
+
+ private String programStageId;
+
+ public void setProgramStageId( String programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ public String getProgramStageId()
+ {
+ return programStageId;
+ }
+
+ private ProgramStage programStage;
+
+ public ProgramStage getProgramStage()
+
+ {
+ return programStage;
+ }
+
+ private boolean current;
+
+ public void setCurrent( boolean current )
+ {
+ this.current = current;
+ }
+
+ public boolean getCurrent()
+ {
+ return current;
+ }
+
+ private List<DataElement> dataElements;
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+ private Map<String, String> typeViolations = new HashMap<String, String>();
+
+ public Map<String, String> getTypeViolations()
+ {
+ return typeViolations;
+ }
+
+ private Map<String, String> prevDataValues = new HashMap<String, String>();
+
+ public Map<String, String> getPrevDataValues()
+ {
+ return prevDataValues;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) );
+
+ programStage = util.getProgramStage( Integer.parseInt( programId ), Integer.parseInt( programStageId ) );
+
+ dataElements = programStage.getDataElements();
+
+ System.out.println( "Current: " + current );
+
+ HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
+ ServletActionContext.HTTP_REQUEST );
+ Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
+
+ List<DataValue> dataValues = new ArrayList<DataValue>();
+
+ typeViolations.clear();
+ prevDataValues.clear();
+
+ for ( String key : parameterMap.keySet() )
+ {
+ if ( key.startsWith( "DE" ) && key.indexOf( "OC" ) != -1 )
+ {
+ String[] splitKey = key.split( "OC" );
+ Integer dataElementId = Integer.parseInt( splitKey[0].substring( 2 ) );
+ Integer categoryOptComboId = Integer.parseInt( splitKey[1] );
+ String value = parameterMap.get( key );
+
+ // validate types
+ org.hisp.dhis.dataelement.DataElement dataElement = dataElementService.getDataElement( dataElementId );
+ value = value.trim();
+ Boolean valueIsEmpty = (value == null || value.length() == 0);
+
+ if ( !valueIsEmpty )
+ {
+ String typeViolation = util.getTypeViolation( dataElement, value );
+
+ if ( typeViolation != null )
+ {
+ typeViolations.put( key, typeViolation );
+ }
+ prevDataValues.put( key, value );
+ }
+
+ // build dataValue for activity value
+ DataValue dataValue = new DataValue();
+ dataValue.setId( dataElementId );
+ dataValue.setValue( value );
+ dataValue.setCategoryOptComboID( categoryOptComboId );
+
+ dataValues.add( dataValue );
+ }
+ }
+
+ if ( !typeViolations.isEmpty() )
+ {
+ return ERROR;
+ }
+
+ ActivityValue activityValue = new ActivityValue();
+ activityValue.setDataValues( dataValues );
+ activityValue.setProgramInstanceId( Integer.parseInt( programStageInstanceId ) );
+
+ try
+ {
+ activityReportingService.saveActivityReport( organisationUnit, activityValue );
+ }
+ catch ( NotAllowedException e )
+ {
+ e.printStackTrace();
+
+ return ERROR;
+ }
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowActivityTypeAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String orgUnitId;
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ public String getOrgUnitId( String orgUnitId )
+ {
+ return this.orgUnitId;
+ }
+
+ private String organisationUnitId;
+
+ public String getOrganisationUnitId()
+ {
+ return organisationUnitId;
+ }
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ this.organisationUnitId = orgUnitId;
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 2012-04-10 06:49:47 +0000
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.utils;
+
+import java.util.Collection;
+import org.hisp.dhis.api.mobile.IProgramService;
+import org.hisp.dhis.api.mobile.model.Program;
+import org.hisp.dhis.api.mobile.model.ProgramStage;
+import org.hisp.dhis.dataelement.DataElement;
+
+public class NamebasedUtils
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private IProgramService programService;
+
+ public void setProgramService( IProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ public ProgramStage getProgramStage( int programId, int programStageId )
+ {
+ Program program = programService.getProgram( programId, "" );
+
+ Collection<ProgramStage> stages = program.getProgramStages();
+
+ for ( ProgramStage programStage : stages )
+ {
+ if ( programStage.getId() == programStageId )
+ {
+ return programStage;
+ }
+ }
+ return null;
+ }
+
+ public String getTypeViolation( DataElement dataElement, String value )
+ {
+ String type = dataElement.getType();
+ String numberType = dataElement.getNumberType();
+
+ if ( type.equals( DataElement.VALUE_TYPE_STRING ) )
+ {
+ }
+ else if ( type.equals( DataElement.VALUE_TYPE_BOOL ) )
+ {
+ if ( !FormUtils.isBoolean( value ) )
+ {
+ return "is_invalid_boolean";
+ }
+ }
+ else if ( type.equals( DataElement.VALUE_TYPE_DATE ) )
+ {
+ if ( !FormUtils.isDate( value ) )
+ {
+ return "is_invalid_date";
+ }
+ }
+ else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_NUMBER ) )
+ {
+ if ( !FormUtils.isNumber( value ) )
+ {
+ return "is_invalid_number";
+ }
+ }
+ else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_INT ) )
+ {
+ if ( !FormUtils.isInteger( value ) )
+ {
+ return "is_invalid_integer";
+ }
+ }
+ else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_POSITIVE_INT ) )
+ {
+ if ( !FormUtils.isPositiveInteger( value ) )
+ {
+ return "is_invalid_positive_integer";
+ }
+ }
+ else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_NEGATIVE_INT ) )
+ {
+ if ( !FormUtils.isNegativeInteger( value ) )
+ {
+ return "is_invalid_negative_integer";
+ }
+ }
+ return null;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-02-16 14:00:33 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-04-10 06:49:47 +0000
@@ -92,7 +92,72 @@
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
<property name="formUtils" ref="org.hisp.dhis.light.dataentry.utils.FormUtils" />
</bean>
-
+
+ <!-- Namebased Data entry -->
+ <bean id="org.hisp.dhis.light.namebaseddataentry.action.GetNamebasedOrganisationUnitsAction"
+ class="org.hisp.dhis.light.namebaseddataentry.action.GetNamebasedOrganisationUnitsAction"
+ scope="prototype">
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.light.namebaseddataentry.action.GetBeneficiaryListAction" class="org.hisp.dhis.light.namebaseddataentry.action.GetBeneficiaryListAction">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="activityReportingService" ref="org.hisp.dhis.mobile.api.ActivityReportingService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.light.namebaseddataentry.action.ShowActivityTypeAction"
+ class="org.hisp.dhis.light.namebaseddataentry.action.ShowActivityTypeAction"
+ scope="prototype"/>
+
+ <bean id="org.hisp.dhis.light.namebaseddataentry.action.GetActivityListAction" class="org.hisp.dhis.light.namebaseddataentry.action.GetActivityListAction">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="activityReportingService" ref="org.hisp.dhis.mobile.api.ActivityReportingService" />
+ <property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
+ </bean>
+
+ <bean id="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageFormAction" class="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageFormAction">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
+ </bean>
+
+ <bean id="org.hisp.dhis.light.utils.NamebasedUtils" class="org.hisp.dhis.light.utils.NamebasedUtils">
+ <property name="programService" ref="org.hisp.dhis.mobile.api.IProgramService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.light.namebaseddataentry.action.SaveProgramStageFormAction" class="org.hisp.dhis.light.namebaseddataentry.action.SaveProgramStageFormAction">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="activityReportingService" ref="org.hisp.dhis.mobile.api.ActivityReportingService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
+ </bean>
+
+ <bean id="org.hisp.dhis.light.namebaseddataentry.action.GetBeneficiaryDetailAction" class="org.hisp.dhis.light.namebaseddataentry.action.GetBeneficiaryDetailAction">
+ <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+ </bean>
+
+ <!-- Beneficiary Registration -->
+
+ <bean id="org.hisp.dhis.light.beneficiaryregistration.action.GetBeneficiaryRegistrationOrganisationUnitAction"
+ class="org.hisp.dhis.light.beneficiaryregistration.action.GetBeneficiaryRegistrationOrganisationUnitAction"
+ scope="prototype">
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.light.beneficiaryregistration.action.RegisterBeneficiaryAction"
+ class="org.hisp.dhis.light.beneficiaryregistration.action.RegisterBeneficiaryAction"
+ scope="prototype">
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.light.beneficiaryregistration.action.SaveBeneficiaryAction"
+ class="org.hisp.dhis.light.beneficiaryregistration.action.SaveBeneficiaryAction"
+ scope="prototype">
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+ <property name="patientService"
+ ref="org.hisp.dhis.patient.PatientService"/>
+ </bean>
+
<!-- Dashboard -->
<bean id="org.hisp.dhis.light.dashboard.action.ProvideContentAction"
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-02-26 20:37:36 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-04-10 06:49:47 +0000
@@ -10,6 +10,7 @@
dashboard_charts=Dashboard charts
dashboard_documents=Dashboard documents
data_entry=Data Entry
+namebased_data_entry=Namebased Data Entry
data_entry_overview=Data Entry Overview
logout=Logout
desktop_version=Desktop version
@@ -40,3 +41,21 @@
completed=Completed
saved_section=Saved Section
sections=Sections
+current_activityplan=Current Activity Plan
+all_activityplan=All Activity Plan
+activity_type=Activity Type
+beneficiary_list=Beneficiary List
+activity_list=Activity List
+successfully_saved=Successfully Saved
+select_option=Select Option
+id=ID
+gender=Gender
+date_of_birth=Date of Birth
+blood_group=Blood Group
+details_for=Detail For
+organisation_unit=Organisation Unit
+beneficiary_registration=Beneficiary Registration
+full_name=FullName
+male=Male
+female=Female
+transgender=Transgender
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-01-23 09:28:45 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-04-10 06:49:47 +0000
@@ -17,7 +17,6 @@
<action name="selectOrganisationUnit" class="org.hisp.dhis.light.dataentry.action.GetOrganisationUnitsAction">
<result name="success" type="velocity">/dhis-web-light/main.vm</result>
<param name="page">/dhis-web-light/selectOrganisationUnit.vm</param>
-
<result name="selectDataSet" type="redirect">/mobile/selectDataSet.action?organisationUnitId=${organisationUnitId}</result>
<result name="selectPeriod" type="redirect">/mobile/selectPeriod.action?organisationUnitId=${organisationUnitId}&dataSetId=${dataSetId}</result>
</action>
@@ -25,7 +24,6 @@
<action name="selectDataSet" class="org.hisp.dhis.light.dataentry.action.GetDataSetsAction">
<result name="success" type="velocity">/dhis-web-light/main.vm</result>
<param name="page">/dhis-web-light/selectDataSet.vm</param>
-
<result name="selectPeriod" type="redirect">/mobile/selectPeriod.action?organisationUnitId=${organisationUnitId}&dataSetId=${dataSetId}</result>
</action>
@@ -54,7 +52,62 @@
<action name="markComplete" class="org.hisp.dhis.light.dataentry.action.MarkComplete">
<result name="success" type="redirect">/mobile/index.action?organisationUnitId=${organisationUnitId}&dataSetId=${dataSetId}&periodId=${periodId}&complete=true</result>
</action>
-
+
+ <!-- Namebased Data Entry -->
+
+ <action name="selectNamebasedOrganisationUnit" class="org.hisp.dhis.light.namebaseddataentry.action.GetNamebasedOrganisationUnitsAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/selectNamebasedOrganisationUnits.vm</param>
+ </action>
+
+ <action name="selectActivityType" class="org.hisp.dhis.light.namebaseddataentry.action.ShowActivityTypeAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/selectActivityType.vm</param>
+ </action>
+
+ <action name="selectBeneficiary" class="org.hisp.dhis.light.namebaseddataentry.action.GetBeneficiaryListAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/beneficiaryList.vm</param>
+ </action>
+
+ <action name="selectActivity" class="org.hisp.dhis.light.namebaseddataentry.action.GetActivityListAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/selectActivity.vm</param>
+ </action>
+
+ <action name="showProgramStageForm" class="org.hisp.dhis.light.namebaseddataentry.action.GetProgramStageFormAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/programStageForm.vm</param>
+ </action>
+
+ <action name="saveProgramStageForm" class="org.hisp.dhis.light.namebaseddataentry.action.SaveProgramStageFormAction">
+ <result name="success" type="redirect">/mobile/selectBeneficiary.action?organisationUnitId=${orgUnitId}&current=${current}&validated=true</result>
+ <result name="error" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/programStageForm.vm</param>
+ </action>
+
+ <action name="showBeneficiaryDetail" class="org.hisp.dhis.light.namebaseddataentry.action.GetBeneficiaryDetailAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/beneficiaryDetail.vm</param>
+ </action>
+
+ <!-- Beneficiary Registration -->
+
+ <action name="selectRegistrationOrganisationUnit" class="org.hisp.dhis.light.beneficiaryregistration.action.GetBeneficiaryRegistrationOrganisationUnitAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/selectRegistrationOrganisationUnits.vm</param>
+ </action>
+
+ <action name="registerBeneficiary" class="org.hisp.dhis.light.beneficiaryregistration.action.RegisterBeneficiaryAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/beneficiaryRegistrationForm.vm</param>
+ </action>
+
+ <action name="saveBeneficiary" class="org.hisp.dhis.light.beneficiaryregistration.action.SaveBeneficiaryAction">
+ <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/beneficiaryRegistrationForm.vm</param>
+ </action>
+
<!-- Reports -->
<action name="reports" class="org.hisp.dhis.light.dashboard.action.ProvideContentAction">
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryDetail.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryDetail.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryDetail.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,20 @@
+<h2>$i18n.getString("details_for") $patient.firstName $patient.middleName $patient.lastName </h2>
+<p>
+
+<ul>
+ <li><strong>$i18n.getString("id"):</strong> $patient.id</li>
+ <li><b>$i18n.getString("gender"):</b> #if ($patient.gender == "F") Female #else Male #end</li>
+ #set($day = $patient.birthDate.date)
+ #set($month = $patient.birthDate.month+1)
+ #set($year = $patient.birthDate.year + 1900)
+ <li><b>$i18n.getString("date_of_birth"):</b> $year - $month - $day </li>
+ <li><b>$i18n.getString("blood_group"):</b> $patient.bloodGroup</li>
+</ul>
+
+<p>
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li><a href="selectActivity.action?organisationUnitId=$organisationUnitId&beneficiaryId=$patient.id¤t=$current"> $i18n.getString("activity_list")</a></li>
+ <li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryList.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryList.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,23 @@
+<h2>$i18n.getString( "beneficiary_list" )</h2>
+ #if( $validated && $current )
+ <div class="header-box">
+ <h3 style="text-align: left;">$i18n.getString("successfully_saved")</h3>
+ </div>
+ #else
+
+ #end
+<p>
+<ul>
+#foreach( $beneficiary in $beneficiaries )
+ <li><a href="selectActivity.action?organisationUnitId=$organisationUnit.id&beneficiaryId=$beneficiary.id¤t=$current">$!encoder.htmlEncode( ${beneficiary.getFullName()} )</a></li>
+#end
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li><a href="selectActivityType.action?orgUnitId=$organisationUnit.id">$i18n.getString("activity_type")</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/beneficiaryRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryRegistrationForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiaryRegistrationForm.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,54 @@
+<h2>$i18n.getString( "beneficiary_registration" )</h2>
+
+ #if( $validated )
+ <div class="header-box">
+ <h3 style="text-align: left;">$i18n.getString("successfully_saved")</h3>
+ </div>
+ #else
+
+ #end
+
+<form action="saveBeneficiary.action" method="POST">
+<div class="header-box" align="center">
+<input type="hidden" name="orgUnitId" value="$orgUnitId"/>
+ <p style="text-align: left;">
+ <label>$i18n.getString( "full_name" )</label>
+ <input type="text" name="patientFullName" value="$!prevDataValues.get($key)" />
+ <label>$i18n.getString( "gender" )</label>
+ <select name="gender">
+ <option value="M">$i18n.getString( "male" )</option>
+ <option value="F">$i18n.getString( "female" )</option>
+ <option value="T">$i18n.getString( "transgender" )</option>
+ </select>
+ <label>$i18n.getString( "date_of_birth" )</label>
+ <input type="text" name="dateOfBirth" value="$!prevDataValues.get($key)" />
+ <label>$i18n.getString( "blood_group" )</label>
+ <select name="bloodGroup">
+ <option value="">[Please select]</option>
+ <option value="A+">A+</option>
+ <option value="A-">A-</option>
+ <option value="AB+">AB+</option>
+ <option value="AB-">AB-</option>
+ <option value="B+">B+</option>
+ <option value="B-">B-</option>
+ <option value="O+">O+</option>
+ <option value="O-">O-</option>
+ </select>
+ </p>
+</div>
+
+<div class="header-box" align="center">
+ <p>
+ <input type="submit" style="width: 100%;" value="$i18n.getString("save")" />
+ </p>
+</div>
+
+</form>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li> <a href="activity.action?orgUnitId=$organisationUnit.id&beneficiaryId=$beneficiaryId&programStageId=$programStageId"> $i18n.getString("organisation_unit")</a> </li>
+ <li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
=== 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 2012-02-01 08:50:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm 2012-04-10 06:49:47 +0000
@@ -21,6 +21,8 @@
<p>
<ul>
<li><a href="selectOrganisationUnit.action">$i18n.getString( "data_entry" )</a></li>
+ <li><a href="selectNamebasedOrganisationUnit.action">$i18n.getString( "namebased_data_entry" )</a></li>
+ <li><a href="selectRegistrationOrganisationUnit.action">$i18n.getString( "beneficiary_registration" )</a></li>
<li><a href="messages.action">$i18n.getString( "messages" ) #if($unreadMessageConversationCount > 0)($unreadMessageConversationCount)#end</a></li>
<li><a href="reports.action">$i18n.getString( "reports" )</a></li>
<li><a href="settings.action">$i18n.getString( "settings" )</a></li>
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programStageForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programStageForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programStageForm.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,109 @@
+<h2>$encoder.htmlEncode( $programStage.name )</h2>
+
+#set( $typeViolationsSize = $typeViolations.size() )
+
+#if( $typeViolationsSize > 0 )
+<div class="header-box" align="center">
+ <h3 style="text-align: left; background-color: #990000; color: white;">$i18n.getString("warnings_and_errors")</h3>
+ <p style="text-align: left;">
+ $typeViolationsSize $i18n.getString("type_violation_errors"). <br />
+ </p>
+</div>
+#end
+
+<form action="saveProgramStageForm.action" method="POST">
+
+<input type="hidden" value=$programStageInstanceId name="programStageInstanceId"/>
+<input type="hidden" value=$programStageId name="programStageId"/>
+<input type="hidden" value=$orgUnitId name="orgUnitId"/>
+<input type="hidden" value=$programId name="programId" />
+<input type="hidden" value=$beneficiaryId name="beneficiaryId" />
+<input type="hidden" id="current" name="current" value=$current />
+
+<div class="header-box" align="center">
+ <p style="text-align: left;">
+ #foreach( $dataElement in $dataElements)
+ #if( $dataElement.shortName )
+ #set( $dataElementName = $dataElement.shortName )
+ #else
+ #set( $dataElementName = $dataElement.name )
+ #end
+ #if ($dataElement.getCategoryOptionCombos().getModels().size() == 1)
+ #set( $categoryOptionCombo = $dataElement.getCategoryOptionCombos().getModels().get( 0 ) )
+ #set( $key = "DE${dataElement.id}OC${categoryOptionCombo.id}" )
+
+ <label>$encoder.htmlEncode( $dataElementName ) #if( $categoryOptionCombo.name!="(default)")$encoder.htmlEncode( $categoryOptionCombo.name )#end</label>
+
+ #if( $typeViolations.get( $key ) )
+ #set( $typeViolation = $typeViolations.get( $key ) )
+ <br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
+ #end
+
+ <input type=
+ #if($dataElement.type=="string")
+ "text"
+ #elseif ($dataElement.type=="int" )
+ "text"
+ #else
+ "$dataElement.type"
+ #end
+ name="$key" value="$!prevDataValues.get($key)" />
+
+ #elseif ($dataElement.getCategoryOptionCombos().getModels().size() > 1)
+
+ #set( $categoryOptionCombo = $dataElement.getCategoryOptionCombos().getModels().get( 0 ) )
+ #set( $key = "DE${dataElement.id}OC${categoryOptionCombo.id}" )
+
+ $dataElementName
+
+ #if( $typeViolations.get( $key ) )
+ #set( $typeViolation = $typeViolations.get( $key ) )
+ <br /><span style="color: #990000;"> $prevDataValues.get($key) $i18n.getString($typeViolation)</span>
+ #end
+
+ <select type=
+ #if($dataElement.type=="string")
+ "text"
+ #elseif($dataElement.type=="int" )
+ "text"
+ #else
+ "$dataElement.type"
+ #end
+ name="$key" />
+
+ #set( $selected=false )
+
+ #foreach ($categoryOptionCombo in $dataElement.categoryOptionCombos.models)
+ <option value="$categoryOptionCombo.name"
+ #if( !$typeViolations.containsKey( $key ) && $prevDataValues.get( $key ) == $categoryOptionCombo.name )
+ selected
+ #set( $selected=true )
+ #end
+ > $categoryOptionCombo.name </option>
+ #end
+
+ #if( !$selected )
+ <option selected > $i18n.getString("select_option") </option>
+ #end
+
+ </select>
+ #end
+ #end
+ </p>
+</div>
+
+<div class="header-box" align="center">
+ <p>
+ <input type="submit" style="width: 100%;" value="$i18n.getString("save")" />
+ </p>
+</div>
+
+</form>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li> <a href="activity.action?orgUnitId=$organisationUnit.id&beneficiaryId=$beneficiaryId&programStageId=$programStageId"> activity details </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/selectActivity.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectActivity.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectActivity.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,25 @@
+<h2>$i18n.getString( "activity_list" )</h2>
+<p>
+ <ul>
+ <li>
+ <a href="showBeneficiaryDetail.action?organisationUnitId=$organisationUnitId&beneficiaryId=$beneficiaryId¤t=$current"> $i18n.getString( "details" ) </a>
+ </li>
+ </ul>
+<ul>
+#foreach( $activity in $activities )
+ <li>
+ <a href="showProgramStageForm.action?orgUnitId=$organisationUnitId&programStageId=$activity.getTask().getProgramStageId()&programId=$activity.getTask().getProgramId()&programStageInstanceId=$activity.task.id¤t=$current">
+ $util.getProgramStage($activity.getTask().getProgramId(), $activity.getTask().getProgramStageId()).getName()
+ </a>
+ </li>
+#end
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li><a href="selectBeneficiary.action?organisationUnitId=$organisationUnitId¤t=$current">$i18n.getString("beneficiary_list")</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/selectActivityType.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectActivityType.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectActivityType.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,15 @@
+<h2>$i18n.getString( "activity_type" )</h2>
+<p>
+<ul>
+ <li><a href="selectBeneficiary.action?organisationUnitId=$organisationUnitId¤t=true">$i18n.getString( "current_activityplan" )</a></li>
+ <li><a href="selectBeneficiary.action?organisationUnitId=$organisationUnitId¤t=false">$i18n.getString( "all_activityplan" )</a></li>
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li><a href="selectNamebasedOrganisationUnit.action">$i18n.getString("organisation_unit")</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/selectNamebasedOrganisationUnits.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectNamebasedOrganisationUnits.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectNamebasedOrganisationUnits.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,15 @@
+<h2>$i18n.getString( "select_organisation_unit" )</h2>
+<p>
+<ul>
+#foreach( $organisationUnit in $organisationUnits )
+ <li><a href="selectActivityType.action?orgUnitId=$organisationUnit.id">$!encoder.htmlEncode( ${organisationUnit.name} )</a></li>
+#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/selectRegistrationOrganisationUnits.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectRegistrationOrganisationUnits.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectRegistrationOrganisationUnits.vm 2012-04-10 06:49:47 +0000
@@ -0,0 +1,15 @@
+<h2>$i18n.getString( "select_organisation_unit" )</h2>
+<p>
+<ul>
+#foreach( $organisationUnit in $organisationUnits )
+ <li><a href="registerBeneficiary.action?orgUnitId=$organisationUnit.id">$!encoder.htmlEncode( ${organisationUnit.name} )</a></li>
+#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>