dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08672
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2134: Adding "Mobile Setting" function in dhis-web-maintenance-patient to select which PatientAttribute...
------------------------------------------------------------
revno: 2134
committer: Tran Ng Minh Luan <Luan@MinhLuan-PC>
branch nick: dhis2
timestamp: Mon 2010-11-22 17:23:44 +0700
message:
Adding "Mobile Setting" function in dhis-web-maintenance-patient to select which PatientAttribute will be sent to mobile
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientMobileSetting.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/ShowMobileSettingFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/UpdateMobileSettingAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/showPatientMobileSetting.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module_vi_VN.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/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-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2010-11-22 10:23:44 +0000
@@ -65,6 +65,8 @@
private Set<PatientAttributeOption> attributeOptions;
+ private PatientMobileSetting patientMobileSetting;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -218,4 +220,15 @@
this.inheritable = inheritable;
}
+ public PatientMobileSetting getPatientMobileSetting()
+ {
+ return patientMobileSetting;
+ }
+
+ public void setPatientMobileSetting( PatientMobileSetting patientMobileSetting )
+ {
+ this.patientMobileSetting = patientMobileSetting;
+ }
+
+
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java 2010-11-22 10:23:44 +0000
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2004-2009, 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.patient;
+
+import java.util.Set;
+
+import org.hisp.dhis.common.IdentifiableObject;
+
+public class PatientMobileSetting extends IdentifiableObject
+{
+ private Set<PatientAttribute> patientAttributes;
+
+ public PatientMobileSetting()
+ {
+ }
+
+ public Set<PatientAttribute> getPatientAttributes()
+ {
+ return patientAttributes;
+ }
+
+ public void setPatientAttributes( Set<PatientAttribute> patientAttributes )
+ {
+ this.patientAttributes = patientAttributes;
+ }
+
+
+
+
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingService.java 2010-11-22 10:23:44 +0000
@@ -0,0 +1,10 @@
+package org.hisp.dhis.patient;
+
+import java.util.Collection;
+
+public interface PatientMobileSettingService
+{
+ public int savePatientMobileSetting(PatientMobileSetting setting);
+ public void updatePatientMobileSetting(PatientMobileSetting setting);
+ public Collection<PatientMobileSetting> getCurrentSetting();
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSettingStore.java 2010-11-22 10:23:44 +0000
@@ -0,0 +1,12 @@
+package org.hisp.dhis.patient;
+
+import java.util.Collection;
+
+import org.hisp.dhis.common.GenericStore;
+
+public interface PatientMobileSettingStore extends GenericStore<PatientMobileSetting>
+{
+
+ public Collection<PatientMobileSetting> getCurrentSetting();
+
+}
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java 2010-11-22 10:23:44 +0000
@@ -0,0 +1,35 @@
+package org.hisp.dhis.patient;
+
+import java.util.Collection;
+
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class DefaultPatientMobileSettingService implements PatientMobileSettingService
+{
+
+ private PatientMobileSettingStore patientMobileSettingStore;
+
+ public void setPatientMobileSettingStore( PatientMobileSettingStore patientMobileSettingStore )
+ {
+ this.patientMobileSettingStore = patientMobileSettingStore;
+ }
+
+ @Override
+ public int savePatientMobileSetting( PatientMobileSetting setting )
+ {
+ return patientMobileSettingStore.save(setting);
+ }
+
+ @Override
+ public void updatePatientMobileSetting( PatientMobileSetting setting )
+ {
+ patientMobileSettingStore.update(setting);
+ }
+
+ @Override
+ public Collection<PatientMobileSetting> getCurrentSetting(){
+ return patientMobileSettingStore.getCurrentSetting();
+ }
+
+}
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java 2010-11-22 10:23:44 +0000
@@ -0,0 +1,30 @@
+package org.hisp.dhis.patient.hibernate;
+
+import java.util.Collection;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.hisp.dhis.patient.PatientMobileSetting;
+import org.hisp.dhis.patient.PatientMobileSettingStore;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class HibernatePatientMobileSettingStore
+ extends HibernateGenericStore<PatientMobileSetting>
+ implements PatientMobileSettingStore
+{
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<PatientMobileSetting> getCurrentSetting()
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( PatientMobileSetting.class );
+ criteria.setCacheable( true );
+
+ System.out.println(criteria.list().size());
+
+ return criteria.list();
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2010-11-21 15:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2010-11-22 10:23:44 +0000
@@ -123,6 +123,11 @@
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
+ <bean id="org.hisp.dhis.patient.PatientMobileSettingStore" class="org.hisp.dhis.patient.hibernate.HibernatePatientMobileSettingStore">
+ <property name="clazz" value="org.hisp.dhis.patient.PatientMobileSetting"/>
+ <property name="sessionFactory" ref="sessionFactory"/>
+ </bean>
+
<!-- Service definitions -->
<bean id="org.hisp.dhis.activityplan.ActivityPlanService"
@@ -262,6 +267,10 @@
<property name="programAttributeOptionStore"
ref="org.hisp.dhis.program.ProgramAttributeOptionStore"/>
</bean>
+
+ <bean id="org.hisp.dhis.patient.PatientMobileSettingService" class="org.hisp.dhis.patient.DefaultPatientMobileSettingService">
+ <property name="patientMobileSettingStore" ref="org.hisp.dhis.patient.PatientMobileSettingStore" />
+ </bean>
<!-- Aggregation engine -->
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2010-11-22 10:23:44 +0000
@@ -20,6 +20,8 @@
<property name="inheritable" column="inheritable" />
<property name="groupBy" column="groupby" />
+
+ <many-to-one name="patientMobileSetting" column="patientMobileSettingId" foreign-key="fk_patient_mobile_setting"/>
<many-to-one name="patientAttributeGroup" column="patientattributegroupid"
class="org.hisp.dhis.patient.PatientAttributeGroup"
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientMobileSetting.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientMobileSetting.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientMobileSetting.hbm.xml 2010-11-22 10:23:44 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.patient.PatientMobileSetting" table="patientmobilesetting">
+ <id name="id" column="patientmobilesettingid">
+ <generator class="native" />
+ </id>
+
+ <set name="patientAttributes">
+ <key column="patientmobilesettingid" />
+ <one-to-many class="org.hisp.dhis.patient.PatientAttribute" />
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/ShowMobileSettingFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/ShowMobileSettingFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/ShowMobileSettingFormAction.java 2010-11-22 10:23:44 +0000
@@ -0,0 +1,109 @@
+package org.hisp.dhis.patient.action.mobilesetting;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientMobileSetting;
+import org.hisp.dhis.patient.PatientMobileSettingService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowMobileSettingFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private PatientAttributeService patientAttributeService;
+
+ public PatientAttributeService getPatientAttributeService()
+ {
+ return patientAttributeService;
+ }
+
+ public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+ {
+ this.patientAttributeService = patientAttributeService;
+ }
+
+ private PatientMobileSettingService patientMobileSettingService;
+
+ public PatientMobileSettingService getPatientMobileSettingService()
+ {
+ return patientMobileSettingService;
+ }
+
+ public void setPatientMobileSettingService( PatientMobileSettingService patientMobileSettingService )
+ {
+ this.patientMobileSettingService = patientMobileSettingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Set<PatientAttribute> patientAtts;
+
+ public Set<PatientAttribute> getPatientAtts()
+ {
+ return patientAtts;
+ }
+
+ public void setPatientAtts( Set<PatientAttribute> patientAtts )
+ {
+ this.patientAtts = patientAtts;
+ }
+
+ private Collection<PatientAttribute> attributes;
+
+ public Collection<PatientAttribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ public void setAttributes( Collection<PatientAttribute> attributes )
+ {
+ this.attributes = attributes;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ //List of all attribute
+ attributes = patientAttributeService.getAllPatientAttributes();
+
+ Collection<PatientMobileSetting> paSettings = new HashSet<PatientMobileSetting>(
+ patientMobileSettingService.getCurrentSetting() );
+ if(paSettings != null){
+ Iterator<PatientMobileSetting> settingsIt = paSettings.iterator();
+
+ if ( settingsIt.hasNext() )
+ {
+ PatientMobileSetting setting = settingsIt.next();
+
+ //Selected List
+ patientAtts = setting.getPatientAttributes();
+
+ //Delete object which is in "selected list"
+ for(PatientAttribute attribute : patientAtts){
+ if(attributes.contains( attribute )){
+ attributes.remove( attribute );
+ }
+ }
+ }
+ else
+ {
+ System.out.println( "Setting is null" );
+ patientAtts = new HashSet<PatientAttribute>();
+ }
+ }
+// System.out.println( "List " + patientAtts + " has size: " + patientAtts.size() );
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/UpdateMobileSettingAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/UpdateMobileSettingAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/UpdateMobileSettingAction.java 2010-11-22 10:23:44 +0000
@@ -0,0 +1,97 @@
+package org.hisp.dhis.patient.action.mobilesetting;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientMobileSetting;
+import org.hisp.dhis.patient.PatientMobileSettingService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateMobileSettingAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private PatientAttributeService patientAttributeService;
+
+ public PatientAttributeService getPatientAttributeService()
+ {
+ return patientAttributeService;
+ }
+
+ public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+ {
+ this.patientAttributeService = patientAttributeService;
+ }
+
+ private PatientMobileSettingService patientMobileSettingService;
+
+ public PatientMobileSettingService getPatientMobileSettingService()
+ {
+ return patientMobileSettingService;
+ }
+
+ public void setPatientMobileSettingService( PatientMobileSettingService patientMobileSettingService )
+ {
+ this.patientMobileSettingService = patientMobileSettingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+ private Collection<String> selectedList = new HashSet<String>();
+
+ public void setSelectedList( Collection<String> selectedList )
+ {
+ this.selectedList = selectedList;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ if(selectedList.size() > 0){
+ PatientMobileSetting setting;
+ if(patientMobileSettingService.getCurrentSetting().size()>0){
+ setting = patientMobileSettingService.getCurrentSetting().iterator().next();
+ Set<PatientAttribute> attributes = new HashSet<PatientAttribute>();
+ setting.setPatientAttributes( attributes );
+ fillValues( attributes );
+ patientMobileSettingService.updatePatientMobileSetting( setting );
+ }else{
+ setting = new PatientMobileSetting();
+ Set<PatientAttribute> attributes = new HashSet<PatientAttribute>();
+ setting.setPatientAttributes( attributes );
+ fillValues( attributes );
+ patientMobileSettingService.savePatientMobileSetting( setting );
+ }
+ }else{
+ PatientMobileSetting setting;
+ if(patientMobileSettingService.getCurrentSetting().size()>0){
+ setting = patientMobileSettingService.getCurrentSetting().iterator().next();
+ Set<PatientAttribute> attributes = new HashSet<PatientAttribute>();
+ setting.setPatientAttributes( attributes );
+ fillValues( attributes );
+ patientMobileSettingService.updatePatientMobileSetting( setting );
+ }else{
+ setting = new PatientMobileSetting();
+ Set<PatientAttribute> attributes = new HashSet<PatientAttribute>();
+ setting.setPatientAttributes( attributes );
+ fillValues( attributes );
+ patientMobileSettingService.savePatientMobileSetting( setting );
+ }
+ }
+ return SUCCESS;
+ }
+
+ private void fillValues(Set<PatientAttribute> attributes){
+ for(String id : selectedList){
+ attributes.add( patientAttributeService.getPatientAttribute( Integer.parseInt( id )) );
+ }
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-11-16 07:37:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-11-22 10:23:44 +0000
@@ -1293,8 +1293,31 @@
</property>
<property name="patientAttributeValueService">
- <ref
- bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+ <ref bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+ </property>
+ </bean>
+
+ <!-- Patient Mobile Setting -->
+ <bean
+ id="org.hisp.dhis.patient.action.mobilesetting.ShowMobileSettingFormAction"
+ class="org.hisp.dhis.patient.action.mobilesetting.ShowMobileSettingFormAction"
+ scope="prototype">
+ <property name="patientMobileSettingService">
+ <ref bean="org.hisp.dhis.patient.PatientMobileSettingService" />
+ </property>
+ <property name="patientAttributeService">
+ <ref bean="org.hisp.dhis.patient.PatientAttributeService" />
+ </property>
+ </bean>
+
+ <bean id="org.hisp.dhis.patient.action.mobilesetting.UpdateMobileSettingAction"
+ class="org.hisp.dhis.patient.action.mobilesetting.UpdateMobileSettingAction"
+ scope="prototype">
+ <property name="patientMobileSettingService">
+ <ref bean="org.hisp.dhis.patient.PatientMobileSettingService" />
+ </property>
+ <property name="patientAttributeService">
+ <ref bean="org.hisp.dhis.patient.PatientAttributeService" />
</property>
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2010-11-21 15:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2010-11-22 10:23:44 +0000
@@ -1,3 +1,7 @@
+available_patient_attributes = Available Patient Attributes
+selected_patient_attributes = Selected Patient Attributes
+patient_mobile_setting = Patient Mobile Setting
+patientMobileSetting = Mobile Settings
yes = Yes
no = No
groupBy = Group By
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module_vi_VN.properties 2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module_vi_VN.properties 2010-11-22 10:23:44 +0000
@@ -1,3 +1,4 @@
+patientMobileSetting = Thiet lap mobile
yes = Co
no = Khong
groupBy = Chi muc nhom
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2010-11-21 15:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2010-11-22 10:23:44 +0000
@@ -1182,5 +1182,19 @@
<param name="javascripts">../dhis-web-commons/javascripts/ajaxfileupload.js, javascript/import.js</param>
</action>
+ <!-- Patient Mobile Setting Action -->
+
+ <action name="patientMobileSetting"
+ class="org.hisp.dhis.patient.action.mobilesetting.ShowMobileSettingFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-patient/showPatientMobileSetting.vm</param>
+ <param name="menu">/dhis-web-maintenance-patient/menu.vm</param>
+ </action>
+
+ <action name="editPatientMobileSetting"
+ class="org.hisp.dhis.patient.action.mobilesetting.UpdateMobileSettingAction">
+ <result name="success" type="redirect">patientMobileSetting.action</result>
+ </action>
+
</package>
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm 2010-11-16 05:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm 2010-11-22 10:23:44 +0000
@@ -9,6 +9,7 @@
<li><a href="programAttribute.action">$i18n.getString( "program_attribute" )</a></li>
<li><a href="caseaggregationMapForm.action">$i18n.getString( "case_aggregation_mapping" )</a></li>
<li><a href="validationCriteria.action">$i18n.getString( "validation_criteria" )</a></li>
+ <li><a href="patientMobileSetting.action">$i18n.getString( "patientMobileSetting" )</a></li>
</ul>
<h2>$i18n.getString( "import" )</h2>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/showPatientMobileSetting.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/showPatientMobileSetting.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/showPatientMobileSetting.vm 2010-11-22 10:23:44 +0000
@@ -0,0 +1,52 @@
+<script>
+ jQuery(document).ready( function()
+ {
+ validation( 'editPatientMobileSetting', function( form ){ form.submit() }, function(){ selectAllById('selectedList') });
+ });
+</script>
+<h3>$i18n.getString( "patient_mobile_setting" )</h3>
+<form id="editPatientMobileSetting" name="editPatientMobileSetting" action="editPatientMobileSetting.action" method="post" >
+ <table id="dataElementSelectionArea">
+ <col/> ## Available DataElements
+ <col/> ## Filter
+ <col/> ## Selected DataElements
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_patient_attributes" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_patient_attributes" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <!-- List of all available PatientAttribute -->
+ <select size="15" id="availableList" name="availableList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'availableList', 'selectedList');">
+ #foreach( $att in $attributes )
+ <option value="$att.id">$encoder.htmlEncode( $att.name )</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="moveSelectedById( 'availableList', 'selectedList');"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="moveSelectedById( 'selectedList', 'availableList');"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableList', 'selectedList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'selectedList', 'availableList' );"/>
+ </td>
+ <td>
+ <!-- List of all selected PatientAttribute -->
+ <select size="15" id="selectedList" name="selectedList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'selectedList', 'availableList');">
+ #foreach( $selectedAtt in $patientAtts )
+ <option value="$selectedAtt.id">$encoder.htmlEncode( $selectedAtt.name )</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:20em"/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</form>