← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11082: Only show attributes for programs the User has access to through the user role in Person Dashboar...

 

------------------------------------------------------------
revno: 11082
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-05-29 21:28:47 +0700
message:
  Only show attributes for programs the User has access to through the user role in Person Dashboard; fixed bug - Don't change icon when to click Risk icon in dashboard.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2013-04-17 07:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2013-05-29 14:28:47 +0000
@@ -32,6 +32,7 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -40,6 +41,7 @@
 import org.hisp.dhis.patient.PatientAudit;
 import org.hisp.dhis.patient.PatientAuditService;
 import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
@@ -211,18 +213,50 @@
     {
         patient = patientService.getPatient( patientId );
 
+        Collection<Program> programs = programService
+            .getProgramsByCurrentUser( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
+        programs.addAll( programService.getProgramsByCurrentUser( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
+
         // ---------------------------------------------------------------------
         // Get patient-attribute-values
         // ---------------------------------------------------------------------
 
         attributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
+        Iterator<PatientAttributeValue> iterAttribute = attributeValues.iterator();
+
+        for ( Program program : programs )
+        {
+            Collection<PatientAttribute> atttributes = program.getPatientAttributes();
+            while ( iterAttribute.hasNext() )
+            {
+                PatientAttributeValue attributeValue = iterAttribute.next();
+                if ( !atttributes.contains( attributeValue.getPatientAttribute() ) )
+                {
+                    iterAttribute.remove();
+                }
+            }
+        }
 
         // ---------------------------------------------------------------------
         // Get patient-identifiers
         // ---------------------------------------------------------------------
 
         identifiers = patient.getIdentifiers();
-
+        Iterator<PatientIdentifier> iterIdentifier = identifiers.iterator();
+        
+        for ( Program program : programs )
+        {
+            Collection<PatientIdentifierType> identifierTypes = program.getPatientIdentifierTypes();
+            while ( iterIdentifier.hasNext() )
+            {
+                PatientIdentifier identifier = iterIdentifier.next();
+                if ( !identifierTypes.contains( identifier.getIdentifierType() ) )
+                {
+                    iterIdentifier.remove();
+                }
+            }
+        }
+        
         // ---------------------------------------------------------------------
         // Get relationship
         // ---------------------------------------------------------------------
@@ -235,8 +269,6 @@
         // Get program enrollment
         // ---------------------------------------------------------------------
 
-        Collection<Program> programs = programService.getProgramsByCurrentUser();
-
         activeProgramInstances = new HashSet<ProgramInstance>();
 
         completedProgramInstances = new HashSet<ProgramInstance>();
@@ -259,10 +291,6 @@
         }
 
         // ---------------------------------------------------------------------
-        // Get program-indicators
-        // ---------------------------------------------------------------------
-
-        // ---------------------------------------------------------------------
         // Patient-Audit
         // ---------------------------------------------------------------------
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm	2013-05-29 10:19:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm	2013-05-29 14:28:47 +0000
@@ -12,8 +12,8 @@
 			#end
 			
 			$i18n.getString('toggle_risk_status')
-			<a href='javascript:markForFollowup($programInstance.id, false)' #if( $followup == 'false') class='hidden' #end id='imgMarkFollowup' title='$i18n.getString("unmark_risk")' ><img src='images/risk_large.png'></a>
-			<a href='javascript:markForFollowup($programInstance.id, true)' #if( $followup == 'true') class='hidden' #end id='imgUnmarkFollowup' title='$i18n.getString("mark_risk")' ><img src='images/unrisk_large.png'></a>			
+			<a href='javascript:markForFollowup($programInstance.id, false)' #if( $followup == 'false') class='hidden' #end name='imgMarkFollowup' title='$i18n.getString("toggle_risk_status")' ><img src='images/risk_large.png'></a>
+			<a href='javascript:markForFollowup($programInstance.id, true)' #if( $followup == 'true') class='hidden' #end name='imgUnmarkFollowup' title='$i18n.getString("toggle_risk_status")' ><img src='images/unrisk_large.png'></a>			
 		</td>
 	</tr>
 </table>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-05-29 08:36:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-05-29 14:28:47 +0000
@@ -2071,14 +2071,14 @@
 		{   
 			 if( followup )
 			 {
-				showById('imgMarkFollowup');
-				hideById('imgUnmarkFollowup');
+				jQuery('[name=imgMarkFollowup]').show();
+				jQuery('[name=imgUnmarkFollowup]').hide();
 				showById("followup_" + programInstanceId);
 			 }
 			 else
 			 {
-				hideById('imgMarkFollowup');
-				showById('imgUnmarkFollowup');
+				jQuery('[name=imgMarkFollowup]').hide();
+				jQuery('[name=imgUnmarkFollowup]').show();
 				hideById("followup_" + programInstanceId);
 			 }
 		});

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2013-05-29 08:36:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2013-05-29 14:28:47 +0000
@@ -16,8 +16,8 @@
 				<td class='bold coordinates1'>$i18n.getString('program'):</td>
 				<td class='coordinates2'>$program.displayName</td>
 				<td rowspan='2'>
-					<a href='javascript:markForFollowup($programStageInstance.programInstance.id, false)' #if( $programStageInstance.programInstance.followup == 'false') class='hidden' #end id='imgMarkFollowup' title='$i18n.getString("unmark_risk")' ><img src='images/risk_large.png'></a>
-					<a href='javascript:markForFollowup($programStageInstance.programInstance.id, true)' #if( $programStageInstance.programInstance.followup == 'true') class='hidden' #end id='imgUnmarkFollowup' title='$i18n.getString("mark_risk")' ><img src='images/unrisk_large.png'></a>			
+					<a href='javascript:markForFollowup($programStageInstance.programInstance.id, false)' #if( $programStageInstance.programInstance.followup == 'false') class='hidden' #end name='imgMarkFollowup' title='$i18n.getString("imgMarkFollowup")' ><img src='images/risk_large.png'></a>
+					<a href='javascript:markForFollowup($programStageInstance.programInstance.id, true)' #if( $programStageInstance.programInstance.followup == 'true') class='hidden' #end name='imgUnmarkFollowup' title='$i18n.getString("imgMarkFollowup")' ><img src='images/unrisk_large.png'></a>			
 				</td>
 			</tr>
 			<tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2013-05-29 08:36:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2013-05-29 14:28:47 +0000
@@ -32,8 +32,8 @@
 			#else
 				#set($followup='false')
 			#end
-			<a href='javascript:markForFollowup($programInstance.id, false)' #if( $followup == 'false') class='hidden' #end id='imgMarkFollowup' title='$i18n.getString("unmark_risk")' ><img src='images/risk_large.png'></a>
-			<a href='javascript:markForFollowup($programInstance.id, true)' #if( $followup == 'true') class='hidden' #end id='imgUnmarkFollowup' title='$i18n.getString("mark_risk")' ><img src='images/unrisk_large.png'></a>			
+			<a href='javascript:markForFollowup($programInstance.id, false)' #if( $followup == 'false') class='hidden' #end name='imgMarkFollowup' title='$i18n.getString("toggle_risk_status")' ><img src='images/risk_large.png'></a>
+			<a href='javascript:markForFollowup($programInstance.id, true)' #if( $followup == 'true') class='hidden' #end name='imgUnmarkFollowup' title='$i18n.getString("toggle_risk_status")' ><img src='images/unrisk_large.png'></a>			
 		</td>
 		<td rowspan='3' colspan='8'>
 			<textarea id="comment" name='comment' maxlength="360" style="height:100px;width:100%">$!encoder.htmlEncode( $programInstance.patientComment.commentText )</textarea>