dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16541
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6308: (mobile) Added/Updated Gatewayconfig GUI - in process...
------------------------------------------------------------
revno: 6308
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-03-20 18:07:14 +0700
message:
(mobile) Added/Updated Gatewayconfig GUI - in process...
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/AddGateWayConfigAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/addGateway.vm
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowUpdateGateWayConfigFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateBulkGateWayConfigAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateClickatellGateWayConfigAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateGenericHTTPGateWayConfigAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/SmsConfigurationManager.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java
dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceTest.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/javascript/gateway.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.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/SmsConfigurationManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/SmsConfigurationManager.java 2012-03-12 20:25:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/SmsConfigurationManager.java 2012-03-20 11:07:14 +0000
@@ -28,11 +28,13 @@
*/
import org.hisp.dhis.sms.config.SmsConfiguration;
+import org.hisp.dhis.sms.config.SmsGatewayConfig;
public interface SmsConfigurationManager
{
SmsConfiguration getSmsConfiguration();
void updateSmsConfiguration( SmsConfiguration config );
-
+
+ SmsGatewayConfig checkInstanceOfGateway( Class<?> clazz );
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java 2012-03-01 08:56:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java 2012-03-20 11:07:14 +0000
@@ -34,9 +34,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.setting.SystemSettingManager;
-import org.hisp.dhis.sms.SmsConfigurationManager;
import org.hisp.dhis.sms.config.SmsConfigurable;
import org.hisp.dhis.sms.config.SmsConfiguration;
+import org.hisp.dhis.sms.config.SmsGatewayConfig;
import org.springframework.beans.factory.annotation.Autowired;
/**
@@ -102,4 +102,18 @@
// Reinitialize components relying on sms config.
initializeSmsConfigurables();
}
+
+ @Override
+ public SmsGatewayConfig checkInstanceOfGateway( Class<?> clazz )
+ {
+ for ( SmsGatewayConfig gateway : getSmsConfiguration().getGateways() )
+ {
+ if ( gateway.getClass().equals( clazz ) )
+ {
+ return gateway;
+ }
+ }
+
+ return null;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceTest.java 2012-03-09 09:40:27 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceTest.java 2012-03-20 11:07:14 +0000
@@ -50,7 +50,6 @@
public class OutboundSmsServiceTest
extends AbstractSmsTest
{
-
// These are only used for the integration test with store
@Autowired
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/AddGateWayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/AddGateWayConfigAction.java 2012-03-09 09:40:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/AddGateWayConfigAction.java 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-package org.hisp.dhis.mobile.action;
-
-import com.opensymphony.xwork2.Action;
-
-public class AddGateWayConfigAction
- implements Action
-{
- public String execute()
- throws Exception
- {
- return SUCCESS;
- }
-
-}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowUpdateGateWayConfigFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowUpdateGateWayConfigFormAction.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/ShowUpdateGateWayConfigFormAction.java 2012-03-20 11:07:14 +0000
@@ -0,0 +1,103 @@
+package org.hisp.dhis.mobile.action;
+
+/*
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import org.hisp.dhis.sms.SmsConfigurationManager;
+import org.hisp.dhis.sms.config.BulkSmsGatewayConfig;
+import org.hisp.dhis.sms.config.ClickatellGatewayConfig;
+import org.hisp.dhis.sms.config.ModemGatewayConfig;
+import org.hisp.dhis.sms.config.SmsConfiguration;
+import org.hisp.dhis.sms.config.SmsGatewayConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class ShowUpdateGateWayConfigFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private SmsConfigurationManager smsConfigurationManager;
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Map<Integer, SmsGatewayConfig> gatewayConfigMap = new HashMap<Integer, SmsGatewayConfig>();
+
+ public Map<Integer, SmsGatewayConfig> getGatewayConfigMap()
+ {
+ return gatewayConfigMap;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ SmsConfiguration smsConfig = smsConfigurationManager.getSmsConfiguration();
+
+ if ( smsConfig != null )
+ {
+ for ( SmsGatewayConfig gw : smsConfig.getGateways() )
+ {
+ if ( gw instanceof BulkSmsGatewayConfig )
+ {
+ gatewayConfigMap.put( 0, gw );
+ }
+ else if ( gw instanceof ClickatellGatewayConfig )
+ {
+ gatewayConfigMap.put( 1, gw );
+ }
+ else if ( gw instanceof ModemGatewayConfig )
+ {
+ gatewayConfigMap.put( 2, gw );
+ }
+ else
+ {
+ gatewayConfigMap.put( 3, gw );
+ }
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateBulkGateWayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateBulkGateWayConfigAction.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/UpdateBulkGateWayConfigAction.java 2012-03-20 11:07:14 +0000
@@ -0,0 +1,135 @@
+package org.hisp.dhis.mobile.action;
+
+/*
+ * Copyright (c) 2004-2011, 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.SmsConfigurationManager;
+import org.hisp.dhis.sms.config.BulkSmsGatewayConfig;
+import org.hisp.dhis.sms.config.SmsConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class UpdateBulkGateWayConfigAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private SmsConfigurationManager smsConfigurationManager;
+
+ public void setSmsConfigurationManager( SmsConfigurationManager smsConfigurationManager )
+ {
+ this.smsConfigurationManager = smsConfigurationManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String password;
+
+ public void setPassword( String password )
+ {
+ this.password = password;
+ }
+
+ private String username;
+
+ public void setUsername( String username )
+ {
+ this.username = username;
+ }
+
+ private String gatewayType;
+
+ public void setGatewayType( String gatewayType )
+ {
+ this.gatewayType = gatewayType;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ if ( gatewayType != null && gatewayType.equals( "bulksms" ) )
+ {
+ SmsConfiguration config = smsConfigurationManager.getSmsConfiguration();
+
+ if ( config != null )
+ {
+ BulkSmsGatewayConfig gatewayConfig = (BulkSmsGatewayConfig) smsConfigurationManager
+ .checkInstanceOfGateway( BulkSmsGatewayConfig.class );
+
+ int index = 0;
+
+ if ( gatewayConfig == null )
+ {
+ gatewayConfig = new BulkSmsGatewayConfig();
+ }
+ else
+ {
+ index = config.getGateways().indexOf( gatewayConfig );
+ }
+
+ gatewayConfig.setName( name );
+ gatewayConfig.setPassword( password );
+ gatewayConfig.setUsername( username );
+
+ if ( index >= 0 )
+ {
+ config.getGateways().set( index, gatewayConfig );
+ }
+ else
+ {
+ config.getGateways().add( gatewayConfig );
+ }
+
+ smsConfigurationManager.updateSmsConfiguration( config );
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateClickatellGateWayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateClickatellGateWayConfigAction.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/UpdateClickatellGateWayConfigAction.java 2012-03-20 11:07:14 +0000
@@ -0,0 +1,143 @@
+package org.hisp.dhis.mobile.action;
+
+/*
+ * Copyright (c) 2004-2011, 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.SmsConfigurationManager;
+import org.hisp.dhis.sms.config.ClickatellGatewayConfig;
+import org.hisp.dhis.sms.config.SmsConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class UpdateClickatellGateWayConfigAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private SmsConfigurationManager smsConfigurationManager;
+
+ public void setSmsConfigurationManager( SmsConfigurationManager smsConfigurationManager )
+ {
+ this.smsConfigurationManager = smsConfigurationManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String password;
+
+ public void setPassword( String password )
+ {
+ this.password = password;
+ }
+
+ private String username;
+
+ public void setUsername( String username )
+ {
+ this.username = username;
+ }
+
+ private String apiId;
+
+ public void setApiId( String apiId )
+ {
+ this.apiId = apiId;
+ }
+
+ private String gatewayType;
+
+ public void setGatewayType( String gatewayType )
+ {
+ this.gatewayType = gatewayType;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ if ( gatewayType != null && gatewayType.equals( "clickatell" ) )
+ {
+ SmsConfiguration config = smsConfigurationManager.getSmsConfiguration();
+
+ if ( config != null )
+ {
+ ClickatellGatewayConfig gatewayConfig = (ClickatellGatewayConfig) smsConfigurationManager
+ .checkInstanceOfGateway( ClickatellGatewayConfig.class );
+
+ int index = 0;
+
+ if ( gatewayConfig == null )
+ {
+ gatewayConfig = new ClickatellGatewayConfig();
+ }
+ else
+ {
+ index = config.getGateways().indexOf( gatewayConfig );
+ }
+
+ gatewayConfig.setName( name );
+ gatewayConfig.setPassword( password );
+ gatewayConfig.setUsername( username );
+ gatewayConfig.setApiId( apiId );
+
+ if ( index >= 0 )
+ {
+ config.getGateways().set( index, gatewayConfig );
+ }
+ else
+ {
+ config.getGateways().add( gatewayConfig );
+ }
+
+ smsConfigurationManager.updateSmsConfiguration( config );
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateGenericHTTPGateWayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateGenericHTTPGateWayConfigAction.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/UpdateGenericHTTPGateWayConfigAction.java 2012-03-20 11:07:14 +0000
@@ -0,0 +1,150 @@
+package org.hisp.dhis.mobile.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 java.util.HashMap;
+import java.util.Map;
+
+import org.hisp.dhis.sms.SmsConfigurationManager;
+import org.hisp.dhis.sms.config.GenericHttpGatewayConfig;
+import org.hisp.dhis.sms.config.SmsConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class UpdateGenericHTTPGateWayConfigAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private SmsConfigurationManager smsConfigurationManager;
+
+ public void setSmsConfigurationManager( SmsConfigurationManager smsConfigurationManager )
+ {
+ this.smsConfigurationManager = smsConfigurationManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String password;
+
+ public void setPassword( String password )
+ {
+ this.password = password;
+ }
+
+ private String username;
+
+ public void setUsername( String username )
+ {
+ this.username = username;
+ }
+
+ private String urlTemplate;
+
+ public void setUrlTemplate( String url )
+ {
+ this.urlTemplate = url;
+ }
+
+ private String gatewayType;
+
+ public void setGatewayType( String gatewayType )
+ {
+ this.gatewayType = gatewayType;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ if ( gatewayType != null && gatewayType.equals( "http" ) )
+ {
+ SmsConfiguration config = smsConfigurationManager.getSmsConfiguration();
+
+ if ( config != null )
+ {
+ GenericHttpGatewayConfig gatewayConfig = (GenericHttpGatewayConfig) smsConfigurationManager
+ .checkInstanceOfGateway( GenericHttpGatewayConfig.class );
+
+ int index = 0;
+
+ if ( gatewayConfig == null )
+ {
+ gatewayConfig = new GenericHttpGatewayConfig();
+ }
+ else
+ {
+ index = config.getGateways().indexOf( gatewayConfig );
+ }
+
+ Map<String, String> map = new HashMap<String, String>();
+
+ map.put( "username", username );
+ map.put( "password", password );
+
+ gatewayConfig.setParameters( map );
+ gatewayConfig.setName( name );
+ gatewayConfig.setUrlTemplate( urlTemplate );
+
+ if ( index >= 0 )
+ {
+ config.getGateways().set( index, gatewayConfig );
+ }
+ else
+ {
+ config.getGateways().add( gatewayConfig );
+ }
+
+ smsConfigurationManager.updateSmsConfiguration( config );
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.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/UpdateModemGateWayConfigAction.java 2012-03-20 11:07:14 +0000
@@ -0,0 +1,175 @@
+package org.hisp.dhis.mobile.action;
+
+/*
+ * Copyright (c) 2004-2011, 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.SmsConfigurationManager;
+import org.hisp.dhis.sms.config.ModemGatewayConfig;
+import org.hisp.dhis.sms.config.SmsConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class UpdateModemGateWayConfigAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private SmsConfigurationManager smsConfigurationManager;
+
+ public void setSmsConfigurationManager( SmsConfigurationManager smsConfigurationManager )
+ {
+ this.smsConfigurationManager = smsConfigurationManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String gatewayType;
+
+ public void setGatewayType( String gatewayType )
+ {
+ this.gatewayType = gatewayType;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String port;
+
+ public void setPort( String port )
+ {
+ this.port = port;
+ }
+
+ private Integer baudRate;
+
+ public void setBaudRate( Integer baudRate )
+ {
+ this.baudRate = baudRate;
+ }
+
+ private String manufacturer;
+
+ public void setManufacturer( String manufacturer )
+ {
+ this.manufacturer = manufacturer;
+ }
+
+ private String model;
+
+ public void setModel( String model )
+ {
+ this.model = model;
+ }
+
+ private String pin;
+
+ public void setPin( String pin )
+ {
+ this.pin = pin;
+ }
+
+ public boolean inbound;
+
+ public void setInbound( boolean inbound )
+ {
+ this.inbound = inbound;
+ }
+
+ public boolean outbound;
+
+ public void setOutbound( boolean outbound )
+ {
+ this.outbound = outbound;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ if ( gatewayType != null && gatewayType.equals( "modem" ) )
+ {
+ SmsConfiguration config = smsConfigurationManager.getSmsConfiguration();
+
+ if ( config != null )
+ {
+ ModemGatewayConfig gatewayConfig = (ModemGatewayConfig) smsConfigurationManager
+ .checkInstanceOfGateway( ModemGatewayConfig.class );
+
+ int index = 0;
+
+ if ( gatewayConfig == null )
+ {
+ gatewayConfig = new ModemGatewayConfig();
+ }
+ else
+ {
+ index = config.getGateways().indexOf( gatewayConfig );
+ }
+
+ gatewayConfig.setName( name );
+ gatewayConfig.setPort( port );
+ gatewayConfig.setBaudRate( baudRate );
+ gatewayConfig.setManufacturer( manufacturer );
+ gatewayConfig.setModel( model );
+ gatewayConfig.setPin( pin );
+ gatewayConfig.setInbound( inbound );
+ gatewayConfig.setOutbound( outbound );
+
+ if ( index >= 0 )
+ {
+ config.getGateways().set( index, gatewayConfig );
+ }
+ else
+ {
+ config.getGateways().add( gatewayConfig );
+ }
+
+ smsConfigurationManager.updateSmsConfiguration( config );
+ }
+ }
+
+ 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-03-15 03:52:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-03-20 11:07:14 +0000
@@ -46,7 +46,20 @@
</bean>
<!-- SMS Service Configuration -->
-
- <bean id="org.hisp.dhis.mobile.action.AddGateWayConfigAction" class="org.hisp.dhis.mobile.action.AddGateWayConfigAction" 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.ShowUpdateGateWayConfigFormAction"
+ class="org.hisp.dhis.mobile.action.ShowUpdateGateWayConfigFormAction" 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-03-14 10:36:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-03-20 11:07:14 +0000
@@ -45,4 +45,4 @@
bulk_gw=BulkSMS Gateway
clickatell_gw=Clickatell Gateway
generic_http_gw=Generic HTTP Gateway
-modem_gateway=Modem Gateway
\ No newline at end of file
+modem_gw=Modem Gateway
\ No newline at end of file
=== 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-03-15 10:01:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-03-20 11:07:14 +0000
@@ -72,9 +72,9 @@
<param name="requiredAuthorities">F_MOBILE_SETTINGS</param>
</action>
- <action name="addGateWayConfig" class="org.hisp.dhis.mobile.action.AddGateWayConfigAction">
+ <action name="showUpdateGateWayConfigForm" class="org.hisp.dhis.mobile.action.ShowUpdateGateWayConfigFormAction">
<result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-mobile/addGateway.vm</param>
+ <param name="page">/dhis-web-maintenance-mobile/updateGateway.vm</param>
<param name="menu">/dhis-web-maintenance-mobile/menu.vm</param>
</action>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/addGateway.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/addGateway.vm 2011-11-14 08:57:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/addGateway.vm 1970-01-01 00:00:00 +0000
@@ -1,107 +0,0 @@
-<script type="text/javascript" src="javascript/gateway.js"></script>
-<script type="text/javascript">
- $(document).ready(function() {
- changeValueType("modem");
- });
-</script>
-<h3>$i18n.getString("add_gateway")</h3>
-<form id="add" name="addGateWayConfig" action="addGateWayConfig.action" method="post" >
- <table id="detailsList">
- <tr>
- <th colspan="2">$i18n.getString("gateway_type")</th>
- </tr>
- <tr>
- <td>$i18n.getString("type"):</td>
- <td>
- <select style="width: 100%;" onchange="changeValueType( this.value )">
- <option value="modem">Modem</option>
- <option value="clickatell">Clickatell</option>
- <option value="bulksms">BulkSMS</option>
- </select>
- </td>
- </tr>
- <tr>
- <th colspan="2">$i18n.getString("gateway_configuration")</th>
- </tr>
- <tbody id="modemFields">
- <tr>
- <td>$i18n.getString("gateway_name"):</td>
- <td><input type="text" name="name" id="name" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("port"):</td>
- <td><input type="text" name="port" id="port" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("baudrate"):</td>
- <td><input type="text" name="port" id="port" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("manufacturer"):</td>
- <td><input type="text" name="manufacturer" id="manufacturer" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("model"):</td>
- <td><input type="text" name="model" id="model" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("pin"):</td>
- <td><input type="text" name="pin" id="pin" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("inbound"):</td>
- <td>
- <select style="width: 100%;">
- <option value="true">$i18n.getString("yes")</option>
- <option value="false">$i18n.getString("no")</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>$i18n.getString("outbound"):</td>
- <td>
- <select style="width: 100%;">
- <option value="true">$i18n.getString("yes")</option>
- <option value="false">$i18n.getString("no")</option>
- </select>
- </td>
- </tr>
- </tbody>
- <tbody id="bulksmsFields">
- <tr>
- <td>$i18n.getString("gateway_name"):</td>
- <td><input type="text" name="name" id="name" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("username")::</td>
- <td><input type="text" name="username" id="username" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("password"):</td>
- <td><input type="text" name="password" id="password" style="width: 28em" /></td>
- </tr>
- </tbody>
- <tbody id="clickatellFields">
- <tr>
- <td>$i18n.getString("gateway_name"):</td>
- <td><input type="text" name="name" id="name" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("username")::</td>
- <td><input type="text" name="username" id="username" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("password")::</td>
- <td><input type="text" name="password" id="password" style="width: 28em" /></td>
- </tr>
- <tr>
- <td>$i18n.getString("api_id")::</td>
- <td><input type="text" name="apiid" id="apiid" style="width: 28em" /></td>
- </tr>
- </tbody>
- <tr>
- <td colspan="2" align="right"><input type="button" name="save" value="$i18n.getString('save_settings')"/><input type="button" name="back" value="$i18n.getString('back'):"/></td>
- </tr>
- </table>
-</form>
-
=== 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 2011-11-14 08:57:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js 2012-03-20 11:07:14 +0000
@@ -1,16 +1,20 @@
+currentType = '';
+
function changeValueType( value )
{
hideAll();
- if ( value == 'modem')
- {
+
+ if ( value == 'modem' ) {
showById( "modemFields" );
- } else if (value == 'bulksms')
- {
+ } else if ( value == 'bulksms' ) {
showById( "bulksmsFields" );
- } else
- {
+ } else if ( value == 'clickatell' ) {
showById( "clickatellFields" );
- }
+ } else {
+ showById( "genericHTTPFields" );
+ }
+
+ currentType = type;
}
function hideAll()
@@ -18,4 +22,109 @@
hideById( "modemFields" );
hideById( "bulksmsFields" );
hideById( "clickatellFields" );
+ hideById( "genericHTTPFields" );
+}
+
+function getValidationRulesGateway()
+{
+ var rules = {};
+
+ if ( currentType == 'modem' ) {
+ rules = {
+ 'modemFields input[id=name]' : { 'required' : true },
+ 'modemFields input[id=port]' : { 'required' : true },
+ 'modemFields input[id=baudrate]' : { 'required' : true },
+ 'modemFields input[id=manufacturer]' : { 'required' : true },
+ 'modemFields input[id=model]' : { 'required' : true },
+ 'modemFields input[id=pin]' : { 'required' : true },
+ 'modemFields select[id=inbound]' : { 'required' : true },
+ 'modemFields select[id=outbound]' : { 'required' : true }
+ };
+ } else if ( currentType == 'bulksms' ) {
+ rules = {
+ 'bulksmsFields input[id=name]' : { 'required' : true },
+ 'bulksmsFields input[id=username]' : { 'required' : true },
+ 'bulksmsFields input[id=password]' : { 'required' : true }
+ };
+ } else if ( currentType == 'clickatell' ) {
+ rules = {
+ 'clickatellFields input[id=name]' : { 'required' : true },
+ 'clickatellFields input[id=username]' : { 'required' : true },
+ 'clickatellFields input[id=password]' : { 'required' : true },
+ 'clickatellFields input[id=apiId]' : { 'required' : true }
+ };
+ } else {
+ rules = {
+ 'genericHTTPFields input[id=name]' : { 'required' : true },
+ 'genericHTTPFields input[id=username]' : { 'required' : true },
+ 'genericHTTPFields input[id=password]' : { 'required' : true },
+ 'genericHTTPFields input[id=urlTemplate]' : { 'required' : true }
+ };
+ }
+
+ return rules;
+}
+
+function saveGatewayConfig()
+{
+ if ( currentType == 'modem' )
+ {
+ jQuery.postJSON( "saveBulkSMSConfig.action", {
+ gatewayType: getFieldValue( 'gatewayType' ),
+ name: getFieldValue( 'modemFields input[id=name]' ),
+ port: getFieldValue( 'modemFields input[id=port]' ),
+ baudrate: getFieldValue( 'modemFields input[id=baudrate]' ),
+ manufacturer: getFieldValue( 'modemFields input[id=manufacturer]' ),
+ model: getFieldValue( 'modemFields input[id=model]' ),
+ pin: getFieldValue( 'modemFields input[id=pin]' ),
+ inbound: getFieldValue( 'modemFields select[id=inbound]' ),
+ outbound: getFieldValue( 'modemFields select[id=outbound]' )
+ }, function ( json ) {
+ showMessage( json );
+ } );
+ }
+ else if ( currentType == 'bulksms' )
+ {
+ jQuery.postJSON( "saveBulkSMSConfig.action", {
+ gatewayType: getFieldValue( 'gatewayType' ),
+ name: getFieldValue( 'bulksmsFields input[id=name]' ),
+ username: getFieldValue( 'bulksmsFields input[id=username]' ),
+ password: getFieldValue( 'bulksmsFields input[id=password]' )
+ }, function ( json ) {
+ showMessage( json );
+ } );
+ }
+ else if ( currentType == 'clickatell' )
+ {
+ jQuery.postJSON( "saveBulkSMSConfig.action", {
+ gatewayType: getFieldValue( 'gatewayType' ),
+ name: getFieldValue( 'clickatellFields input[id=name]' ),
+ username: getFieldValue( 'clickatellFields input[id=username]' ),
+ password: getFieldValue( 'clickatellFields input[id=password]' ),
+ apiId: getFieldValue( 'clickatellFields input[id=apiId]' )
+ }, function ( json ) {
+ showMessage( json );
+ } );
+ }
+ else
+ {
+ jQuery.postJSON( "saveBulkSMSConfig.action", {
+ gatewayType: getFieldValue( 'gatewayType' ),
+ name: getFieldValue( 'genericHTTPFields input[id=name]' ),
+ username: getFieldValue( 'genericHTTPFields input[id=username]' ),
+ password: getFieldValue( 'genericHTTPFields input[id=password]' ),
+ urlTemplate: getFieldValue( 'genericHTTPFields input[id=urlTemplate]' )
+ }, function ( json ) {
+ showMessage( json );
+ } );
+ }
+}
+
+function showMessage( json )
+{
+ if ( json.response == "success" ) {
+ showSuccessMessage( json.message );
+ } else {
+ showErrorMessage( json.message );
+ }
}
\ 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/smsServiceConfiguration.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm 2012-03-14 10:36:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm 2012-03-20 11:07:14 +0000
@@ -46,14 +46,14 @@
<tbody>
<tr>
<td>$i18n.getString("polling_interval_in_seconds"):</td>
- <td><input type="text" id="pollingInterval" name="pollingInterval" style="width:20em" value="$smsConfig.pollingInterval"></td>
+ <td><input type="text" id="pollingInterval" name="pollingInterval" style="width:20em" value="$!smsConfig.pollingInterval"></td>
</tr>
<tr>
<td>$i18n.getString("server_phone_number"):</td>
- <td><input type="text" id="serverPhoneNumber" name="serverPhoneNumber" style="width:20em" value="$smsConfig.longNumber"></td>
+ <td><input type="text" id="serverPhoneNumber" name="serverPhoneNumber" style="width:20em" value="$!smsConfig.longNumber"></td>
</tr>
<tr>
- <td align="right" colspan="2"><input type="button" value="$i18n.getString('add')" onclick="window.location.href='addGateWayConfig.action'"/></td>
+ <td align="right" colspan="2"><input type="button" value="$i18n.getString('add')" onclick="window.location.href='showUpdateGateWayConfigForm.action'"/></td>
</tr>
<tr>
<td colspan="2">
@@ -70,8 +70,8 @@
<tr>
<td>$gateWay.name</td>
<td style="text-align:right">
- <a title="$i18n.getString( 'edit' )" href="editGateWayConfig.action?gateWayID="><img alt="$i18n.getString( 'edit' )" src="../images/edit.png"/></a>
- <a title="$i18n.getString( 'remove' )" href="#"><img alt="$i18n.getString( 'remove' )" src="../images/delete.png"/></a>
+ <!--a title="$i18n.getString( 'edit' )" href="editGateWayConfig.action?gateWayID="><img alt="$i18n.getString( 'edit' )" src="../images/edit.png"/></a>
+ <a title="$i18n.getString( 'remove' )" href="#"><img alt="$i18n.getString( 'remove' )" src="../images/delete.png"/></a-->
</td>
</tr>
#end
=== added 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 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/updateGateway.vm 2012-03-20 11:07:14 +0000
@@ -0,0 +1,140 @@
+<script type="text/javascript" src="javascript/gateway.js"></script>
+<script type="text/javascript">
+ jQuery(document).ready(function() {
+
+ validation2( "addGateWayConfigForm", function( form ) {
+ saveGatewayConfig();
+ }, {
+ 'rules' : getValidationRulesGateway()
+ } );
+
+ changeValueType("modem");
+ });
+</script>
+<h3>$i18n.getString( "add_update_gateway" )</h3>
+<form id="addGateWayConfigForm" name="addGateWayConfigForm">
+ <table id="detailsList">
+ <tr>
+ <th colspan="2">$i18n.getString( "gateway_type" )</th>
+ </tr>
+ <tr>
+ <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>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th colspan="2">$i18n.getString( "gateway_configuration" )</th>
+ </tr>
+ #set( $modemGateway = $!gatewayConfigMap.get( 2 ) )
+ <tbody id="modemFields">
+ <tr>
+ <td>$i18n.getString( "gateway_name" ):</td>
+ <td><input type="text" name="name" id="name" style="width: 28em" value="$!encoder.htmlEncode( $!modemGateway.name )"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "port" ):</td>
+ <td><input type="text" name="port" id="port" style="width: 28em" value="$!modemGateway.port"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "baudrate" ):</td>
+ <td><input type="text" name="baudRate" id="baudRate" style="width: 28em" value="$!modemGateway.baudRate"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "manufacturer" ):</td>
+ <td><input type="text" name="manufacturer" id="manufacturer" style="width: 28em" value="$!modemGateway.manufacturer"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "model" ):</td>
+ <td><input type="text" name="model" id="model" style="width: 28em" value="$!modemGateway.model"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "pin" ):</td>
+ <td><input type="text" name="pin" id="pin" style="width: 28em" value="$!modemGateway.pin"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "inbound" ):</td>
+ <td>
+ <select id="inbound" name="inbound" style="width:100%;">
+ #if ( $!modemGateway.inbound )
+ <option value="$!modemGateway.inbound">#if( $!modemGateway.inbound )$i18n.getString( "yes" )#else$i18n.getString( "no" )#end</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "outbound" ):</td>
+ <td>
+ <select id="outbound" name="outbound" style="width:100%;">
+ #if ( $!modemGateway.outbound )
+ <option value="$!modemGateway.outbound">#if( $!modemGateway.outbound )$i18n.getString( "yes" )#else$i18n.getString( "no" )#end</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ </tbody>
+ #set( $bulkGateway = $!gatewayConfigMap.get( 0 ) )
+ <tbody id="bulksmsFields">
+ <tr>
+ <td>$i18n.getString( "gateway_name" ):</td>
+ <td><input type="text" name="name" id="name" style="width: 28em" value="$!encoder.htmlEncode( $!bulkGateway.name )"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "username" ):</td>
+ <td><input type="text" name="username" id="username" style="width: 28em" value="$!bulkGateway.username"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "password" ):</td>
+ <td><input type="text" name="password" id="password" style="width: 28em" value="$!bulkGateway.password"/></td>
+ </tr>
+ </tbody>
+ #set( $clickatellGateway = $!gatewayConfigMap.get( 1 ) )
+ <tbody id="clickatellFields">
+ <tr>
+ <td>$i18n.getString( "gateway_name" ):</td>
+ <td><input type="text" name="name" id="name" style="width: 28em" value="$!encoder.htmlEncode( $!clickatellGateway.name )"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "username" ):</td>
+ <td><input type="text" name="username" id="username" style="width: 28em" value="$!clickatellGateway.username"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "password" ):</td>
+ <td><input type="text" name="password" id="password" style="width: 28em" value="$!clickatellGateway.password"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "api_id" ):</td>
+ <td><input type="text" name="apiId" id="apiId" style="width: 28em" value="$!clickatellGateway.apiId"/></td>
+ </tr>
+ </tbody>
+ #set( $httpGateway = $!gatewayConfigMap.get( 3 ) )
+ <tbody id="genericHTTPFields">
+ <tr>
+ <td>$i18n.getString( "gateway_name" ):</td>
+ <td><input type="text" name="name" id="name" style="width: 28em" value="$!encoder.htmlEncode( $!httpGateway.name )"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "username" ):</td>
+ <td><input type="text" name="username" id="username" style="width: 28em" value="$!httpGateway.username"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "password" ):</td>
+ <td><input type="text" name="password" id="password" style="width: 28em" value="$!httpGateway.password"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "url_template" ):</td>
+ <td><input type="text" name="urlTemplate" id="urlTemplate" style="width: 28em" value="$!encoder.htmlEncode( $!httpGateway.urlTemplate )"/></td>
+ </tr>
+ </tbody>
+ <tr>
+ <td colspan="2" align="right"><input type="submit" value="$i18n.getString( 'save_settings' )" style="width: 28em"/>
+ <input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='showSMSConfigureForm.action'" style="width: 28em"/></td>
+ </tr>
+ </table>
+</form>
+