------------------------------------------------------------
revno: 11922
committer: Lai <lai.hispviet...@gmail.com>
branch nick: dhis2
timestamp: Wed 2013-09-04 21:41:27 +0700
message:
  show name of the sender in view received SMS page
modified:
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.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-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java	2013-09-04 11:44:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java	2013-09-04 14:41:27 +0000
@@ -156,6 +156,7 @@
             listOutboundSMS = outboundSmsService.getAllOutboundSms( paging.getStartPos(), paging.getPageSize() );
         }
 
+        //Get the name of recipients
         recipientNames = new ArrayList<String>();
         recipientNames.add( "" );
         String tempString;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java	2013-08-30 07:09:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java	2013-09-04 14:41:27 +0000
@@ -29,7 +29,10 @@
  */
 
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
+
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.paging.ActionPagingSupport;
 import org.hisp.dhis.sms.config.ModemGatewayConfig;
@@ -37,6 +40,8 @@
 import org.hisp.dhis.sms.incoming.IncomingSms;
 import org.hisp.dhis.sms.incoming.IncomingSmsService;
 import org.hisp.dhis.sms.incoming.SmsMessageStatus;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
@@ -62,6 +67,13 @@
     {
         this.i18n = i18n;
     }
+    
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
 
     @Autowired
     private SmsConfigurationManager smsConfigurationManager;
@@ -114,6 +126,13 @@
     {
         this.keyword = keyword;
     }
+    
+    private List<String> senderNames;
+
+    public List<String> getSenderNames()
+    {
+        return senderNames;
+    }
 
     private Integer total;
 
@@ -187,6 +206,40 @@
                 }
             }
         }
+        
+        // Get the name of senders
+        senderNames = new ArrayList<String>();
+        senderNames.add( "" );
+        String tempString;
+        for ( IncomingSms incomingSms : listIncomingSms )
+        {
+            tempString = "";
+            String phoneNumber = incomingSms.getOriginator();
+            if ( !phoneNumber.isEmpty() )
+            {
+                Collection<User> users = userService.getUsersByPhoneNumber( phoneNumber );
+                if ( users == null || users.size() == 0 )
+                {
+                    tempString += "[unknown]";
+                }
+                else if ( users.size() > 0 )
+                {
+
+                    Iterator<User> usersIterator = users.iterator();
+                    while ( usersIterator.hasNext() )
+                    {
+                        User user = usersIterator.next();
+                        tempString += "[" + user.getUsername() + "]";
+                    }
+                }
+            }
+            else
+            {
+                tempString += "[unknown]";
+            }
+            senderNames.add( tempString );
+        }
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml	2013-08-13 11:54:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml	2013-09-04 14:41:27 +0000
@@ -8,68 +8,60 @@
 		<property name="incomingSmsService"
 			ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
 	</bean>
-	
+
 	<bean id="org.hisp.dhis.mobile.caseentry.state.SelectedStateManager"
 		class="org.hisp.dhis.mobile.caseentry.state.DefaultSelectedStateManager">
-		<property name="patientService"
-			ref="org.hisp.dhis.patient.PatientService" />
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="selectionManager"
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="programInstanceService"
-			ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.NoAction"
-		class="org.hisp.dhis.mobile.action.NoAction" scope="prototype" />
+	<bean id="org.hisp.dhis.mobile.action.NoAction" class="org.hisp.dhis.mobile.action.NoAction"
+		scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction"
-		class="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction"
-		scope="prototype">
+		class="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction" scope="prototype">
 		<property name="incomingSmsService"
 			ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
-	<bean
-		id="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
+	<bean id="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
 		class="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
 		scope="prototype">
 		<property name="incomingSmsService"
 			ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
-		class="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
+	<bean id="org.hisp.dhis.mobile.action.DeleteSentSMSAction" class="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
 		scope="prototype">
 		<property name="outboundSmsService"
 			ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
 	</bean>
 
-	<bean
-		id="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
+	<bean id="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
 		class="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
 		scope="prototype">
 		<property name="incomingSmsService"
 			ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.ShowSentSMSAction"
-		class="org.hisp.dhis.mobile.action.ShowSentSMSAction"
+	<bean id="org.hisp.dhis.mobile.action.ShowSentSMSAction" class="org.hisp.dhis.mobile.action.ShowSentSMSAction"
 		scope="prototype">
 		<property name="outboundSmsService"
 			ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-		<property name="userService"
-			ref="org.hisp.dhis.user.UserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<!-- Patient Mobile Settings -->
 
 	<bean id="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
-		class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
-		scope="prototype">
+		class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction" scope="prototype">
 		<property name="patientMobileSettingService"
 			ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
 		<property name="patientAttributeService"
@@ -77,8 +69,7 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
-		class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
-		scope="prototype">
+		class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction" scope="prototype">
 		<property name="patientMobileSettingService"
 			ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
 		<property name="patientAttributeService"
@@ -88,40 +79,32 @@
 	<!-- Mobile DataSet -->
 
 	<bean id="org.hisp.dhis.mobile.action.MobileDataSetListAction"
-		class="org.hisp.dhis.mobile.action.MobileDataSetListAction"
-		scope="prototype">
-		<property name="dataSetService"
-			ref="org.hisp.dhis.dataset.DataSetService" />
+		class="org.hisp.dhis.mobile.action.MobileDataSetListAction" scope="prototype">
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
-		class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
-		scope="prototype">
-		<property name="dataSetService"
-			ref="org.hisp.dhis.dataset.DataSetService" />
+		class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction" scope="prototype">
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 	</bean>
 
 	<!-- SMS Service Configuration -->
 
 	<bean id="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
-		class="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
-		scope="prototype" />
+		class="org.hisp.dhis.mobile.action.GetSmsConfigurationAction" scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction"
-		class="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction"
-		scope="prototype" />
+		class="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction" scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.UpdateBulkGateWayConfigAction"
 		class="org.hisp.dhis.mobile.action.UpdateBulkGateWayConfigAction"
 		scope="prototype" />
 
-	<bean
-		id="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
+	<bean id="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
 		class="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
 		scope="prototype" />
 
-	<bean
-		id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
+	<bean id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
 		class="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
 		scope="prototype" />
 
@@ -130,27 +113,21 @@
 		class="org.hisp.dhis.mobile.action.UpdateGenericHTTPGateWayConfigAction"
 		scope="prototype" />
 
-	<bean
-		id="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
-		class="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
-		scope="prototype" />
+	<bean id="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
+		class="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction" scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
-		class="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
-		scope="prototype" />
+		class="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction" scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.ReloadStartStopServiceAction"
 		class="org.hisp.dhis.mobile.action.ReloadStartStopServiceAction"
 		scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction"
-		class="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction"
-		scope="prototype">
+		class="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction" scope="prototype">
 		<property name="smsCommandService" ref="smsCommandService" />
-		<property name="dataSetService"
-			ref="org.hisp.dhis.dataset.DataSetService" />
-		<property name="userGroupService"
-			ref="org.hisp.dhis.user.UserGroupService" />	
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 
 	</bean>
 
@@ -158,12 +135,9 @@
 		class="org.hisp.dhis.mobile.action.smscommand.EditSMSCommandForm"
 		scope="prototype">
 		<property name="smsCommandService" ref="smsCommandService" />
-		<property name="dataSetService"
-			ref="org.hisp.dhis.dataset.DataSetService" />
-		<property name="dataElementService"
-			ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="userGroupService"
-			ref="org.hisp.dhis.user.UserGroupService" />
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 
 	</bean>
 
@@ -171,10 +145,8 @@
 		class="org.hisp.dhis.mobile.action.smscommand.CreateSMSCommandForm"
 		scope="prototype">
 		<property name="smsCommandService" ref="smsCommandService" />
-		<property name="dataSetService"
-			ref="org.hisp.dhis.dataset.DataSetService" />
-		<property name="userGroupService"
-			ref="org.hisp.dhis.user.UserGroupService" />
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.smscommand.DeleteSMSCommandAction"
@@ -184,16 +156,11 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.J2meClientUpdateAction"
-		class="org.hisp.dhis.mobile.action.J2meClientUpdateAction"
-		scope="prototype">
+		class="org.hisp.dhis.mobile.action.J2meClientUpdateAction" scope="prototype">
 		<property name="patientMobileSettingService"
 			ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
 	</bean>
-	
-	<!-- 
-	<bean id="org.hisp.dhis.mobile.action.MobilePhonesPatternAction"
-		class="org.hisp.dhis.mobile.action.MobilePhonesPatternAction"
-		scope="prototype">
-	</bean>
- 	-->
+
+	<!-- <bean id="org.hisp.dhis.mobile.action.MobilePhonesPatternAction" class="org.hisp.dhis.mobile.action.MobilePhonesPatternAction" 
+		scope="prototype"> </bean> -->
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm	2013-08-30 07:09:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm	2013-09-04 14:41:27 +0000
@@ -190,6 +190,7 @@
 			<th style="text-align:center">$i18n.getString( "no." )</th>
 			<th>$i18n.getString( "message" )</th>
 			<th>$i18n.getString( "phone_number" )</th>
+			<th>$i18n.getString( "sender" )</th>
 			<th>$i18n.getString( "status" )</th>
 			<th>$i18n.getString( "date" )</th>
 			<th style="text-align:center">$i18n.getString( "action" )</th>
@@ -204,6 +205,7 @@
 					<a id="$velocityCount" style="display: block" href="#" onclick="makeVisible( $incomingSms.id, $velocityCount )">$incomingSms.text</a>
 					<input type="hidden" id="$incomingSms.id" value="$incomingSms.text" onblur="makeVisible( $incomingSms.id, $velocityCount )"/></td>
 				<td>$incomingSms.originator</td>
+				<td>$senderNames.get($velocityCount)</td>
 				<td>$incomingSms.status</td>
 				<td>$incomingSms.sentDate.toLocaleString()</td>
 				<td style="text-align:center">#if($incomingSms.status == 'FAILED' || $incomingSms.status == 'INCOMING')<a href="javascript:reimport('$i18n.getString( 'reimport_confirm' )','$incomingSms.id')"> Re-import </a> #else None #end</td>

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to