← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9573: (Mobile) Added a new property into SmsGatewayConfig which allow the user choose the default gateway.

 

------------------------------------------------------------
revno: 9573
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-01-22 15:31:21 +0700
message:
  (Mobile) Added a new property into SmsGatewayConfig which allow the user choose the default gateway.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateDefaultGatewayAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-off.png
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-on.png
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/SmsConfiguration.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/SmsGatewayConfig.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsTransportService.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.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-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/RemoveGatewayConfigAction.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/java/org/hisp/dhis/mobile/action/UpdateSMPPGateWayConfigAction.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/org/hisp/dhis/mobile/i18n_module_vi_VN.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/sendSMS.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm
  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/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/config/SmsConfiguration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/SmsConfiguration.java	2012-03-23 04:01:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/SmsConfiguration.java	2013-01-22 08:31:21 +0000
@@ -45,14 +45,18 @@
 {
     private static final long serialVersionUID = 7460688383539123303L;
 
+    private boolean enabled = false;
+
     private String longNumber;
 
     private Integer pollingInterval;
 
-    private boolean enabled = false;
-
     private List<SmsGatewayConfig> gateways;
 
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
     public SmsConfiguration()
     {
         this.gateways = new ArrayList<SmsGatewayConfig>();
@@ -64,6 +68,10 @@
         this.gateways = new ArrayList<SmsGatewayConfig>();
     }
 
+    // -------------------------------------------------------------------------
+    // Getter && Setter
+    // -------------------------------------------------------------------------
+
     public boolean isEnabled()
     {
         return enabled;
@@ -108,5 +116,17 @@
     {
         this.pollingInterval = pollingInterval;
     }
-
+    
+    public SmsGatewayConfig getDefaultGateway()
+    {
+        for ( SmsGatewayConfig gw : gateways )
+        {   
+            if ( gw.isDefault() )
+            {
+                return gw;
+            }
+        }
+        
+        return null;
+    }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/SmsGatewayConfig.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/SmsGatewayConfig.java	2012-03-01 08:56:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/SmsGatewayConfig.java	2013-01-22 08:31:21 +0000
@@ -38,6 +38,8 @@
 {
     private String name;
 
+    private boolean isDefault;
+
     public String getName()
     {
         return name;
@@ -48,8 +50,17 @@
         this.name = name;
     }
 
+    public boolean isDefault()
+    {
+        return isDefault;
+    }
+
+    public void setDefault( boolean isDefault )
+    {
+        this.isDefault = isDefault;
+    }
+
     public abstract boolean isInbound();
 
     public abstract boolean isOutbound();
-
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsTransportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsTransportService.java	2012-03-23 04:01:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsTransportService.java	2013-01-22 08:31:21 +0000
@@ -50,4 +50,6 @@
     String getServiceStatus();
 
     String getMessageStatus();
+    
+    String getDefaultGateway();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java	2012-10-18 11:22:57 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java	2013-01-22 08:31:21 +0000
@@ -101,10 +101,6 @@
         {
             message = sendMessage( text, phones, gatewayId );
         }
-        else if ( log.isDebugEnabled() )
-        {
-            log.debug( "Not sending message to any of the recipients" );
-        }
         else
         {
             message = "no_recipient";
@@ -128,11 +124,6 @@
             if ( smsNotification && phoneNumber != null && !phoneNumber.trim().isEmpty() )
             {
                 recipients.add( phoneNumber );
-
-                if ( log.isDebugEnabled() )
-                {
-                    log.debug( "Adding user as sms recipient: " + user + " with phone number: " + phoneNumber );
-                }
             }
         }
 
@@ -175,11 +166,6 @@
         try
         {
             message = outboundSmsService.sendMessage( sms, id );
-
-            if ( log.isDebugEnabled() )
-            {
-                log.debug( "Sent message to " + recipients + ": " + text );
-            }
         }
         catch ( SmsServiceException e )
         {

=== 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-10-22 08:51:28 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java	2013-01-22 08:31:21 +0000
@@ -27,7 +27,7 @@
     private static final Log log = LogFactory.getLog( TestOutboundSmsService.class );
 
     private boolean enabled = true;
-    
+
     private String message = "success";
 
     @Override
@@ -40,7 +40,7 @@
         }
 
         log.debug( "Send message: " + sms );
-        
+
         return message;
     }
 
@@ -116,7 +116,6 @@
     public void updateOutboundSms( OutboundSms sms )
     {
         // TODO Auto-generated method stub
-        
     }
 
     @Override
@@ -130,6 +129,13 @@
     public void deleteById( Integer outboundSmsId )
     {
         // TODO Auto-generated method stub
-        
+
+    }
+
+    @Override
+    public String getDefaultGateway()
+    {
+        // 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-11-20 13:34:03 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java	2013-01-22 08:31:21 +0000
@@ -61,14 +61,6 @@
 {
     private static final Log log = LogFactory.getLog( SmsLibService.class );
 
-    private Map<String, String> gatewayMap = new HashMap<String, String>();
-
-    private GateWayFactory gatewayFactory = new GateWayFactory();
-
-    private SmsConfiguration config;
-
-    private String message = "success";
-
     private final String BULK_GATEWAY = "bulk_gw";
 
     private final String CLICKATELL_GATEWAY = "clickatell_gw";
@@ -79,6 +71,14 @@
 
     private final String SMPP_GATEWAY = "smpp_gw";
 
+    private Map<String, String> gatewayMap = new HashMap<String, String>();
+
+    private GateWayFactory gatewayFactory = new GateWayFactory();
+
+    private SmsConfiguration config;
+
+    private String message = "success";
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -157,7 +157,7 @@
 
         try
         {
-            log.debug( "Sending message " + sms );
+            log.info( "Sending message " + sms );
 
             if ( gatewayId == null || gatewayId.isEmpty() )
             {
@@ -176,7 +176,6 @@
         catch ( IOException e )
         {
             log.warn( "Unable to send message: " + sms, e );
-
             message = "Unable to send message: " + sms + " " + e.getCause().getMessage();
         }
         catch ( InterruptedException e )
@@ -184,11 +183,16 @@
             log.warn( "Unable to send message: " + sms, e );
             message = "Unable to send message: " + sms + " " + e.getCause().getMessage();
         }
+        catch ( Exception e )
+        {
+            log.warn( "Unable to send message: " + sms, e );
+            message = "Unable to send message: " + sms + " " + e.getCause().getMessage();
+        }
         finally
         {
             if ( recipients.size() > 1 )
             {
-                // Make sure we delete tmp. group
+                // Make sure we delete "tmp" group
                 removeGroup( recipient );
             }
             sms.setStatus( OutboundSmsStatus.ERROR );
@@ -513,4 +517,43 @@
         outboundSmsStore.delete( sms );
     }
 
+    public String getDefaultGateway()
+    {
+        SmsGatewayConfig gatewayConfig = config.getDefaultGateway();
+
+        if ( gatewayConfig == null )
+        {
+            return null;
+        }
+
+        if ( getGatewayMap() == null )
+        {
+            return null;
+        }
+
+        String gatewayId;
+
+        if ( gatewayConfig instanceof BulkSmsGatewayConfig )
+        {
+            gatewayId = gatewayMap.get( BULK_GATEWAY );
+        }
+        else if ( gatewayConfig instanceof ClickatellGatewayConfig )
+        {
+            gatewayId = gatewayMap.get( CLICKATELL_GATEWAY );
+        }
+        else if ( gatewayConfig instanceof GenericHttpGatewayConfig )
+        {
+            gatewayId = gatewayMap.get( HTTP_GATEWAY );
+        }
+        else if ( gatewayConfig instanceof SMPPGatewayConfig )
+        {
+            gatewayId = gatewayMap.get( SMPP_GATEWAY );
+        }
+        else
+        {
+            gatewayId = gatewayMap.get( MODEM_GATEWAY );
+        }
+
+        return gatewayId;
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java	2013-01-21 04:36:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java	2013-01-22 08:31:21 +0000
@@ -44,6 +44,7 @@
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.sms.MessageSender;
+import org.hisp.dhis.sms.outbound.OutboundSmsTransportService;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -73,6 +74,9 @@
     @Autowired
     private MessageSender messageSender;
 
+    @Autowired
+    private OutboundSmsTransportService transportService;
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -137,7 +141,9 @@
     @SuppressWarnings( "unchecked" )
     public String execute()
     {
-        if ( gatewayId == null || gatewayId.isEmpty() )
+        gatewayId = transportService.getDefaultGateway();
+
+        if ( gatewayId == null || gatewayId.trim().length() == 0 )
         {
             message = i18n.getString( "please_select_a_gateway_type_to_send_sms" );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/RemoveGatewayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/RemoveGatewayConfigAction.java	2012-12-04 23:23:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/RemoveGatewayConfigAction.java	2013-01-22 08:31:21 +0000
@@ -88,7 +88,6 @@
     public String execute()
         throws Exception
     {
-
         SmsConfiguration smsConfig = smsConfigurationManager.getSmsConfiguration();
 
         Iterator<SmsGatewayConfig> it = smsConfig.getGateways().iterator();

=== modified 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	2012-07-24 10:19:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateBulkGateWayConfigAction.java	2013-01-22 08:31:21 +0000
@@ -73,9 +73,9 @@
     {
         this.username = username;
     }
-    
+
     private String region;
-    
+
     public String getRegion()
     {
         return region;
@@ -124,7 +124,12 @@
                 gatewayConfig.setPassword( password );
                 gatewayConfig.setUsername( username );
                 gatewayConfig.setRegion( region );
-                
+
+                if ( config.getGateways() == null || config.getGateways().isEmpty() )
+                {
+                    gatewayConfig.setDefault( true );
+                }
+
                 if ( index >= 0 )
                 {
                     config.getGateways().set( index, gatewayConfig );

=== modified 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	2012-03-21 02:20:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateClickatellGateWayConfigAction.java	2013-01-22 08:31:21 +0000
@@ -120,6 +120,11 @@
                 gatewayConfig.setUsername( username );
                 gatewayConfig.setApiId( apiId );
 
+                if ( config.getGateways() == null || config.getGateways().isEmpty() )
+                {
+                    gatewayConfig.setDefault( true );
+                }
+
                 if ( index >= 0 )
                 {
                     config.getGateways().set( index, gatewayConfig );

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateDefaultGatewayAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateDefaultGatewayAction.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/UpdateDefaultGatewayAction.java	2013-01-22 08:31:21 +0000
@@ -0,0 +1,97 @@
+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 org.hisp.dhis.sms.SmsConfigurationManager;
+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 UpdateDefaultGatewayAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private SmsConfigurationManager smsConfigurationManager;
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private Integer index;
+
+    public void setIndex( Integer index )
+    {
+        this.index = index;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        SmsConfiguration smsConfig = smsConfigurationManager.getSmsConfiguration();
+
+        SmsGatewayConfig defaultGateway = smsConfig.getGateways().get( index );
+
+        if ( defaultGateway != null )
+        {
+            int i = 0;
+
+            for ( SmsGatewayConfig gw : smsConfig.getGateways() )
+            {
+                if ( index == i )
+                {
+                    gw.setDefault( true );
+                }
+                else
+                {
+                    gw.setDefault( false );
+                }
+
+                smsConfig.getGateways().set( i++, gw );
+            }
+
+            smsConfigurationManager.updateSmsConfiguration( smsConfig );
+        }
+
+        return SUCCESS;
+    }
+}

=== modified 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	2012-03-21 02:20:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateGenericHTTPGateWayConfigAction.java	2013-01-22 08:31:21 +0000
@@ -127,6 +127,11 @@
                 gatewayConfig.setName( name );
                 gatewayConfig.setUrlTemplate( urlTemplate );
 
+                if ( config.getGateways() == null || config.getGateways().isEmpty() )
+                {
+                    gatewayConfig.setDefault( true );
+                }
+
                 if ( index >= 0 )
                 {
                     config.getGateways().set( index, gatewayConfig );

=== modified 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	2012-09-05 03:16:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.java	2013-01-22 08:31:21 +0000
@@ -149,7 +149,7 @@
                 {
                     index = config.getGateways().indexOf( gatewayConfig );
                 }
-                
+
                 gatewayConfig.setName( name );
                 gatewayConfig.setPort( port );
                 gatewayConfig.setBaudRate( baudRate );
@@ -160,6 +160,11 @@
                 gatewayConfig.setInbound( inbound );
                 gatewayConfig.setOutbound( outbound );
 
+                if ( config.getGateways() == null || config.getGateways().isEmpty() )
+                {
+                    gatewayConfig.setDefault( true );
+                }
+
                 if ( index >= 0 )
                 {
                     config.getGateways().set( index, gatewayConfig );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateSMPPGateWayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateSMPPGateWayConfigAction.java	2012-08-30 12:47:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateSMPPGateWayConfigAction.java	2013-01-22 08:31:21 +0000
@@ -126,7 +126,13 @@
                 gatewayConfig.setPassword( password );
                 gatewayConfig.setUsername( username );
                 gatewayConfig.setAddress( address );
-                gatewayConfig.setPort( port  );
+                gatewayConfig.setPort( port );
+
+                if ( config.getGateways() == null || config.getGateways().isEmpty() )
+                {
+                    gatewayConfig.setDefault( true );
+                }
+
                 if ( index >= 0 )
                 {
                     config.getGateways().set( index, gatewayConfig );

=== 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-12-14 13:46:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml	2013-01-22 08:31:21 +0000
@@ -5,33 +5,38 @@
 
 	<bean id="org.hisp.dhis.mobile.caseentry.state.SelectedStateManager"
 		class="org.hisp.dhis.mobile.caseentry.state.DefaultSelectedStateManager">
-		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="patientService"
+			ref="org.hisp.dhis.patient.PatientService" />
 		<property name="selectionManager"
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="programInstanceService"
+			ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.NoAction" class="org.hisp.dhis.mobile.action.NoAction"
-		scope="prototype" />
+	<bean id="org.hisp.dhis.mobile.action.NoAction"
+		class="org.hisp.dhis.mobile.action.NoAction" scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.ShowSendSMSFormAction"
-		class="org.hisp.dhis.mobile.action.ShowSendSMSFormAction" scope="prototype" />
+		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">
+		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"
+	<bean
+		id="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
 		class="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
 		scope="prototype">
 		<property name="incomingSmsService"
 			ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
 	</bean>
-	
+
 	<bean id="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
 		class="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
 		scope="prototype">
@@ -39,33 +44,41 @@
 			ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
+	<bean
+		id="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
 		class="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
 		scope="prototype">
 		<property name="incomingSmsService"
 			ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.ShowSendSMSBeneficiaryFormAction"
+	<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"
+		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 name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService"/>
+		<property name="outboundSmsService"
+			ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
 	<!-- Patient Mobile Settings -->
 
 	<bean id="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
-		class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction" scope="prototype">
+		class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
+		scope="prototype">
 		<property name="patientMobileSettingService"
 			ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
 		<property name="patientAttributeService"
@@ -73,7 +86,8 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
-		class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction" scope="prototype">
+		class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
+		scope="prototype">
 		<property name="patientMobileSettingService"
 			ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
 		<property name="patientAttributeService"
@@ -83,32 +97,40 @@
 	<!-- Mobile DataSet -->
 
 	<bean id="org.hisp.dhis.mobile.action.MobileDataSetListAction"
-		class="org.hisp.dhis.mobile.action.MobileDataSetListAction" scope="prototype">
-		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		class="org.hisp.dhis.mobile.action.MobileDataSetListAction"
+		scope="prototype">
+		<property name="dataSetService"
+			ref="org.hisp.dhis.dataset.DataSetService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
-		class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction" scope="prototype">
-		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
+		scope="prototype">
+		<property name="dataSetService"
+			ref="org.hisp.dhis.dataset.DataSetService" />
 	</bean>
 
 	<!-- SMS Service Configuration -->
 
 	<bean id="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
-		class="org.hisp.dhis.mobile.action.GetSmsConfigurationAction" scope="prototype" />
+		class="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
+		scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction"
-		class="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction" scope="prototype" />
+		class="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction"
+		scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.UpdateBulkGateWayConfigAction"
 		class="org.hisp.dhis.mobile.action.UpdateBulkGateWayConfigAction"
 		scope="prototype" />
 
-	<bean id="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
+	<bean
+		id="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
 		class="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
 		scope="prototype" />
 
-	<bean id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
+	<bean
+		id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
 		class="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
 		scope="prototype" />
 
@@ -117,17 +139,25 @@
 		class="org.hisp.dhis.mobile.action.UpdateGenericHTTPGateWayConfigAction"
 		scope="prototype" />
 
+	<bean
+		id="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
+		class="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
+		scope="prototype" />
+
 	<bean id="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
-		class="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction" scope="prototype" />
+		class="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
+		scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.ReloadStartStopServiceAction"
 		class="org.hisp.dhis.mobile.action.ReloadStartStopServiceAction"
 		scope="prototype" />
 
 	<bean id="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction"
-		class="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction" scope="prototype">
+		class="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction"
+		scope="prototype">
 		<property name="smsCommandService" ref="smsCommandService" />
-		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="dataSetService"
+			ref="org.hisp.dhis.dataset.DataSetService" />
 
 	</bean>
 
@@ -135,26 +165,32 @@
 		class="org.hisp.dhis.mobile.action.smscommand.EditSMSCommandForm"
 		scope="prototype">
 		<property name="smsCommandService" ref="smsCommandService" />
-		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="dataSetService"
+			ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="dataElementService"
+			ref="org.hisp.dhis.dataelement.DataElementService" />
 
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.smscommand.CreateSMSCommandForm"
+	<bean
+		id="org.hisp.dhis.mobile.action.smscommand.CreateSMSCommandForm"
 		class="org.hisp.dhis.mobile.action.smscommand.CreateSMSCommandForm"
 		scope="prototype">
 		<property name="smsCommandService" ref="smsCommandService" />
-		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="dataSetService"
+			ref="org.hisp.dhis.dataset.DataSetService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.mobile.action.smscommand.DeleteSMSCommandAction"
+	<bean
+		id="org.hisp.dhis.mobile.action.smscommand.DeleteSMSCommandAction"
 		class="org.hisp.dhis.mobile.action.smscommand.DeleteSMSCommandAction"
 		scope="prototype">
 		<property name="smsCommandService" ref="smsCommandService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.J2meClientUpdateAction"
-		class="org.hisp.dhis.mobile.action.J2meClientUpdateAction" scope="prototype">
+		class="org.hisp.dhis.mobile.action.J2meClientUpdateAction"
+		scope="prototype">
 		<property name="patientMobileSettingService"
 			ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
 	</bean>

=== 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-10-22 08:51:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties	2013-01-22 08:31:21 +0000
@@ -137,10 +137,11 @@
 auto_update_client=Automatic update for J2ME clients
 client_older_than=Update to clients older than version
 smpp_gw=SMPP gateway
+processing=Processing
 
-####
-## SMS COMMAND LOCALIZATION 
-####
+# ------------------------------------------------------------------------------
+# SMS COMMAND LOCALIZATION 
+# ------------------------------------------------------------------------------
 edit_command=Edit SMS command
 data_element_category_combination=Data Element Category Combination
 sms_command_validation_alert=Fix validation problems before you save
@@ -151,5 +152,4 @@
 selected_dataset=Selected dataset
 code_value_separator=Code and value Separator
 no_codes_message=Reply message if no codes are sent (only the command):
-validation_error_space=*White space not allowed
-
+validation_error_space=*White space not allowed
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module_vi_VN.properties	2012-08-09 07:50:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module_vi_VN.properties	2013-01-22 08:31:21 +0000
@@ -71,5 +71,22 @@
 search=T\u00ecm ki\u1ebfm
 search_by_selected_unit=T\u00ecm theo \u0111\u01a1n v\u1ecb
 please_select=H\u00e3y ch\u1ecdn
-activity_grouping_attribute=Activity Grouping Attribute
-sms_configuration_not_initialized=D\u1ecbch v\u1ee5 tin nh\u1eafn ch\u01b0a \u0111\u01b0\u1ee3c kh\u1edfi t\u1ea1o.\nH\u00e3y cung c\u1ea5p hai th\u00f4ng s\u1ed1 b\u00ean d\u01b0\u1edbi v\u00e0o l\u01b0u l\u1ea1i.
\ No newline at end of file
+activity_grouping_attribute=Thu\u1ed9c t\u00ednh nh\u00f3m c\u00e1c ho\u1ea1t \u0111\u1ed9ng
+sms_configuration_not_initialized=D\u1ecbch v\u1ee5 tin nh\u1eafn ch\u01b0a \u0111\u01b0\u1ee3c kh\u1edfi t\u1ea1o.\nH\u00e3y cung c\u1ea5p hai th\u00f4ng s\u1ed1 b\u00ean d\u01b0\u1edbi v\u00e0o l\u01b0u l\u1ea1i.
+processing=\u0110ang x\u1eed l\u00fd
+
+# ------------------------------------------------------------------------------
+# SMS COMMAND LOCALIZATION 
+# ------------------------------------------------------------------------------
+
+edit_command=Ch\u1ec9nh s\u1eeda c\u00e2u l\u1ec7nh SMS
+data_element_category_combination=T\u1ed5 h\u1ee3p lo\u1ea1i ph\u1ea7n t\u1eed d\u1eef li\u1ec7u
+sms_command_validation_alert=Kh\u00f4ng th\u1ec3 l\u01b0u do l\u1ed7i th\u1ef1c thi ki\u1ec3m tra d\u1eef li\u1ec7u. 
+command_management=Qu\u1ea3n l\u00fd c\u00e2u l\u1ec7nh
+code=M\u00e3
+name=T\u00ean 
+dataset=T\u1eadp d\u1eef li\u1ec7u
+selected_dataset=T\u1eadp d\u1eef li\u1ec7u \u0111\u00e3 ch\u1ecdn
+code_value_separator=K\u00fd t\u1ef1 ng\u0103n c\u00e1ch gi\u1eefa M\u00e3 v\u00e0 Gi\u00e1 tr\u1ecb
+no_codes_message=G\u1eedi ph\u1ea3n h\u1ed3i n\u1ebfu m\u00e3 ch\u01b0a \u0111\u01b0\u1ee3c g\u1eedi:
+validation_error_space=*Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p c\u00f3 kho\u1ea3ng tr\u1eafng
\ 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-10-31 13:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml	2013-01-22 08:31:21 +0000
@@ -174,6 +174,12 @@
       <param name="requiredAuthorities">F_MOBILE_SETTINGS</param>
     </action>
 	
+    <action name="updateDefaultGateway" class="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction">
+      <result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+      <param name="onExceptionReturn">plainTextError</param>
+      <param name="requiredAuthorities">F_MOBILE_SETTINGS</param>
+    </action>
+	
     <action name="removeGatewayConfig" class="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction">
       <result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
       <param name="onExceptionReturn">plainTextError</param>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-off.png'
Binary files dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-off.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-off.png	2013-01-22 08:31:21 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-on.png'
Binary files dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-on.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/wifi-on.png	2013-01-22 08:31:21 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js	2013-01-21 04:36:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js	2013-01-22 08:31:21 +0000
@@ -40,7 +40,6 @@
 
 function sendSMSMessage( _form )
 {
-	var params = "?";
 	var p = {};
 	p.recipients = [];
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm	2012-08-09 07:50:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm	2013-01-22 08:31:21 +0000
@@ -32,10 +32,8 @@
 <form id="sendSMSForm" name="sendSMSForm" action="sendSMS.action">
 	<input type="hidden" id="isShowPatientList" name="isShowPatientList" />
 	<table id="detailsList">
-	    <col width="300px"/>
-		<col width="80px"/>
 		<tbody>
-			<tr>
+			<!--tr>
 				<th colspan="2">$i18n.getString( "gateway_type" )</th>
 			</tr>
 			<tr>
@@ -48,11 +46,10 @@
 						#end
 					</select>
 				</td>
-			</tr>
+			</tr-->
 			
 			<tr>
-				<td>$i18n.getString( "send_sms_to_target" )</td>
-				<td>
+				<td>$i18n.getString( "send_sms_to_target" ): 
 					<select id="sendTarget" name="sendTarget" onchange="javascript:toggleBasicSMSGUI();">
 						<option value="phone">$i18n.getString( "raw_phone_number" )</option>
 						<option value="user">$i18n.getString( "assigned_user_number" )</option>

=== 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-10-02 08:08:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm	2013-01-22 08:31:21 +0000
@@ -26,10 +26,8 @@
 #if ( $!gatewayMap && $!gatewayMap.size() > 0 )
 <form id="sendSMSForm" name="sendSMSForm" action="sendSMS.action">
 	<table id="detailsList">
-	    <col width="300px"/>
-		<col width="80px"/>
 		<tbody>
-			<tr>
+			<!--tr>
 				<th colspan="2">$i18n.getString( "gateway_type" )</th>
 			</tr>
 			<tr>
@@ -42,12 +40,11 @@
 						#end
 					</select>
 				</td>
-			</tr>
+			</tr-->
 			
 			<tr>
-				<td width="328">$i18n.getString( "send_sms_to_target" )</td>
-				<td width="100">
-					<select id="sendTarget" name="sendTarget" onchange="javascript:toggleSMSGUI( this.value );" style="width: 100%;">
+				<td>$i18n.getString( "send_sms_to_target" ):
+					<select id="sendTarget" name="sendTarget" onchange="javascript:toggleSMSGUI( this.value );">
 						<option value="phone">$i18n.getString( "raw_phone_number" )</option>
 						<option value="user">$i18n.getString( "assigned_user_number" )</option>
 						<option value="unit">$i18n.getString( "stakeholder_number" )</option>
@@ -56,25 +53,24 @@
 				</td>
 			</tr>
 			<tr>
-				<td colspan="2">$i18n.getString( "phone_number" ): <input type="text" id="recipient" name="recipient" style="width:537px" /></td>
+				<td>$i18n.getString( "phone_number" ): <input type="text" id="recipient" name="recipient" style="width:53%"/></td>
 			</tr>
 			
-			<tr><th colspan="2">$i18n.getString( "message" )</th></tr>
-			<tr><td colspan="2"><textarea id="smsMessage" name="smsMessage" cols="95" rows="5" class="{validate:{required:true}}"></textarea></td></tr>
+			<tr><th>$i18n.getString( "message" )</th></tr>
+			<tr><td><textarea id="smsMessage" name="smsMessage" cols="86" rows="5" class="{validate:{required:true}}"></textarea></td></tr>
 		</tbody>
 	</table>
 
 	<table id="detailsList">
 		<col width="300px"/>
-		<col width="80px"/>
 		<tbody id="orgunitType" style="display:none">
 			<tr><td>#organisationUnitSelectionTree( true, true, false )</td></tr>
 		</tbody>
 		
 		<tbody>
 			<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>				
+				<td><input type="submit" name="send" value="$i18n.getString( 'send_sms' )"/>
+				<input type="button" name="viewSentSms" value="View Sent Sms" onclick="window.location='showSentPage.action'"/></td>				
 			</tr>
 		</tbody>
 	</table>

=== 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-09-05 16:25:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm	2013-01-22 08:31:21 +0000
@@ -91,6 +91,7 @@
 	var i18n_start_sms_service = '$encoder.jsEscape( $i18n.getString( "start_sms_service" ) , "'")';
 	var i18n_sms_service_started = '$encoder.jsEscape( $i18n.getString( "service_started" ) , "'")';
 	var i18n_sms_service_stopped = '$encoder.jsEscape( $i18n.getString( "service_stopped" ) , "'")';
+	var i18n_update_default_gateway_waiting = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
 	var actionType = "start";
 	
 </script>
@@ -136,7 +137,7 @@
 					<thead>
 						<tr>
 							<th>$i18n.getString("gateways")</th>
-							<th style="text-align:center; width: 50px;">$i18n.getString( "operation" )</th>
+							<th style="text-align:center; width: 140px;">$i18n.getString( "operation" )</th>
 						</tr>
 					</thead>
 					
@@ -147,6 +148,8 @@
 							#set( $gw = $!gatewayConfigMap.get( $key ) )
 							<td>$!encoder.htmlEncode( $gw.name )</td>
 							<td style="text-align:right">
+							  <a id="default$key" href="javascript:updateDefaultGateway( $key );" title="$i18n.getString( 'mark_as_default' )">
+							  <img #if( $gw.isDefault() ) src="images/wifi-on.png" #else src="images/wifi-off.png" #end alt="$i18n.getString( 'mark_as_default' )"/></a>
 							  <a id="edit$key" href="showUpdateGateWayConfigForm.action?index=$key" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>		
 							  <a id="remove$key" href="javascript:removeGateway($key,'$!encoder.jsEncode( $gw.name )')" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
 							</td>
@@ -199,4 +202,28 @@
 	{
 		removeItem( key, name, i18n_confirm_delete, "removeGatewayConfig.action");
 	}
+	
+	function updateDefaultGateway( key )
+	{
+		setHeaderWaitMessage( i18n_update_default_gateway_waiting );
+	
+		jQuery.get( 'updateDefaultGateway.action', { index: key }, function( json ) {
+			if ( json.response == "success" )
+			{
+				var list = jQuery( "table.listTable tbody a[id^='default']" );
+		
+				list.each( function( i, item ) {
+				
+					if ( item.id == ('default' + key) )
+					{
+						jQuery('img', this).attr( 'src', 'images/wifi-on.png' );
+					} else {
+						jQuery('img', this).attr( 'src', 'images/wifi-off.png' );
+					}
+				} );
+				
+				hideHeaderMessage();
+			}
+		} );
+	}
 </script>
\ No newline at end of file