← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11531: send SMS to usergroup in add program stage form

 

------------------------------------------------------------
revno: 11531
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-07-26 16:32:25 +0700
message:
  send SMS to usergroup in add program stage form
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowAddProgramFormAction.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/resources/META-INF/dhis/beans.xml
  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/javascript/addProgramStageForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js


--
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/GetProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramAction.java	2013-07-22 09:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramAction.java	2013-07-26 09:32:25 +0000
@@ -36,6 +36,8 @@
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -71,6 +73,13 @@
         this.selectionTreeManager = selectionTreeManager;
     }
     
+    private UserGroupService userGroupService;
+    
+    public void setUserGroupService( UserGroupService userGroupService )
+    {
+        this.userGroupService = userGroupService;
+    }
+    
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -139,6 +148,13 @@
         return availableOrgunitGroups;
     }
     
+    private List<UserGroup> userGroups;
+    
+    public List<UserGroup> getUserGroups()
+    {
+        return userGroups;
+    }
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -153,6 +169,8 @@
 
         selectionTreeManager.setSelectedOrganisationUnits( program.getOrganisationUnits() );
         
+        userGroups = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowAddProgramFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowAddProgramFormAction.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/ShowAddProgramFormAction.java	2013-07-26 09:32:25 +0000
@@ -80,6 +80,7 @@
     {
         this.userGroupService = userGroupService;
     }
+    
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------

=== 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-02 12:24:02 +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-26 09:32:25 +0000
@@ -41,6 +41,8 @@
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -83,6 +85,13 @@
     {
         this.programStageDataElementService = programStageDataElementService;
     }
+    
+    private UserGroupService userGroupService;
+
+    public void setUserGroupService( UserGroupService userGroupService )
+    {
+        this.userGroupService = userGroupService;
+    }
 
     // -------------------------------------------------------------------------
     // Input/Output
@@ -232,7 +241,14 @@
     {
         this.allowDateInFutures = allowDateInFutures;
     }
+    
+    private List<Integer> userGroup = new ArrayList<Integer>();
 
+    public void setUserGroup( List<Integer> userGroup )
+    {
+        this.userGroup = userGroup;
+    }
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -270,6 +286,8 @@
             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 );
             patientReminders.add( reminder );
         }
         programStage.setPatientReminders( patientReminders );

=== 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	2013-07-26 02:37:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2013-07-26 09:32:25 +0000
@@ -204,6 +204,7 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="selectionTreeManager"
 			ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.patient.action.program.RemoveProgramAction"
@@ -291,6 +292,7 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="programStageDataElementService"
 			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 	</bean>
 
 	<bean

=== 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-02 14:26:44 +0000
+++ 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
@@ -1,3 +1,10 @@
+<script>
+var program_stage_SMS_reminder_form ="<select type='text' id='userGroup$index' name='userGroup$index' class='userGroup'>";
+#foreach( $group in $userGroups )
+	program_stage_SMS_reminder_form += "<option value='$group.id'>$i18n.getString($group.name)</option>";
+#end
+program_stage_SMS_reminder_form +="</select>";
+</script>
 <script type="text/javascript" src="javascript/addProgramStageForm.js"></script>
 
 <h3>$i18n.getString( "create_new_program_stage" )</h3>
@@ -11,7 +18,7 @@
 	<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
 	<select id='sendTo' name="sendTo" multiple="multiple" class="hidden"></select>
 	<select id='whenToSend' name="whenToSend" multiple="multiple" class="hidden"></select>
-	
+	<select id='userGroup' name="userGroup" multiple="multiple" class="hidden"></select>
 <table>
 	<thead>
 		<tr><th colspan="2">$i18n.getString( "program_stage_details" )</th></tr>
@@ -188,6 +195,7 @@
 	var i18n_send_when_to = '$encoder.jsEscape( $i18n.getString( "send_when_to" ) , "'")';
 	var i18n_from_the_day_set = '$encoder.jsEscape( $i18n.getString( "from_the_day_set" ) , "'")';
 	var i18n_complete_event = '$encoder.jsEscape( $i18n.getString( "complete_event" ) , "'")';
+	var i18n_user_group = '$encoder.jsEscape( $i18n.getString( "user_group" ) , "'")';
 	
 	var programStageList = new Array();
 	#foreach($programStage in $program.programStages)

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	2013-07-02 12:24:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	2013-07-26 09:32:25 +0000
@@ -44,7 +44,10 @@
 		sendTo.empty();
 		
 		var whenToSend = jQuery( "#whenToSend" );
-		whenToSend.empty();		
+		whenToSend.empty();
+		
+		var userGroup = jQuery( "#userGroup" );
+		userGroup.empty();	
 		
 		jQuery("#selectedList").find("tr").each( function( i, item ){ 
 			
@@ -78,6 +81,9 @@
 		jQuery(".whenToSend").each( function( i, item ){ 
 			whenToSend.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
 		});
+		jQuery(".userGroup").each( function( i, item ){ 
+			userGroup.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
+		});
 	});
 	
 	jQuery("#availableList").dhisAjaxSelect({

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2013-07-22 09:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2013-07-26 09:32:25 +0000
@@ -274,7 +274,7 @@
 				+ 	'<td>'
 				+ 		'<select id="whenToSend' + rowId + '" name="whenToSend' + rowId + '" class="whenToSend" onchange="whenToSendOnChange(' + rowId + ')" >'
 				+ 			'<option value="">' + i18n_from_the_day_set + '</option>'
-				+ 			'<option value="2">' + i18n_complete_program + '</option>'
+				+ 			'<option value="3">' + i18n_complete_program + '</option>'
 				+ 		'</select>'
 				+	'</td>'
 				+ '</tr>'