← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11538: hide/show user group on add program/program stage page

 

------------------------------------------------------------
revno: 11538
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-07-30 10:23:05 +0700
message:
  hide/show user group on add program/program stage page
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.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-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2013-07-26 02:37:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2013-07-30 03:23:05 +0000
@@ -365,8 +365,15 @@
             reminder.setDateToCompare( datesToCompare.get( i ) );
             reminder.setSendTo( sendTo.get( i ) );
             reminder.setWhenToSend( whenToSend.get( i ) );
-            UserGroup selectedUserGroup = userGroupService.getUserGroup( userGroup.get( i ) );
-            reminder.setUserGroup( selectedUserGroup );
+            if ( sendTo.get( i ) == PatientReminder.SEND_TO_USER_GROUP )
+            {
+                UserGroup selectedUserGroup = userGroupService.getUserGroup( userGroup.get( i ) );
+                reminder.setUserGroup( selectedUserGroup );
+            }
+            else
+            {
+                reminder.setUserGroup( null );
+            }
             patientReminders.add( reminder );
         }
         program.setPatientReminders( patientReminders );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2013-07-26 09:32:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2013-07-30 03:23:05 +0000
@@ -286,8 +286,15 @@
             reminder.setDateToCompare( PatientReminder.DUE_DATE_TO_COMPARE );
             reminder.setSendTo( sendTo.get( i ) );
             reminder.setWhenToSend( whenToSend.get( i ) );
-            UserGroup selectedUserGroup = userGroupService.getUserGroup( userGroup.get( i ) );
-            reminder.setUserGroup( selectedUserGroup );
+            if ( sendTo.get( i ) == PatientReminder.SEND_TO_USER_GROUP )
+            {
+                UserGroup selectedUserGroup = userGroupService.getUserGroup( userGroup.get( i ) );
+                reminder.setUserGroup( selectedUserGroup );
+            }
+            else
+            {
+                reminder.setUserGroup( null );
+            }
             patientReminders.add( reminder );
         }
         programStage.setPatientReminders( patientReminders );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2013-07-26 02:37:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2013-07-30 03:23:05 +0000
@@ -6,7 +6,7 @@
 	program_SMS_reminder_form +="</select>";
 
 	jQuery( document ).ready( function()
-	{
+	{	
 		validation( 'addProgramForm', function( form ){ 
 		if( duplicate==true) 
 			return false;
@@ -89,6 +89,14 @@
 	
 	checkValueIsExist( "name", "validateProgram.action" );	
 });
+	function onchangeUserGroup( id )
+	{
+		var value = document.getElementById( 'sendTo'+id ).value;
+		hideById( 'tr'+id );
+		if ( value == 5) {
+			showById( 'tr'+id );
+		}
+	};
 </script>
 
 <h3>$i18n.getString( "create_new_program" )</h3>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2013-07-26 09:32:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2013-07-30 03:23:05 +0000
@@ -4,6 +4,15 @@
 	program_stage_SMS_reminder_form += "<option value='$group.id'>$i18n.getString($group.name)</option>";
 #end
 program_stage_SMS_reminder_form +="</select>";
+
+function onchangeUserGroup( id )
+	{
+		var value = document.getElementById( 'sendTo'+id ).value;
+		hideById( 'tr'+id );
+		if ( value == 5) {
+			showById( 'tr'+id );
+		}
+	};
 </script>
 <script type="text/javascript" src="javascript/addProgramStageForm.js"></script>