dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18591
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7889: Enable to use Polling Interval attribute, Add Edit button for gateway config
------------------------------------------------------------
revno: 7889
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-08-10 09:43:42 +0700
message:
Enable to use Polling Interval attribute, Add Edit button for gateway config
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.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/java/org/hisp/dhis/mobile/action/incoming/UpdateReceiveSMSAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js
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/smsServiceConfiguration.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.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/java/org/hisp/dhis/security/action/LoginAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java 2012-07-31 03:07:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java 2012-08-10 02:43:42 +0000
@@ -74,7 +74,7 @@
public String execute()
{
Device device = deviceResolver.resolveDevice( ServletActionContext.getRequest() );
-
+
if ( device.isMobile() )
{
return "mobile";
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.java 2012-03-23 04:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.java 2012-08-10 02:43:42 +0000
@@ -60,8 +60,20 @@
private OutboundSmsTransportService smsLibService;
// -------------------------------------------------------------------------
- // Output
+ // Input & Output
// -------------------------------------------------------------------------
+
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
private Map<Integer, SmsGatewayConfig> gatewayConfigMap1 = new HashMap<Integer, SmsGatewayConfig>();
@@ -90,7 +102,35 @@
{
return this.smsServiceStatus;
}
-
+
+ public Integer bulkIndex;
+
+
+ public Integer getBulkIndex()
+ {
+ return bulkIndex;
+ }
+
+ public Integer clickatellIndex;
+
+ public Integer getClickatellIndex()
+ {
+ return clickatellIndex;
+ }
+
+ public Integer modemIndex;
+
+ public Integer getModemIndex()
+ {
+ return modemIndex;
+ }
+
+ public Integer httpIndex;
+
+ public Integer getHttpIndex()
+ {
+ return httpIndex;
+ }
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -98,6 +138,7 @@
public String execute()
throws Exception
{
+
smsServiceStatus = smsLibService.getServiceStatus();
smsConfig = smsConfigurationManager.getSmsConfiguration();
@@ -115,18 +156,26 @@
if ( gw instanceof BulkSmsGatewayConfig )
{
gatewayConfigMap2.put( 0, index );
+
+ bulkIndex = index;
}
else if ( gw instanceof ClickatellGatewayConfig )
{
gatewayConfigMap2.put( 1, index );
+
+ clickatellIndex = index;
}
else if ( gw instanceof ModemGatewayConfig )
{
gatewayConfigMap2.put( 2, index );
+
+ modemIndex = index;
}
else
{
gatewayConfigMap2.put( 3, index );
+
+ httpIndex = index;
}
}
}
=== 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-06-04 06:37:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java 2012-08-10 02:43:42 +0000
@@ -31,9 +31,12 @@
import java.util.List;
import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.sms.SmsConfigurationManager;
import org.hisp.dhis.sms.config.ModemGatewayConfig;
+import org.hisp.dhis.sms.config.SmsConfiguration;
import org.hisp.dhis.sms.incoming.IncomingSms;
import org.hisp.dhis.sms.incoming.IncomingSmsService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -62,6 +65,9 @@
{
this.i18n = i18n;
}
+
+ @Autowired
+ private SmsConfigurationManager smsConfigurationManager;
// -------------------------------------------------------------------------
// Input & Output
@@ -80,6 +86,13 @@
{
return message;
}
+
+ private Integer pollingInterval;
+
+ public Integer getPollingInterval()
+ {
+ return pollingInterval;
+ }
// -------------------------------------------------------------------------
// Action Implementation
@@ -89,6 +102,16 @@
public String execute()
throws Exception
{
+ SmsConfiguration smsConfig = smsConfigurationManager.getSmsConfiguration();
+
+ if ( smsConfig == null )
+ {
+ pollingInterval = 0;
+ }
+ else
+ {
+ pollingInterval = smsConfig.getPollingInterval()*1000;
+ }
listIncomingSms = incomingSmsService.listAllMessageFromModem();
if ( listIncomingSms.size() > 0 )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/UpdateReceiveSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/UpdateReceiveSMSAction.java 2012-06-06 07:48:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/UpdateReceiveSMSAction.java 2012-08-10 02:43:42 +0000
@@ -33,9 +33,9 @@
import com.opensymphony.xwork2.Action;
/**
-* @author Nguyen Kim Lai
-* @version $Id$
-*/
+ * @author Nguyen Kim Lai
+ * @version $Id$
+ */
public class UpdateReceiveSMSAction
implements Action
@@ -50,7 +50,7 @@
{
this.incomingSmsService = incomingSmsService;
}
-
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -61,9 +61,9 @@
{
this.id = id;
}
-
+
private String text;
-
+
public void setText( String text )
{
this.text = text;
@@ -73,16 +73,12 @@
public String execute()
throws Exception
{
- System.out.println("welcome to update sMS function!!!!");
- System.out.println("id: " + id);
- System.out.println("text: " + text);
-
IncomingSms incomingSms = incomingSmsService.findBy( id );
-
+
incomingSms.setText( text );
-
+
incomingSmsService.update( incomingSms );
-
+
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java 2012-06-27 07:25:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java 2012-08-10 02:43:42 +0000
@@ -63,7 +63,6 @@
public Collection<SMSCommand> getSMSCommands()
{
- System.out.println( "get:" + smsCommandService.getSMSCommands() );
return smsCommandService.getSMSCommands();
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js 2012-07-24 10:19:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js 2012-08-10 02:43:42 +0000
@@ -3,7 +3,6 @@
function changeValueType( value )
{
hideAll();
-
if ( value == 'modem' ) {
showById( "modemFields" );
} else if ( value == 'bulksms' ) {
@@ -13,7 +12,6 @@
} else {
showById( "genericHTTPFields" );
}
-
currentType = value;
}
=== 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-06-18 10:29:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm 2012-08-10 02:43:42 +0000
@@ -13,10 +13,9 @@
if ( json.message )
{
setHeaderDelayMessage( json.message );
- }
+ }
});
-
- setTimeout( "checkNewMsg()", 10000 );
+ setTimeout( "checkNewMsg()", document.getElementById( 'pollingInterval' ).value );
};
checked = false;
@@ -143,7 +142,7 @@
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_sms" ) , "'")';
</script>
-
+<input id="pollingInterval" name="pollingInterval" type="hidden" value="$pollingInterval"/>
<h3>$i18n.getString( "show_receive_sms_form" )</h3>
<form id="receiveSmsPage" name="receiveSmsPage" action="showReceivingPage.action" method="post" >
<br/>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm 2012-05-31 10:11:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm 2012-08-10 02:43:42 +0000
@@ -115,6 +115,7 @@
#set( $gw = $!gatewayConfigMap1.get( $key ) )
<td>$!encoder.htmlEncode( $gw.name )</td>
<td style="text-align:right">
+ <a href="showUpdateGateWayConfigForm.action?name=$key" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
<a href="javascript:removeGateway( $key, '$!encoder.jsEncode( $gw.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
</td>
</tr>
@@ -159,6 +160,6 @@
function removeGateway( key, name )
{
- removeItem( key, name, i18n_confirm_delete, "removeGatewayConfig.action" );
+ removeItem( key, name, i18n_confirm_delete, "removeGatewayConfig.action", function() { window.location="showSMSConfigureForm.action"; } );
}
</script>
\ 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/updateGateway.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.vm 2012-07-24 10:19:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.vm 2012-08-10 02:43:42 +0000
@@ -6,14 +6,18 @@
}, {
'rules' : getValidationRulesGateway()
} );
-
- changeValueType("bulksms");
+ changeValueType( document.getElementById( 'gwType' ).value );
});
+ function changeGwType( arg ) {
+ document.getElementById( 'gwType' ).value = arg;
+ };
+
var i18n_add_update_success = '$encoder.jsEscape( $i18n.getString( "add_update_gateway_success" ) , "'")';
</script>
<h3>$i18n.getString( "add_update_gateway_management" )</h3>
<form id="addGateWayConfigForm" name="addGateWayConfigForm">
+<input id="gwType" name="gwType" type="hidden" value=""/>
<table id="detailsList">
<tr>
<th colspan="2">$i18n.getString( "gateway_type" )</th>
@@ -22,10 +26,42 @@
<td>$i18n.getString( "type" ):</td>
<td>
<select id="gatewayType" style="width:100%;" onchange="changeValueType( this.value )">
- <option value="bulksms">$i18n.getString( "bulk_gw" )</option>
- <option value="clickatell">$i18n.getString( "clickatell_gw" )</option>
- <option value="http">$i18n.getString( "generic_http_gw" )</option>
- <option value="modem">$i18n.getString( "modem_gw" )</option>
+ #if($name == $bulkIndex)
+ <option value="bulksms" selected="selected">$i18n.getString( "bulk_gw" )</option>
+ <script type="text/javascript">
+ changeGwType("bulksms");
+ </script>
+ #else
+ <option value="bulksms">$i18n.getString( "bulk_gw" )</option>
+ #end
+
+ #if($name == $clickatellIndex)
+ <option value="clickatell" selected="selected">$i18n.getString( "clickatell_gw" )</option>
+ <script type="text/javascript">
+ changeGwType("clickatell");
+ </script>
+ #else
+ <option value="clickatell">$i18n.getString( "clickatell_gw" )</option>
+ #end
+
+ #if($name == $httpIndex)
+ <option value="http" selected="selected">$i18n.getString( "generic_http_gw" )</option>
+ <script type="text/javascript">
+ changeGwType("http");
+ </script>
+ #else
+ <option value="http">$i18n.getString( "generic_http_gw" )</option>
+ #end
+
+ #if($name == $modemIndex)
+ <option value="modem" selected="selected" changeValueType( "modem" )>$i18n.getString( "modem_gw" )</option>
+ <script type="text/javascript">
+ changeGwType("modem");
+ </script>
+ #else
+ <option value="modem">$i18n.getString( "modem_gw" )</option>
+ #end
+
</select>
</td>
</tr>