← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8206: Remove the gateway part in Program Tracking.

 

------------------------------------------------------------
revno: 8206
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-09-23 18:52:27 +0700
message:
  Remove the gateway part in Program Tracking.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetOutboundSmsListAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java
  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/smsReminder.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSmsForm.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/reminder/GetOutboundSmsListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetOutboundSmsListAction.java	2012-09-11 13:35:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetOutboundSmsListAction.java	2012-09-23 11:52:27 +0000
@@ -30,7 +30,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
@@ -38,9 +37,7 @@
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.sms.outbound.OutboundSms;
-import org.hisp.dhis.sms.outbound.OutboundSmsTransportService;
 import org.hisp.dhis.user.CurrentUserService;
-import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
@@ -66,10 +63,7 @@
     }
 
     private PatientAttributeValueService patientAttributeValueService;
-
-    @Autowired
-    private OutboundSmsTransportService transportService;
-
+    
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -130,11 +124,6 @@
         return outboundSms;
     }
 
-    public Map<String, String> getGatewayMap()
-    {
-        return transportService.getGatewayMap();
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java	2012-09-12 04:14:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java	2012-09-23 11:52:27 +0000
@@ -90,14 +90,7 @@
     {
         this.programStageInstanceId = programStageInstanceId;
     }
-
-    private String gatewayId;
-
-    public void setGatewayId( String gatewayId )
-    {
-        this.gatewayId = gatewayId;
-    }
-
+    
     private String msg;
 
     public void setMsg( String msg )
@@ -131,7 +124,7 @@
             {
                 OutboundSms outboundSms = new OutboundSms( msg, phoneNumber );
                 outboundSms.setSender( currentUserService.getCurrentUsername() );
-                outboundSmsService.sendMessage( outboundSms, gatewayId );
+                outboundSmsService.sendMessage( outboundSms, null );
                 
                 List<OutboundSms> outboundSmsList = programStageInstance.getOutboundSms();
                 if( outboundSmsList == null)

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java	2012-09-12 04:14:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java	2012-09-23 11:52:27 +0000
@@ -125,13 +125,6 @@
     // Input & Output
     // -------------------------------------------------------------------------
 
-    private String gatewayId;
-
-    public void setGatewayId( String gatewayId )
-    {
-        this.gatewayId = gatewayId;
-    }
-
     private String msg;
 
     public void setMsg( String msg )
@@ -169,7 +162,7 @@
             outboundSms.setRecipients( phoneNumberList );
             outboundSms.setSender( currentUserService.getCurrentUsername() );
 
-            outboundSmsService.sendMessage( outboundSms, gatewayId );
+            outboundSmsService.sendMessage( outboundSms, null );
 
             programStageInstanceService.updateProgramStageInstances( programStageInstanceIds, outboundSms );
 

=== 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	2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-23 11:52:27 +0000
@@ -616,7 +616,7 @@
 				if( dueDate < dueDateInStage && !flag)
 				{	
 					jQuery('<td>'
-						+ '<span id="org_' + programStageInstanceId + '">' + getFieldValue('orgunitName') + '</span>'
+						+ '<span id="org_' + programStageInstanceId + '">' + getFieldValue('orgunitName') + '</span><br>'
 						+ '<input name="programStageBtn" '
 						+ 'id="' + elementId + '" ' 
 						+ 'psid="' + programStageId + '" '
@@ -637,7 +637,7 @@
 			{
 				jQuery("#programStageIdTR_" + programInstanceId).append('<td><img src="images/rightarrow.png"></td>'
 					+ '<td>'
-					+ '<span id="org_' + programStageInstanceId + '">' + getFieldValue('orgunitName') + '</span>'
+					+ '<span id="org_' + programStageInstanceId + '">' + getFieldValue('orgunitName') + '</span><br>'
 					+ '<input name="programStageBtn" '
 					+ 'id="' + elementId + '" ' 
 					+ 'psid="' + programStageId + '" '

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2012-09-23 07:34:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2012-09-23 11:52:27 +0000
@@ -140,26 +140,33 @@
 	else{
 		sendSmsToList();
 	}
-	
 }
 
-function sendSmsOnePatient()
+function sendSmsOnePatient( field, programStageInstanceId )
 {
+	setInnerHTML('smsError', '');
+	if(field.value==""){
+		jQuery('#smsError').css("color", "red");
+		setInnerHTML('smsError', i18n_this_field_is_required);
+		return;
+	}
+	
+	field.style.backgroundColor = SAVING_COLOR;
 	programStageInstanceId = getFieldValue( 'programStageInstanceId' );
 	jQuery.postUTF8( 'sendSMS.action',
 		{
 			programStageInstanceId: programStageInstanceId,
-			gatewayId: getFieldValue( 'gatewayId' ),
-			msg: getFieldValue( 'smsMessage' )
+			msg: field.value
 		}, function ( json )
 		{
 			if ( json.response == "success" ) {
-				showSuccessMessage( json.message );
+				jQuery('#smsError').css("color", "green");
+				setInnerHTML('smsError', json.message);
 				var currentTime = date.getHours() + ":" + date.getMinutes();
 				jQuery('#commentTB').prepend("<tr><td>" + getFieldValue('currentDate') + " " + currentTime + "</td>"
 					+ "<td>" + getFieldValue('programStageName') + "</td>"
 					+ "<td>" + getFieldValue('currentUsername') + "</td>"
-					+ "<td>" + getFieldValue('smsMessage') + "</td></tr>");
+					+ "<td>" + field.value + "</td></tr>");
 				var noMessage = eval( getInnerHTML('noMessageDiv_' + programStageInstanceId)) + 1;
 			}
 			else {
@@ -172,14 +179,13 @@
 			else{
 				commentDivToggle(false);
 			}
-			jQuery('#sendSmsFormDiv').dialog('close');
-		}); 
+			field.style.backgroundColor = SUCCESS_COLOR;
+		});
 }
 
 function sendSmsToList()
 {
 	params = getSearchParams();
-	params += "&gatewayId=" + getFieldValue( 'gatewayId' );
 	params += "&msg=" + getFieldValue( 'smsMessage' );
 	params += "&programStageInstanceId=" + getFieldValue('programStageInstanceId');
 	$.ajax({
@@ -226,7 +232,7 @@
 function addComment( field, programStageInstanceId )
 {
 	field.style.backgroundColor = SAVING_COLOR;
-	var commentText = getFieldValue( 'commentText' );
+	var commentText = field.value;
 	if( commentText != '')
 	{
 		jQuery.postUTF8( 'addPatientComment.action',

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm	2012-09-20 13:04:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm	2012-09-23 11:52:27 +0000
@@ -102,8 +102,8 @@
 			<table class='mainPageTable' id='progarmStageListDiv' name='progarmStageListDiv' >
 				<col width="10px">
 				<col width="200px">
-				<col width="180px">
-				<col width="150px">
+				<col width="200px">
+				<col width="160px">
 				<col/>
 				<col width='60px'/>  
 				<tr>
@@ -111,8 +111,8 @@
 					<th>$i18n.getString( "program_stage" )</th>                   
 					<th>$i18n.getString( "reschedule_due_date" )</th>       
 					<th>$i18n.getString( "status" )</th>
-					<th>$i18n.getString( "post_comment" )</th>
-					<th>$i18n.getString( "operation" )</th>
+					<th>$i18n.getString( "message" )</th>
+					<th>$i18n.getString( "remove" )</th>
 				</tr>
 				
 			#set( $rowCount = 0 )
@@ -160,11 +160,11 @@
 						</script>
 					</td>
 					<td>
-						<input type='text' id='commentText' name='commentText' style="width:355px;" onkeypress="keypress(event,this,'$programStageInstance.id')">
-						<input type='button' value="+" class='tiny-button' title='$i18n.getString("post_comment")' onclick="addComment(this,'$programStageInstance.id')">
+						<input type='text' id='message_$programStageInstance.id' name='message_$programStageInstance.id' style="width:300px;" class="{validate:{required:true,maxlength:160}}">
+						<input type='button' value="+" class='tiny-button' title='$i18n.getString("post_comment")' onclick="addComment(byId('message_$programStageInstance.id'),'$programStageInstance.id')">
+						<input type="button" value="&raquo;" class='tiny-button' title="$i18n.getString( 'send_sms' )" onclick="setFieldValue( 'programStageInstanceId',$programStageInstance.id);sendSmsOnePatient(byId('message_$programStageInstance.id'),'$programStageInstance.id');"/>
 					</td>
 					<td>
-						<a href="javascript:setFieldValue('sendToList', false);showSendSmsForm('$programStageInstance.programStage.name',$programStageInstance.id)" title='$i18n.getString( "send_sms" )'><img src="images/sms.png" alt='$i18n.getString( "send_sms" )'></a>
 						#if($programStageInstance.programStage.irregular=='true' && ($status==3 || $status==4 || $status==5 ))
 							<a href="javascript:removeEvent($programStageInstance.id, false)" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
 						#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2012-09-20 05:15:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2012-09-23 11:52:27 +0000
@@ -65,7 +65,6 @@
 <div id="smsManagementForm">
 	<ul>
 		<li><a href="#tab-1">$i18n.getString("reschedule_and_set_status")</a></li>
-		<li><a href="#tab-3">$i18n.getString("send_sms")</a></li>
 		<li><a href="#tab-2">$i18n.getString("tracking_history")</a></li>
 	</ul>
 	
@@ -114,9 +113,20 @@
 			<tr>
 				<td>$i18n.getString( "post_comment" )</td>
 				<td>
-					<input type='text' id='commentText' name='commentText' onkeypress="keypress(event,this,'$programStageInstance.id')">
-					<input type='button' value="+" class='tiny-button' title='$i18n.getString("post_comment")' onclick="addComment(this,'$programStageInstance.id')">
-				</td>
+					<input type='text' id='commentText' name='commentText' onkeypress="keypress(event,this,'$programStageInstance.id');">
+					<input type='button' value="+" class='tiny-button' title='$i18n.getString("post_comment")' onclick="addComment( byId('commentText'),'$programStageInstance.id');">
+				</td>
+			</tr>
+			<tr>
+				<td>$i18n.getString( "message" )</td>
+				<td>
+					<textarea id="smsMessage" name="smsMessage" style="width:260px;height:100px;" class="{validate:{required:true,maxlength:160}}"></textarea>
+					<input type="button" value="$i18n.getString( 'send_sms' )" onclick="sendSmsOnePatient( byId('smsMessage'),'$programStageInstance.id' );"/>
+				</td>
+			</tr>
+			<tr>
+				<td></td>
+				<td id="smsError" style="color:red;"></td>
 			</tr>
 		</table>
 	</div>
@@ -186,18 +196,15 @@
 		<input type='button' id="showCommentBtn" name="showCommentBtn" value='$i18n.getString("show_hide_more")' #if($count && $count<=5) class='hidden' #end onclick='commentDivToggle(false);'>
 		<input type='button' id="hideCommentBtn" name="hideCommentBtn" value='$i18n.getString("show_hide_more")' class='hidden' onclick='commentDivToggle(true);'>
 	</div>
-	
-	<div id="tab-3">
-		#parse( "/dhis-web-caseentry/sendSmsForm.vm" )
-	</div>
-	
 </div>
 
 <script type="text/javascript">
 	jQuery(document).ready(	function(){
-		var i18n_color_quick_help = '$encoder.jsEscape( $i18n.getString( "color_quick_help" ) , "'")';
-		var i18n_comment_added = '$encoder.jsEscape( $i18n.getString( "comment_added" ) , "'")';
 		setFieldValue( "programStageInstanceId", "$!programStageInstance.id" );
 	});
 	
+	var i18n_color_quick_help = '$encoder.jsEscape( $i18n.getString( "color_quick_help" ) , "'")';
+	var i18n_comment_added = '$encoder.jsEscape( $i18n.getString( "comment_added" ) , "'")';
+	var i18n_this_field_is_required = '$encoder.jsEscape( $i18n.getString( "this_field_is_required" ) , "'")';
+	
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSmsForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSmsForm.vm	2012-09-21 07:05:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSmsForm.vm	2012-09-23 11:52:27 +0000
@@ -7,44 +7,27 @@
 	});
 </script>
 
-#if ( $!gatewayMap && $!gatewayMap.size() > 0 )
-	<form id="sendSMSForm" name="sendSMSForm" action="sendSMS.action">
-		<table>
-			<tbody>
-				<tr>
-					<td>$i18n.getString( "gateway_type" )</td>
-					<td>
-						#set( $keys = $!gatewayMap.keySet() )
-						<select id="gatewayId" name="gatewayId">
-							#foreach( $key in $!keys )
-							<option value="$gatewayMap.get( $key )">$i18n.getString( $key )</option>
-							#end
-						</select>
-					</td>
-				</tr>
-				
-				<tr>
-					<td>$i18n.getString( "message" )</td>
-					<td><textarea id="smsMessage" name="smsMessage" style="width:260px;height:100px;" class="{validate:{required:true,maxlength:160}}"></textarea></td>
-				</tr>
+<form id="sendSMSForm" name="sendSMSForm" action="sendSMS.action">
+	<table>
+		<tbody>
+			<tr>
+				<td>$i18n.getString( "message" )</td>
+				<td><textarea id="smsMessage" name="smsMessage" style="width:260px;height:100px;" class="{validate:{required:true,maxlength:160}}"></textarea></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td>
+					<input type="submit" value="$i18n.getString( 'send_sms' )"/>
+					<input type="button" value="$i18n.getString( 'cancel' )" onclick="jQuery('#sendSmsFormDiv').dialog('close')"/>
+				</td>
+			</tr>
 			
-				<tr>
-					<td></td>
-					<td>
-						<input type="submit" value="$i18n.getString( 'send_sms' )"/>
-						<input type="button" value="$i18n.getString( 'cancel' )" onclick="jQuery('#sendSmsFormDiv').dialog('close')"/>
-					</td>
-				</tr>
-				
-			</tbody>
-		</table>
-	</form>
-	<div class='hidden'>
-		<input type='hidden' id='currentDate'>
-		<script>
-			datePickerValid( 'currentDate', true );
-		</script>
-	</div>
-#else
-	<p>$i18n.getString('no_sms_service_available')</p>
-#end
+		</tbody>
+	</table>
+</form>
+<div class='hidden'>
+	<input type='hidden' id='currentDate'>
+	<script>
+		datePickerValid( 'currentDate', true );
+	</script>
+</div>
\ No newline at end of file