← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8211: Add Remove relationship button in web-light

 

------------------------------------------------------------
revno: 8211
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-09-24 10:28:31 +0700
message:
  Add Remove relationship button in web-light
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2012-09-17 04:35:16 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2012-09-24 03:28:31 +0000
@@ -195,7 +195,7 @@
     
     //Use for add relationship
     
-    private Map<String,Patient> relatedPeople;
+    /*private Map<String,Patient> relatedPeople;
 
     public Map<String, Patient> getRelatedPeople()
     {
@@ -205,6 +205,17 @@
     public void setRelatedPeople( Map<String, Patient> relatedPeople )
     {
         this.relatedPeople = relatedPeople;
+    }*/
+    private Map<Relationship,Patient> relatedPeople;
+    
+    public Map<Relationship, Patient> getRelatedPeople()
+    {
+        return relatedPeople;
+    }
+
+    public void setRelatedPeople( Map<Relationship, Patient> relatedPeople )
+    {
+        this.relatedPeople = relatedPeople;
     }
 
     private Collection<RelationshipType> relationshipTypes;
@@ -248,7 +259,7 @@
         throws Exception
     {
         programInstances.clear();
-        relatedPeople = new HashMap<String, Patient>();
+        relatedPeople = new HashMap<Relationship, Patient>();
 
         patient = patientService.getPatient( patientId );
         for ( ProgramInstance programInstance : programInstanceService.getProgramInstances( patient ) )
@@ -266,12 +277,14 @@
         {
             if ( relationship.getPatientA().getId() != patient.getId() )
             {
-                relatedPeople.put( relationship.getRelationshipType().getName(), relationship.getPatientA() );
+                //relatedPeople.put( relationship.getRelationshipType().getName(), relationship.getPatientA() );
+                relatedPeople.put( relationship, relationship.getPatientA());
             }
 
             if ( relationship.getPatientB().getId() != patient.getId() )
             {
-                relatedPeople.put( relationship.getRelationshipType().getName(), relationship.getPatientB() );
+                //relatedPeople.put( relationship.getRelationshipType().getName(), relationship.getPatientB() );
+                relatedPeople.put( relationship, relationship.getPatientB());
             }
         }
         

=== 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-09-21 10:18:47 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2012-09-24 03:28:31 +0000
@@ -485,4 +485,11 @@
 		<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
 		<property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
+	
+	<bean id="org.hisp.dhis.light.namebaseddataentry.action.DeleteRelationshipAction"
+		class="org.hisp.dhis.light.namebaseddataentry.action.DeleteRelationshipAction">
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="relationshipService"
+			ref="org.hisp.dhis.relationship.RelationshipService" />
+	</bean>
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2012-09-21 10:18:47 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2012-09-24 03:28:31 +0000
@@ -79,7 +79,6 @@
       <param name="page">/dhis-web-light/trackingMenu.vm</param>
       <param name="requiredAuthorities">M_dhis-web-maintenance-patient</param>
     </action>
-	
     <action name="selectNamebasedOrganisationUnit"
         class="org.hisp.dhis.light.namebaseddataentry.action.GetNamebasedOrganisationUnitsAction">
 		<result name="redirect" type="redirect">/light/selectActivityType.action?orgUnitId=${orgUnitId}</result>
@@ -130,7 +129,6 @@
       </result>
       <result name="error" type="velocity">/dhis-web-light/main.vm</result>
       <param name="page">/dhis-web-light/namebased/programStageForm.vm</param>
-	  <param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
     </action>
 
     <action name="showBeneficiaryDetail"
@@ -182,8 +180,14 @@
 
     <action name="addNewRelationship"
         class="org.hisp.dhis.light.namebaseddataentry.action.AddNewRalationshipAction">
-      <result name="redirect" type="redirect">showPatientProgramList.action?patientId=${originalPatientId}&amp;validated=true</result>
-	  <param name="requiredAuthorities">F_PATIENT_UPDATE</param>
+      <result name="redirect" type="redirect">showPatientProgramList.action?patientId=${originalPatientId}&amp;validated=true
+      </result>
+    </action>
+    
+    <action name="deleteRelationship"
+    	class="org.hisp.dhis.light.namebaseddataentry.action.DeleteRelationshipAction">
+      <result name="redirect" type="redirect">showPatientProgramList.action?patientId=${currentPatientId}&amp;validated=true
+      </result>
     </action>
 
     <action name="showPatientProgramList"
@@ -208,7 +212,6 @@
         class="org.hisp.dhis.light.namebaseddataentry.action.SaveRepeatableEventAction">
       <result name="success" type="redirect">showPatientProgramStageList.action?patientId=${patientId}&amp;programInstanceId=${programInstanceId}&amp;programId=${programId}&amp;validated=false
       </result>
-	  <param name="requiredAuthorities">F_PATIENT_UPDATE, F_PROGRAM_ENROLLMENT</param>
     </action>
 	  
 	  <action name="showPatientLocationForm"
@@ -220,7 +223,6 @@
 	  <action name="registerPatientLocation"
         class="org.hisp.dhis.light.namebaseddataentry.action.RegisterPatientLocationAction">
       <result name="success" type="redirect">showPatientProgramList.action?patientId=${patientId}</result>
-	   <param name="requiredAuthorities">F_PATIENT_UPDATE</param>
     </action>
 
     <!-- Beneficiary Registration -->
@@ -245,7 +247,6 @@
 	  <result name="redirect" type="redirect">/light/showAddNewRelationshipForm.action?originalPatientId=${originalPatientId}&amp;relatedPatientId=${patientId}&amp;relationshipTypeId=${relationshipTypeId}</result>
       <result name="error" type="velocity">/dhis-web-light/main.vm</result>
       <param name="page">/dhis-web-light/registration/beneficiaryRegistrationForm.vm</param>
-	  <param name="requiredAuthorities">F_PATIENT_ADD</param>
     </action>
 
     <!-- Beneficiary Enrollment -->
@@ -285,7 +286,6 @@
       <result name="success" type="redirect">/light/showPatientProgramList.action?patientId=${patientId}</result>
       <result name="error" type="velocity">/dhis-web-light/main.vm</result>
       <param name="page">/dhis-web-light/enrollment/programEnrollmentForm.vm</param>
-	  <param name="requiredAuthorities">F_PATIENT_UPDATE, F_PROGRAM_ENROLLMENT</param>
     </action>
 
     <!-- Single Event -->
@@ -315,7 +315,6 @@
       </result>
       <result name="error" type="velocity">/dhis-web-light/main.vm</result>
       <param name="page">/dhis-web-light/singleevent/singleEventForm.vm</param>
-	  <param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
     </action>
 
     <!-- Reports -->

=== 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-09-20 08:35:03 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm	2012-09-24 03:28:31 +0000
@@ -37,13 +37,15 @@
 			#end
 		#end
 	#end
-
+	
+	#if ( $aggregateAuthority == true)
+		<li><a href="selectOrganisationUnit.action">$i18n.getString( "agregate_reporting" )</a></li>
+	#end
+	
 	#if ( $trackingAuthority == true )
 		<li><a href="trackingMenu.action">$i18n.getString( "tracking" )</a></li>
 	#end
-	#if ( $aggregateAuthority == true)
-		<li><a href="selectOrganisationUnit.action">$i18n.getString( "agregate_reporting" )</a></li>
-	#end	
+
     <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>		

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-09-20 08:52:26 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-09-24 03:28:31 +0000
@@ -80,7 +80,8 @@
         #if( $relatedPeople.size() > 0)
             #foreach( $key in $relatedPeople.keySet() )
 				#set ( $person = $relatedPeople.get($key))
-          		<li><a href="showPatientProgramList.action?patientId=$person.id">$!encoder.htmlEncode( $person.fullName ) ($key)</a></li>
+          		<li><a href="showPatientProgramList.action?patientId=$person.id">$!encoder.htmlEncode( $person.fullName ) ($key.getRelationshipType().getName())</a> -
+				<a href="deleteRelationship.action?currentPatientId=$patient.id&relationshipTypeId=$key.id">Remove</a></li>
           	#end
         #else
             <li>$i18n.getString("no_relationships")</li>