dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17719
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7164: Auto save SMS to database if received new one
------------------------------------------------------------
revno: 7164
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-04 13:37:01 +0700
message:
Auto save SMS to database if received new one
added:
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/webapp/dhis-web-maintenance-mobile/showSentSMSPage.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsService.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/DefaultInboundSmsService.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java
dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/incoming/IncomingSms.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/DeleteReceiveSMSAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ImportReceiveSMSAction.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/resources/org/hisp/dhis/mobile/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml
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/sendSMSPage.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-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java 2012-05-31 09:58:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java 2012-06-04 06:37:01 +0000
@@ -46,13 +46,17 @@
* @return the oldest sms in the INCOMING state.
*/
IncomingSms getNextUnprocessed();
-
- IncomingSms get(int id);
void update( IncomingSms sms );
- List<IncomingSms> listAllMessage ();
-
+ List<IncomingSms> listAllMessage();
+
+ List<IncomingSms> listAllMessageFromModem();
+
+ void deleteAllFromModem();
+
+ void deleteById( Integer id );
+
List<InboundMessage> getMsgList();
void save ( IncomingSms sms );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java 2012-03-12 20:25:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java 2012-06-04 06:37:01 +0000
@@ -47,6 +47,8 @@
long getSmsCount();
Collection<IncomingSms> getAllSmses();
+
+ void delete( IncomingSms incomingSms);
// public Collection<IncomingSms> getSms( String originator, Date startDate, Date endDate);
//
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsService.java 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsService.java 2012-06-04 06:37:01 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.List;
+
import org.hisp.dhis.sms.SmsServiceException;
import org.hisp.dhis.sms.config.SmsConfigurable;
@@ -48,5 +50,7 @@
*/
String sendMessage( OutboundSms sms, String gatewayId )
throws SmsServiceException;
+
+ List<OutboundSms> getAllOutboundSms();
}
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/DefaultInboundSmsService.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/DefaultInboundSmsService.java 2012-05-31 09:58:44 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/DefaultInboundSmsService.java 2012-06-04 06:37:01 +0000
@@ -43,14 +43,14 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
+
private IncomingSmsStore incomingSmsStore;
-
+
public void setIncomingSmsStore( IncomingSmsStore incomingSmsStore )
{
this.incomingSmsStore = incomingSmsStore;
}
-
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -67,7 +67,7 @@
// -------------------------------------------------------------------------
@Override
- public List<IncomingSms> listAllMessage()
+ public List<IncomingSms> listAllMessageFromModem()
{
List<IncomingSms> result = new ArrayList<IncomingSms>();
@@ -84,23 +84,7 @@
{
for ( InboundMessage each : msgList )
{
- IncomingSms incomingSms = new IncomingSms();
-
- incomingSms.setOriginator( each.getOriginator() );
-
- incomingSms.setEncoding( SmsMessageEncoding.ENC7BIT );
-
- incomingSms.setSentDate( each.getDate() );
-
- incomingSms.setReceivedDate( each.getDate() );
-
- incomingSms.setText( each.getText() );
-
- incomingSms.setGatewayId( each.getGatewayId() );
-
- incomingSms.setStatus( SmsMessageStatus.PROCESSED );
-
- incomingSms.setStatusMessage( "imported" );
+ IncomingSms incomingSms = tranferToIncomingSms( each );
result.add( incomingSms );
}
@@ -112,6 +96,12 @@
}
@Override
+ public List<IncomingSms> listAllMessage()
+ {
+ return (List<IncomingSms>) incomingSmsStore.getAllSmses();
+ }
+
+ @Override
public List<InboundMessage> getMsgList()
{
try
@@ -124,63 +114,78 @@
}
return msgList;
}
-
- @Override
- public IncomingSms get( int index )
+
+ @Override
+ public void save( IncomingSms incomingSms )
+ {
+ incomingSmsStore.save( incomingSms );
+ }
+
+ @Override
+ public void deleteAllFromModem()
{
try
{
Service.getInstance().readMessages( msgList, InboundMessage.MessageClasses.ALL );
+
+ for ( InboundMessage each : msgList )
+ {
+ Service.getInstance().deleteMessage( each );
+ }
}
catch ( Exception e )
{
e.printStackTrace();
}
-
- InboundMessage specifiedMsg = msgList.get( index - 1 );
-
+ msgList.clear();
+
+ }
+
+ @Override
+ public void deleteById( Integer id )
+ {
+ IncomingSms incomingSms = incomingSmsStore.get( id );
+
+ incomingSmsStore.delete( incomingSms );
+ }
+
+ @Override
+ public IncomingSms getNextUnprocessed()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void update( IncomingSms sms )
+ {
+ // TODO Auto-generated method stub
+ }
+
+ // -------------------------------------------------------------------------
+ // Support methods
+ // -------------------------------------------------------------------------
+
+ public IncomingSms tranferToIncomingSms( InboundMessage inboundMessage )
+ {
IncomingSms incomingSms = new IncomingSms();
-
- incomingSms.setOriginator( specifiedMsg.getOriginator() );
-
+
+ incomingSms.setOriginator( inboundMessage.getOriginator() );
+
incomingSms.setEncoding( SmsMessageEncoding.ENC7BIT );
-
- incomingSms.setSentDate( specifiedMsg.getDate() );
-
- incomingSms.setReceivedDate( specifiedMsg.getDate() );
-
- incomingSms.setText( specifiedMsg.getText() );
-
- incomingSms.setGatewayId( specifiedMsg.getGatewayId() );
-
+
+ incomingSms.setSentDate( inboundMessage.getDate() );
+
+ incomingSms.setReceivedDate( inboundMessage.getDate() );
+
+ incomingSms.setText( inboundMessage.getText() );
+
+ incomingSms.setGatewayId( inboundMessage.getGatewayId() );
+
incomingSms.setStatus( SmsMessageStatus.PROCESSED );
-
+
incomingSms.setStatusMessage( "imported" );
-
- msgList.clear();
-
+
return incomingSms;
}
-
- @Override
- public void save( IncomingSms incomingSms )
- {
- incomingSmsStore.save( incomingSms );
- }
-
- @Override
- public IncomingSms getNextUnprocessed()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void update( IncomingSms sms )
- {
- // TODO Auto-generated method stub
-
- }
-
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java 2012-05-31 09:58:44 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java 2012-06-04 06:37:01 +0000
@@ -103,6 +103,12 @@
return count != null ? count.longValue() : (long) 0;
}
+ @Override
+ public void delete( IncomingSms incomingSms )
+ {
+ sessionFactory.getCurrentSession().delete( incomingSms );
+ }
+
// @Override
// public Collection<IncomingSms> getSms( String originator, Date startDate,
// Date endDate )
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java 2012-06-04 06:37:01 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.sms.SmsServiceException;
@@ -109,6 +111,12 @@
return "outboundsms_saved";
}
+
+ @Override
+ public List<OutboundSms> getAllOutboundSms()
+ {
+ return outboundSmsStore.getAll();
+ }
// -------------------------------------------------------------------------
// Support methods
@@ -129,4 +137,5 @@
return "Exception sending message " + sms + e.getMessage();
}
}
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java 2012-06-04 06:37:01 +0000
@@ -1,6 +1,7 @@
package org.hisp.dhis.sms.outbound;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -96,4 +97,11 @@
log.debug( "getMessageStatus()" );
return null;
}
+
+ @Override
+ public List<OutboundSms> getAllOutboundSms()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2012-04-03 03:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2012-06-04 06:37:01 +0000
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -413,4 +414,11 @@
log.debug( "Sent message through gateway " + gateway.getGatewayId() + ": " + msg );
}
}
+
+ @Override
+ public List<OutboundSms> getAllOutboundSms()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/incoming/IncomingSms.hbm.xml'
--- dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/incoming/IncomingSms.hbm.xml 2011-12-16 10:26:08 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/incoming/IncomingSms.hbm.xml 2012-06-04 06:37:01 +0000
@@ -28,7 +28,7 @@
<property name="status" not-null="true" index="sms_status_index">
<type name="org.hibernate.type.EnumType">
- <param name="enumClass">org.hisp.dhis.sms.outbound.OutboundSmsStatus</param>
+ <param name="enumClass">org.hisp.dhis.sms.incoming.SmsMessageStatus</param>
</type>
</property>
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java 2012-06-04 06:37:01 +0000
@@ -0,0 +1,48 @@
+package org.hisp.dhis.mobile.action;
+
+import java.util.List;
+
+import org.hisp.dhis.sms.outbound.OutboundSms;
+import org.hisp.dhis.sms.outbound.OutboundSmsService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowSentSMSAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OutboundSmsService outboundSmsService;
+
+ public void setOutboundSmsService( OutboundSmsService outboundSmsService )
+ {
+ this.outboundSmsService = outboundSmsService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<OutboundSms> ListOutboundSMS;
+
+ public List<OutboundSms> getListOutboundSMS()
+ {
+ return ListOutboundSMS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ ListOutboundSMS = outboundSmsService.getAllOutboundSms();
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/DeleteReceiveSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/DeleteReceiveSMSAction.java 2012-05-29 07:58:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/DeleteReceiveSMSAction.java 2012-06-04 06:37:01 +0000
@@ -1,12 +1,40 @@
package org.hisp.dhis.mobile.action.incoming;
-import java.util.List;
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import org.hisp.dhis.sms.incoming.IncomingSmsService;
-import org.smslib.InboundMessage;
-import org.smslib.Service;
-
import com.opensymphony.xwork2.Action;
+/**
+* @author Nguyen Kim Lai
+* @version $Id$
+*/
+
public class DeleteReceiveSMSAction
implements Action
{
@@ -47,21 +75,17 @@
public String execute()
throws Exception
{
- List<InboundMessage> msgList = incomingSmsService.getMsgList();
-
if ( ids != null && ids.length > 0 )
{
- for ( Integer index : ids )
+ for ( Integer each : ids )
{
- Service.getInstance().deleteMessage( msgList.get( index - 1 ) );
+ incomingSmsService.deleteById( each );
}
}
if ( id != null )
{
- Service.getInstance().deleteMessage( msgList.get( id - 1 ) );
+ incomingSmsService.deleteById( id );
}
- msgList.clear();
-
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ImportReceiveSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ImportReceiveSMSAction.java 2012-05-31 09:58:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ImportReceiveSMSAction.java 2012-06-04 06:37:01 +0000
@@ -51,16 +51,6 @@
this.incomingSmsService = incomingSmsService;
}
- // -------------------------------------------------------------------------
- // Input & Output
- // -------------------------------------------------------------------------
-
- private Integer[] ids;
-
- public void setIds( Integer[] ids )
- {
- this.ids = ids;
- }
// -------------------------------------------------------------------------
// Action Implementation
@@ -70,20 +60,7 @@
public String execute()
throws Exception
{
- System.out.println("size: "+ ids.length);
-
- if ( ids != null && ids.length > 0 )
- {
- for( Integer index : ids )
- {
- System.out.println("index: "+ index);
-
- IncomingSms incomingSms = incomingSmsService.get( index );
-
- incomingSmsService.save( incomingSms );
- }
- }
-
+ //////////////
return SUCCESS;
}
}
=== 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 2012-05-31 09:58:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java 2012-06-04 06:37:01 +0000
@@ -74,18 +74,6 @@
return listIncomingSms;
}
- private int currentMessages;
-
- public int getCurrentMessages()
- {
- return currentMessages;
- }
-
- public void setCurrentMessages( int currentMessages )
- {
- this.currentMessages = currentMessages;
- }
-
private String message;
public String getMessage()
@@ -101,14 +89,21 @@
public String execute()
throws Exception
{
- listIncomingSms = incomingSmsService.listAllMessage();
+ listIncomingSms = incomingSmsService.listAllMessageFromModem();
- if ( listIncomingSms.size() > currentMessages )
+ if ( listIncomingSms.size() > 0 )
{
+ for( IncomingSms each : listIncomingSms )
+ {
+ incomingSmsService.save( each );
+ }
+
message = i18n.getString( "new_message" );
-
- currentMessages = listIncomingSms.size();
+
+ incomingSmsService.deleteAllFromModem();
}
+
+ listIncomingSms = incomingSmsService.listAllMessage();
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 2012-05-31 09:58:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-06-04 06:37:01 +0000
@@ -1,102 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
- <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="selectionManager"
- ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <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.ShowSendSMSFormAction" class="org.hisp.dhis.mobile.action.ShowSendSMSFormAction"
- scope="prototype" />
-
- <bean id="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction" class="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction"
- scope="prototype" >
- <property name="incomingSmsService" ref="org.hisp.dhis.sms.incoming.IncomingSmsService"/>
- </bean>
-
- <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.incoming.ImportReceiveSMSAction" class="org.hisp.dhis.mobile.action.incoming.ImportReceiveSMSAction"
- scope="prototype" >
- <property name="incomingSmsService" ref="org.hisp.dhis.sms.incoming.IncomingSmsService"/>
- </bean>
-
- <bean id="org.hisp.dhis.mobile.action.ShowSendSMSBeneficiaryFormAction" class="org.hisp.dhis.mobile.action.ShowSendSMSBeneficiaryFormAction"
- scope="prototype" />
-
- <bean id="org.hisp.dhis.mobile.action.ProcessingSendSMSAction" class="org.hisp.dhis.mobile.action.ProcessingSendSMSAction"
- scope="prototype" />
-
- <bean id="org.hisp.dhis.mobile.action.SearchPatientAction" class="org.hisp.dhis.mobile.action.SearchPatientAction"
- scope="prototype" />
-
- <!-- Patient Mobile Settings -->
-
- <bean id="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction" class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
- scope="prototype">
- <property name="patientMobileSettingService" ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
- <property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
- </bean>
-
- <bean id="org.hisp.dhis.mobile.action.UpdateMobileSettingAction" class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
- scope="prototype">
- <property name="patientMobileSettingService" ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
- <property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
- </bean>
-
- <!-- Mobile DataSet -->
-
- <bean id="org.hisp.dhis.mobile.action.MobileDataSetListAction" class="org.hisp.dhis.mobile.action.MobileDataSetListAction"
- scope="prototype">
- <property name="dataSetService">
- <ref bean="org.hisp.dhis.dataset.DataSetService" />
- </property>
- </bean>
-
- <bean id="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction" class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
- scope="prototype">
- <property name="dataSetService">
- <ref bean="org.hisp.dhis.dataset.DataSetService" />
- </property>
- </bean>
-
- <!-- SMS Service Configuration -->
-
- <bean id="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
- 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"/>
-
- <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"
- class="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction" scope="prototype"/>
-
- <bean id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
- class="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction" scope="prototype"/>
-
- <bean id="org.hisp.dhis.mobile.action.UpdateGenericHTTPGateWayConfigAction"
- class="org.hisp.dhis.mobile.action.UpdateGenericHTTPGateWayConfigAction" scope="prototype"/>
-
- <bean id="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
- 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.caseentry.state.SelectedStateManager"
+ class="org.hisp.dhis.mobile.caseentry.state.DefaultSelectedStateManager">
+ <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="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.ShowSendSMSFormAction"
+ class="org.hisp.dhis.mobile.action.ShowSendSMSFormAction" scope="prototype" />
+
+ <bean id="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction"
+ class="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction" scope="prototype">
+ <property name="incomingSmsService"
+ ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
+ </bean>
+
+ <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.incoming.ImportReceiveSMSAction"
+ class="org.hisp.dhis.mobile.action.incoming.ImportReceiveSMSAction"
+ scope="prototype">
+ <property name="incomingSmsService"
+ ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.mobile.action.ShowSendSMSBeneficiaryFormAction"
+ class="org.hisp.dhis.mobile.action.ShowSendSMSBeneficiaryFormAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.mobile.action.ProcessingSendSMSAction"
+ class="org.hisp.dhis.mobile.action.ProcessingSendSMSAction" scope="prototype" />
+
+ <bean id="org.hisp.dhis.mobile.action.SearchPatientAction" class="org.hisp.dhis.mobile.action.SearchPatientAction"
+ scope="prototype" />
+
+ <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>
+ </bean>
+
+ <!-- Patient Mobile Settings -->
+
+ <bean id="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
+ class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction" scope="prototype">
+ <property name="patientMobileSettingService"
+ ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
+ <property name="patientAttributeService"
+ ref="org.hisp.dhis.patient.PatientAttributeService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
+ class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction" scope="prototype">
+ <property name="patientMobileSettingService"
+ ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
+ <property name="patientAttributeService"
+ ref="org.hisp.dhis.patient.PatientAttributeService" />
+ </bean>
+
+ <!-- Mobile DataSet -->
+
+ <bean id="org.hisp.dhis.mobile.action.MobileDataSetListAction"
+ class="org.hisp.dhis.mobile.action.MobileDataSetListAction" scope="prototype">
+ <property name="dataSetService">
+ <ref bean="org.hisp.dhis.dataset.DataSetService" />
+ </property>
+ </bean>
+
+ <bean id="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
+ class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction" scope="prototype">
+ <property name="dataSetService">
+ <ref bean="org.hisp.dhis.dataset.DataSetService" />
+ </property>
+ </bean>
+
+ <!-- SMS Service Configuration -->
+
+ <bean id="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
+ 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" />
+
+ <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"
+ class="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
+ class="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
+ scope="prototype" />
+
+ <bean
+ id="org.hisp.dhis.mobile.action.UpdateGenericHTTPGateWayConfigAction"
+ class="org.hisp.dhis.mobile.action.UpdateGenericHTTPGateWayConfigAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
+ 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" />
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-05-31 10:11:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-06-04 06:37:01 +0000
@@ -17,6 +17,7 @@
status=Status
no.=No.
delete=Delete
+check_all=Click Here To Check All
error_delete=Please check before delete
new_message=You have new messages, press F5 to view them
sms_service_is_runnning=SMS Service is running
@@ -31,6 +32,7 @@
gateway_type=Gateway Type
send_sms=Send SMS
send_sms_beneficiary=Send SMS to Person
+list_sent_SMS=List Of Sent SMS
add_gateway=Add Gateway
gateway_type=Gateway Type
type=Type
@@ -61,6 +63,7 @@
add_update_gateway_management=Gateway Configuration Management
confirm_delete_gateway=Do you want to delete this gateway configuration?
confirm_delete_sms=Do you want to delete this SMS?
+confirm_delete_items=Do you want to delete those items?
smsconfiguration_not_available=SMS Configuration is not available
outboundsmsservice_is_null_or_unable=SMS Service is not available or unable to be started.
service_started=SMS Service is started
@@ -70,7 +73,11 @@
message_not_sent=Message not sent
message=Message
send_sms_to_target=Send SMS to
+list_sent_SMS =List Of Sent SMS
show_receive_sms_form =Receive SMS
+config_my_gateway =Configure My Gateway
+delete_checked_option =Delete Checked Options
+import =Import
error_import=Please check before import
phone_number=Phone number
raw_phone_number=Raw phone numbers
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-05-31 10:11:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-06-04 06:37:01 +0000
@@ -33,6 +33,12 @@
<param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
</action>
+ <action name="showSentPage" class="org.hisp.dhis.mobile.action.ShowSentSMSAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-mobile/showSentSMSPage.vm</param>
+ <param name="menu">/dhis-web-maintenance-mobile/menu.vm</param>
+ </action>
+
<!-- Receiving SMS Action -->
<action name="showReceivingPage" class="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction">
=== 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 2012-05-31 09:58:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm 2012-06-04 06:37:01 +0000
@@ -7,17 +7,13 @@
function checkNewMsg()
{
$.get( 'checkNewMessage.action',
- {
- currentMessages: getFieldValue('currentMessageHidden')
- },
+ {},
function ( json ){
if ( json.message )
{
setHeaderDelayMessage( json.message );
- }
- setFieldValue( "currentMessageHidden", json.currentMessages );
-
+ }
});
setTimeout( "checkNewMsg()", 10000 );
@@ -57,15 +53,19 @@
if( result != "")
{
- jQuery.get( 'deleteReceiveSMS.action?' + result, {},
- function ( json ) {
- if ( json.response == "success" ) {
- window.location = "showReceivingPage.action";
- } else {
- showMessage( json.message );
+ var confirmation = window.confirm( "i18n.getString( 'confirm_delete_items' )" );
+ if ( confirmation )
+ {
+ jQuery.get( 'deleteReceiveSMS.action?' + result, {},
+ function ( json ) {
+ if ( json.response == "success" ) {
+ window.location = "showReceivingPage.action";
+ } else {
+ showMessage( json.message );
+ }
}
- }
- );
+ );
+ }
}
else
{
@@ -114,8 +114,6 @@
<h3>$i18n.getString( "show_receive_sms_form" )</h3>
<form id="receiveSmsPage" name="receiveSmsPage" action="showReceivingPage.action" method="post" >
-
- <input type="hidden" id="currentMessageHidden" value="$currentMessages"/>
<br/>
<table id="detailsSmsList" class="listTable" style="width:800px">
<col width="40px"/>
@@ -128,22 +126,22 @@
<th>$i18n.getString( "phone_number" )</th>
<th>$i18n.getString( "status" )</th>
<th style="text-align:center">$i18n.getString( "delete" )</th>
- <th style="text-align:center"><a href="#" onclick="checkAll()" title="Click Here To Check All"><img src="../images/check.png"/></a></th>
+ <th style="text-align:center"><a href="#" onclick="checkAll()" title="$i18n.getString( 'check_all' )"><img src="../images/check.png"/></a></th>
</thead>
#foreach( $incomingSms in $listIncomingSms )
- <tr id="tr${velocityCount}">
+ <tr id="tr${incomingSms.id}">
<td style="text-align:center">$velocityCount</td>
<td>$incomingSms.getText()</td>
<td>$incomingSms.getOriginator()</td>
<td>update</td>
- <td style="text-align:center"><a href="javascript:removeSingleItem( '$velocityCount', '$incomingSms.getText()' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></td>
- <td style="text-align:center"><input type="checkbox" name="mycheck" value="$velocityCount"/></td>
+ <td style="text-align:center"><a href="javascript:removeSingleItem( '$incomingSms.id', '$incomingSms.getText()' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></td>
+ <td style="text-align:center"><input type="checkbox" name="mycheck" value="$incomingSms.id"/></td>
</tr>
#end
</table>
<br/>
- <input type="button" name="btnShowConfig" value="Configurate My Modem" onclick="window.location='showSMSConfigureForm.action'"/>
- <input type="button" name="btnDelete" value="Delete Checked Options" onclick="deleteChecked()"/>
- <input type="button" name="btnImport" value="Import" onclick="importChecked()"/>
+ <input type="button" name="btnShowConfig" value="$i18n.getString( 'config_my_gateway' )" onclick="window.location='showSMSConfigureForm.action'"/>
+ <input type="button" name="btnDelete" value="$i18n.getString( 'delete_checked_option' )" onclick="deleteChecked()"/>
+ <input type="button" name="btnImport" value="$i18n.getString( 'import' )" onclick="importChecked()"/>
</form>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2012-05-09 02:52:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2012-06-04 06:37:01 +0000
@@ -74,7 +74,10 @@
</tbody>
<tbody>
- <tr><td><input type="submit" name="send" value="$i18n.getString( 'send_sms' )"/></td></tr>
+ <tr>
+ <td><input type="submit" name="send" value="$i18n.getString( 'send_sms' )"/></td>
+ <td><input type="button" name="viewSentSms" value="View Sent Sms" onclick="window.location='showSentPage.action'"/></td>
+ </tr>
</tbody>
</table>
</form>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/showSentSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/showSentSMSPage.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/showSentSMSPage.vm 2012-06-04 06:37:01 +0000
@@ -0,0 +1,23 @@
+<h3>$i18n.getString( 'list_sent_SMS' )</h3>
+<form id="sentSMSPage" name="sentSMSPage" action="showSentPage.action" method="post" >
+$ListOutboundSMS.size()
+<table id="detailsSentSMSList" class="listTable" style="width:800px">
+ <thead>
+ <th style="text-align:center">$i18n.getString( "no." )</th>
+ <th>$i18n.getString( "message" )</th>
+ <th>$i18n.getString( "admin" )</th>
+ <th>$i18n.getString( "receiver" )</th>
+ <th style="text-align:center"><a href="#" onclick="checkAll()" title="Click Here To Check All"><img src="../images/check.png"/></a></th>
+ </thead>
+ #foreach( $outboundSms in $ListOutboundSMS)
+ <tr>
+ <td>$velocityCount</td>
+ <td>$outboundSms.message</td>
+ <td>admin</td>
+ <td>$outboundSms.recipients</td>
+ <td></td>
+ </tr>
+
+ #end
+</table>
+</form>
\ No newline at end of file