dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12032
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3569: Support for clickatell gateway. Renaming menu to DHIS SMS
------------------------------------------------------------
revno: 3569
committer: Saptarshi <sunbiz@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-05-11 09:26:38 +0200
message:
Support for clickatell gateway. Renaming menu to DHIS SMS
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/SmsService.java
dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java
dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/menu.vm
dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileSettingsPage.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-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2011-04-28 19:47:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2011-05-11 07:26:38 +0000
@@ -69,6 +69,7 @@
dhis-web-survey = Survey - Target
dhis-web-excel-reporting = Excel Reports
dhis-web-mobile = Mobiles
+dhis-web-sms = SMS
dhis-web-maintenance-in = Configuration
dhis-web-excelimport = Data Integration
dhis-web-linelisting-mp = Manpower
=== modified file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/SmsService.java'
--- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/SmsService.java 2011-05-06 20:21:40 +0000
+++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/SmsService.java 2011-05-11 07:26:38 +0000
@@ -47,7 +47,6 @@
import org.smslib.GatewayException;
import org.smslib.ICallNotification;
import org.smslib.IInboundMessageNotification;
-import org.smslib.IOrphanedMessageNotification;
import org.smslib.IOutboundMessageNotification;
import org.smslib.IQueueSendingNotification;
import org.smslib.InboundBinaryMessage;
@@ -61,6 +60,7 @@
import org.smslib.TimeoutException;
import org.smslib.helper.Logger;
import org.smslib.http.BulkSmsHTTPGateway;
+import org.smslib.http.ClickatellHTTPGateway;
import org.smslib.modem.SerialModemGateway;
/*
@@ -93,7 +93,8 @@
private QueueSendingNotification queueSendingNotification;
- private OrphanedMessageNotification orphanedMessageNotification;
+ // TODO: check advisory: http://blog.smslib.org/2011/05/orphaned-part-detection-issue.html
+ //private OrphanedMessageNotification orphanedMessageNotification;
private Timer inboundPollingTimer;
@@ -105,7 +106,8 @@
Service.getInstance().setInboundMessageNotification( inboundNotification );
Service.getInstance().setOutboundMessageNotification( outboundNotification );
Service.getInstance().setCallNotification( callNotification );
- Service.getInstance().setOrphanedMessageNotification( orphanedMessageNotification );
+ // TODO: check advisory: http://blog.smslib.org/2011/05/orphaned-part-detection-issue.html
+ //Service.getInstance().setOrphanedMessageNotification( orphanedMessageNotification );
Service.getInstance().setQueueSendingNotification( queueSendingNotification );
}
@@ -349,7 +351,11 @@
}
}
- class OrphanedMessageNotification implements IOrphanedMessageNotification
+ /**
+ * TODO: ADVISORY: http://blog.smslib.org/2011/05/orphaned-part-detection-issue.html
+ * Commented the code callback for Orphaned message
+ */
+ /*class OrphanedMessageNotification implements IOrphanedMessageNotification
{
@Override
@@ -362,7 +368,7 @@
// Return FALSE to leave orphaned parts in memory.
return false;
}
- }
+ }*/
//</editor-fold>
/*------------------------------------------------------------------
@@ -535,9 +541,19 @@
String password = getProperties().getProperty( "bulksms.password" );
BulkSmsHTTPGateway gateway = new BulkSmsHTTPGateway("bulksms.http.1", username, password);
gateway.setOutbound( true );
+ gateway.setInbound( true );
Service.getInstance().addGateway( gateway );
- } else
+ } else if( modemName.contains( "clickatell") )
{
+ String username = getProperties().getProperty( "clickatell.username" );
+ String password = getProperties().getProperty( "clickatell.password" );
+ String api_id = getProperties().getProperty( "clickatell.api_id" );
+ ClickatellHTTPGateway gateway = new ClickatellHTTPGateway( "clickatell.http.1", api_id, username, password );
+ gateway.setOutbound( true );
+ gateway.setInbound( true );
+ Service.getInstance().addGateway( gateway );
+ }
+ else{
String port = getProperties().getProperty( modemName + ".port" );
int baudRate = Integer.parseInt( getProperties().getProperty( modemName + ".baudrate" ) );
String manufacturer = getProperties().getProperty( modemName + ".manufacturer" );
=== modified file 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java'
--- dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java 2011-05-06 20:21:40 +0000
+++ dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java 2011-05-11 07:26:38 +0000
@@ -101,6 +101,42 @@
props.setProperty( "bulksms.password", bulksmsPassword );
}
+ private String clickatellUsername;
+
+ public String getClickatellUsername()
+ {
+ return props.getProperty( "clickatell.username" );
+ }
+
+ public void setClickatellUsername( String clickatellUsername )
+ {
+ props.setProperty( "clickatell.username", clickatellUsername);
+ }
+
+ private String clickatellPassword;
+
+ public String getClickatellPassword()
+ {
+ return props.getProperty( "clickatell.password" );
+ }
+
+ public void setClickatellPassword( String clickatellPassword )
+ {
+ props.setProperty( "clickatell.password", clickatellPassword);
+ }
+
+ private String clickatellApiId;
+
+ public String getClickatellApiId()
+ {
+ return props.getProperty( "clickatell.api_id" );
+ }
+
+ public void setClickatellApiId( String clickatellApiId )
+ {
+ props.setProperty( "clickatell.api_id" , clickatellApiId);
+ }
+
private String port;
public String getPort()
@@ -303,6 +339,9 @@
props.setProperty( "gateway.0", "modem1, SerialModem" );
props.setProperty( "bulksms.username", "" );
props.setProperty( "bulksms.password", "" );
+ props.setProperty( "clickatell.username", "");
+ props.setProperty( "clickatell.password", "");
+ props.setProperty( "clickatell.api_id", "");
props.setProperty( "modem1.port", "COM1" );
props.setProperty( "modem1.baudrate", "57600" );
props.setProperty( "modem1.manufacturer", "Generic" );
=== modified file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/menu.vm'
--- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/menu.vm 2011-05-06 20:21:40 +0000
+++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/menu.vm 2011-05-11 07:26:38 +0000
@@ -1,4 +1,4 @@
-<h2>DHIS Mobile</h2>
+<h2>DHIS SMS</h2>
<ul>
<li><a href = "receiveImport.action">Receive Data and Import</a></li>
<li><a href = "sendSMS.action">Send SMS</a></li>
=== modified file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileSettingsPage.vm'
--- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileSettingsPage.vm 2011-05-06 20:21:40 +0000
+++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileSettingsPage.vm 2011-05-11 07:26:38 +0000
@@ -9,6 +9,11 @@
<tr><td>Bulksms Username: </td><td><input size="100" name="bulksmsUsername" type="text" value="$!bulksmsUsername" /></td></tr>
<tr><td>Bulksms Password: </td><td><input size="100" name="bulksmsPassword" type="text" value="$!bulksmsPassword" /></td></tr>
#end
+ #if($gatewayName == "clickatell")
+ <tr><td>Clickatell Username: </td><td><input size="100" name="clickatellUsername" type="text" value="$!clickatellUsername" /></td></tr>
+ <tr><td>Clickatell Password: </td><td><input size="100" name="clickatellPassword" type="text" value="$!clickatellPassword" /></td></tr>
+ <tr><td>Clickatell API ID: </td><td><input size="100" name="clickatellApiId" type="text" value="$!clickatellApiId" /></td></tr>
+ #end
#if($port) <tr><td>Modem Port#: </td><td><input size="100" name="port" type="text" value="$port" /></td></tr>#end
#if($baudRate) <tr><td>Baudrate: </td><td><input size="100" name="baudRate" type="text" value="$baudRate" /></td></tr>#end
#if($manufacturer) <tr><td>Manufacturer: </td><td><input size="100" name="manufacturer" type="text" value="$manufacturer" /></td></tr>#end