← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5355: Added sending messages by sms user setting, and some other small fixes

 

------------------------------------------------------------
revno: 5355
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-12-10 13:23:49 +0100
message:
  Added sending messages by sms user setting, and some other small fixes
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetEmailSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetEmailSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userEmailSettings.vm
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetMessageSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetMessageSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userMessageSettings.vm
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/SmsMessageSender.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/TestOutboundSmsService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SendSMSAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/index.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/settingsMenu.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-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2011-12-07 14:19:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2011-12-10 12:23:49 +0000
@@ -31,6 +31,8 @@
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.configuration.ConfigurationService;
 import org.hisp.dhis.dataset.CompleteDataSetRegistration;
 import org.hisp.dhis.user.CurrentUserService;
@@ -46,6 +48,8 @@
 public class DefaultMessageService
     implements MessageService
 {    
+    private static final Log log = LogFactory.getLog( DefaultMessageService.class );
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -71,12 +75,19 @@
         this.configurationService = configurationService;
     }
     
+    private List<MessageSender> messageSenders;
+
     @Autowired
-    private List<MessageSender> messageSenders;
-
     public void setMessageSenders( List<MessageSender> messageSenders )
     {
         this.messageSenders = messageSenders;
+
+        String message = "Found the following message senders: ";
+        for ( MessageSender messageSender : messageSenders )
+        {
+            message += messageSender.getClass().getSimpleName() + ", ";
+        }
+        log.info( message.substring( 0, message.length() - 2 ) );
     }
     
     // -------------------------------------------------------------------------
@@ -213,6 +224,9 @@
     {
         for ( MessageSender messageSender : messageSenders )
         {
+            if (log.isDebugEnabled())
+                log.debug( "Invoking message sender " + messageSender.getClass().getSimpleName() );
+
             messageSender.sendMessage( subject, text, sender, users );
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/SmsMessageSender.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/SmsMessageSender.java	2011-12-07 21:06:08 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/SmsMessageSender.java	2011-12-10 12:23:49 +0000
@@ -66,6 +66,8 @@
     public void setOutboundSmsService( OutboundSmsService outboundSmsService )
     {
         this.outboundSmsService = outboundSmsService;
+        
+        log.info( "Found OutboundMessageService " + outboundSmsService.getClass().getSimpleName() + ". Enabling sms message sending.");
     }
 
     
@@ -77,7 +79,7 @@
     @Override
     public void sendMessage( String subject, String text, User sender, Set<User> users )
     {
-        
+
         if ( outboundSmsService == null || !outboundSmsService.isSmsServiceAvailable() )
         {
             return;
@@ -101,20 +103,25 @@
         for ( User user : users )
         {
             boolean smsNotification = settings.get( user ) != null && (Boolean) settings.get( user );
-            System.out.println(smsNotification);
 
             String phoneNumber = user.getPhoneNumber();
             if ( smsNotification && phoneNumber != null && !phoneNumber.trim().isEmpty() )
             {
                 recipients.add( phoneNumber );
-
-                log.debug( "Adding user as sms recipient: " + user + " with phone number: " + phoneNumber );
+                
+                if (log.isDebugEnabled())
+                    log.debug( "Adding user as sms recipient: " + user + " with phone number: " + phoneNumber );
             }
         }
 
         if ( !recipients.isEmpty() )
         {
             outboundSmsService.sendMessage( text, recipients.toArray( new String[recipients.size()] ) );
+            if (log.isDebugEnabled()) {
+                log.debug( "Sent message to " + recipients + ": " + text );
+            }
+        } else if ( log.isDebugEnabled() ) {
+            log.debug( "No user to send message to" );
         }
 
     }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/TestOutboundSmsService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/TestOutboundSmsService.java	2011-12-07 21:06:08 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/TestOutboundSmsService.java	2011-12-10 12:23:49 +0000
@@ -31,7 +31,13 @@
     public void sendOtaMessage( URL url, String prompt, String... recipients )
         throws SmsServiceException
     {
-        log.info( "Send OTA message '" + prompt + "', url " + url + " to " + recipients);
+        String numbers = "";
+        
+        for ( String recipient : recipients )
+        {
+            numbers += recipient + ", ";
+        }
+        log.info( "Send OTA message '" + prompt + "', url " + url + " to " + numbers.substring( 0, numbers.length() - 2 ) );
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2011-12-08 12:49:37 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2011-12-10 12:23:49 +0000
@@ -51,6 +51,6 @@
 
   <!--  OutboundSmsService stub just logging invocations, only to be used for testing! -->
 
-  <!-- <bean id="org.hisp.dhis.mobile.service.TestOuboundSmsService" class="org.hisp.dhis.mobile.service.TestOuboundSmsService" /> -->
+  <!-- <bean id="org.hisp.dhis.mobile.service.TestOutboundSmsService" class="org.hisp.dhis.mobile.service.TestOutboundSmsService" />  -->
 
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SendSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SendSMSAction.java	2011-11-04 11:27:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SendSMSAction.java	2011-12-10 12:23:49 +0000
@@ -27,11 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.api.sms.OutboundSmsService;
 import org.hisp.dhis.api.sms.SmsServiceException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
 
 public class SendSMSAction
     implements Action

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetEmailSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetEmailSettingsAction.java	2011-10-07 11:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetEmailSettingsAction.java	1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-package org.hisp.dhis.settings.action.user;
-
-/*
- * 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 static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION;
-
-import org.hisp.dhis.user.UserSettingService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Dang Duy Hieu
- * @version $Id$
- * 
- */
-public class GetEmailSettingsAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private UserSettingService userSettingService;
-
-    public void setUserSettingService( UserSettingService userSettingService )
-    {
-        this.userSettingService = userSettingService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    private Boolean messageEmailNotification;
-
-    public Boolean getMessageEmailNotification()
-    {
-        return messageEmailNotification;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        // ---------------------------------------------------------------------
-        // Get Message-email-notification
-        // ---------------------------------------------------------------------
-
-        messageEmailNotification = (Boolean) userSettingService.getUserSetting( KEY_MESSAGE_EMAIL_NOTIFICATION, false );
-
-        return SUCCESS;
-    }
-}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetMessageSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetMessageSettingsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetMessageSettingsAction.java	2011-12-10 12:23:49 +0000
@@ -0,0 +1,91 @@
+package org.hisp.dhis.settings.action.user;
+
+/*
+ * 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 static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION;
+import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
+
+import org.hisp.dhis.user.UserSettingService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ * 
+ */
+public class GetMessageSettingsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private UserSettingService userSettingService;
+
+    public void setUserSettingService( UserSettingService userSettingService )
+    {
+        this.userSettingService = userSettingService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private Boolean messageEmailNotification;
+
+    public Boolean getMessageEmailNotification()
+    {
+        return messageEmailNotification;
+    }
+
+    private Boolean messageSmsNotification;
+
+    public Boolean getMessageSmsNotification()
+    {
+        return messageSmsNotification;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        // ---------------------------------------------------------------------
+        // Get Message-email-notification
+        // ---------------------------------------------------------------------
+
+        messageEmailNotification = (Boolean) userSettingService.getUserSetting( KEY_MESSAGE_EMAIL_NOTIFICATION, false );
+
+        messageSmsNotification = (Boolean) userSettingService.getUserSetting( KEY_MESSAGE_SMS_NOTIFICATION, false );
+
+        return SUCCESS;
+    }
+}

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetEmailSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetEmailSettingsAction.java	2011-10-07 11:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetEmailSettingsAction.java	1970-01-01 00:00:00 +0000
@@ -1,92 +0,0 @@
-package org.hisp.dhis.settings.action.user;
-
-/*
- * 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 static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.user.UserSettingService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Dang Duy Hieu
- */
-public class SetEmailSettingsAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private UserSettingService userSettingService;
-
-    public void setUserSettingService( UserSettingService userSettingService )
-    {
-        this.userSettingService = userSettingService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private Boolean messageEmailNotification;
-
-    public void setMessageEmailNotification( Boolean messageEmailNotification )
-    {
-        this.messageEmailNotification = messageEmailNotification;
-    }
-
-    private String message;
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    private I18n i18n;
-
-    public void setI18n( I18n i18n )
-    {
-        this.i18n = i18n;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        userSettingService.saveUserSetting( KEY_MESSAGE_EMAIL_NOTIFICATION, messageEmailNotification );
-
-        message = i18n.getString( "settings_updated" );
-
-        return SUCCESS;
-    }
-}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetMessageSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetMessageSettingsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetMessageSettingsAction.java	2011-12-10 12:23:49 +0000
@@ -0,0 +1,102 @@
+package org.hisp.dhis.settings.action.user;
+
+/*
+ * 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 static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION;
+import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.user.UserSettingService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ */
+public class SetMessageSettingsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private UserSettingService userSettingService;
+
+    public void setUserSettingService( UserSettingService userSettingService )
+    {
+        this.userSettingService = userSettingService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Boolean messageEmailNotification;
+
+    public void setMessageEmailNotification( Boolean messageEmailNotification )
+    {
+        this.messageEmailNotification = messageEmailNotification;
+    }
+
+    private Boolean messageSmsNotification;
+
+    public void setMessageSmsNotification( Boolean messageSmsNotification )
+    {
+        this.messageSmsNotification = messageSmsNotification;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        userSettingService.saveUserSetting( KEY_MESSAGE_EMAIL_NOTIFICATION, messageEmailNotification );
+
+        userSettingService.saveUserSetting( KEY_MESSAGE_SMS_NOTIFICATION, messageSmsNotification );
+
+        message = i18n.getString( "settings_updated" );
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2011-10-06 09:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2011-12-10 12:23:49 +0000
@@ -95,15 +95,15 @@
     </property>
   </bean>
   
-		<!-- Email settings -->
-  <bean id="org.hisp.dhis.settings.action.user.GetEmailSettingsAction" class="org.hisp.dhis.settings.action.user.GetEmailSettingsAction"
+  <!-- Message settings -->
+  <bean id="org.hisp.dhis.settings.action.user.GetMessageSettingsAction" class="org.hisp.dhis.settings.action.user.GetMessageSettingsAction"
     scope="prototype">
     <property name="userSettingService">
       <ref bean="org.hisp.dhis.user.UserSettingService" />
     </property>
   </bean>
 
-  <bean id="org.hisp.dhis.settings.action.user.SetEmailSettingsAction" class="org.hisp.dhis.settings.action.user.SetEmailSettingsAction"
+  <bean id="org.hisp.dhis.settings.action.user.SetMessageSettingsAction" class="org.hisp.dhis.settings.action.user.SetMessageSettingsAction"
     scope="prototype">
     <property name="userSettingService">
       <ref bean="org.hisp.dhis.user.UserSettingService" />

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2011-12-09 10:19:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2011-12-10 12:23:49 +0000
@@ -86,12 +86,12 @@
 forum_integration = Forum integration
 no_start_page = No start page
 intro_user_general_settings = Customize the system with user specific settings for locale, sort order, display property, style and more.
-intro_user_email_settings = Customize the system with user specific settings for message email notification.
+intro_user_message_settings = Customize the system with user specific settings for message email and sms notification.
 intro_system_general_settings = Customize the system behavior with regard to aggregation strategy, infrastructural data elements and more.
 intro_system_appearance_settings = Customize the system behavior with regard to application title, style, flag, start page.
 intro_system_email_settings = Configure the email SMTP setup with regard to host name, user name and password.
 user_general_settings = User General Settings
-user_email_settings = User Email Settings
+user_message_settings = User Message Notification Settings
 system_general_settings = System General Settings
 system_appearance_settings = System Appearance Settings
 system_email_settings = System Email Settings
@@ -115,6 +115,7 @@
 no_feedback_recipients = No message recipients
 settings_updated = Settings were updated
 message_email_notification = Message email notification
+message_sms_notification = Message sms notification
 completeness_email_notification = Completeness email notification
 completeness_recipients = Completeness notification recipients
 no_completeness_recipients = No completeness recipients
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2011-10-06 09:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2011-12-10 12:23:49 +0000
@@ -75,15 +75,15 @@
 	  <param name="onExceptionReturn">plainTextError</param>
     </action>
 		
-		<!-- Email settings -->
+		<!-- Message notification settings -->
 
-    <action name="userEmailSettings" class="org.hisp.dhis.settings.action.user.GetEmailSettingsAction">
+    <action name="userMessageSettings" class="org.hisp.dhis.settings.action.user.GetMessageSettingsAction">
       <result name="success" type="velocity">/main.vm</result>
-      <param name="page">/dhis-web-maintenance-settings/userEmailSettings.vm</param>
+      <param name="page">/dhis-web-maintenance-settings/userMessageSettings.vm</param>
       <param name="menu">/dhis-web-maintenance-settings/settingsMenu.vm</param>
     </action>
 
-    <action name="setUserEmailSettings" class="org.hisp.dhis.settings.action.user.SetEmailSettingsAction">
+    <action name="setUserMessageSettings" class="org.hisp.dhis.settings.action.user.SetMessageSettingsAction">
       <result name="success" type="velocity-json">
 		/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 	  <param name="onExceptionReturn">plainTextError</param>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/index.vm	2011-10-06 09:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/index.vm	2011-12-10 12:23:49 +0000
@@ -9,7 +9,7 @@
 
 <ul id="introList">
     #introListImgItem( "userGeneralSettings.action" "user_general_settings" "usersettings" )
-    #introListImgItem( "userEmailSettings.action" "user_email_settings" "usersettings" )
+    #introListImgItem( "userMessageSettings.action" "user_message_settings" "usersettings" )
     #introListImgItem( "systemGeneralSettings.action" "system_general_settings" "systemsettings" )
     #introListImgItem( "systemAppearanceSettings.action" "system_appearance_settings" "systemsettings" )
     #introListImgItem( "systemEmailSettings.action" "system_email_settings" "systemsettings" )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/settingsMenu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/settingsMenu.vm	2011-10-06 09:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/settingsMenu.vm	2011-12-10 12:23:49 +0000
@@ -1,7 +1,7 @@
 <h2>$i18n.getString( "user_settings" )&nbsp;</h2>
 <ul>
 	<li><a href="userGeneralSettings.action">$i18n.getString( "general" )&nbsp;</a></li>
-	<li><a href="userEmailSettings.action">$i18n.getString( "email" )&nbsp;</a></li>
+	<li><a href="userMessageSettings.action">$i18n.getString( "user_message_settings" )&nbsp;</a></li>
 </ul>
 
 <h2>$i18n.getString( "system_settings" )&nbsp;</h2>

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userEmailSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userEmailSettings.vm	2011-10-07 11:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userEmailSettings.vm	1970-01-01 00:00:00 +0000
@@ -1,20 +0,0 @@
-<script type="text/javascript">
-	
-	jQuery(document).ready(function() {
-		jQuery("input[type=button]").click(function() {
-			jQuery.postJSON( 'setUserEmailSettings.action', {
-				messageEmailNotification: jQuery( '#messageEmailNotification' ).is(':checked' )
-			}, function ( json ) {
-				if ( json.response == "success" )
-					setHeaderDelayMessage( json.message );
-			});
-		});
-	});
-</script>
-
-<h3>$i18n.getString("user_email_settings")</h3>
-
-<h4>$i18n.getString( "message_email_notification" )</h4>
-<input type="checkbox" id="messageEmailNotification" name="messageEmailNotification" #if( $messageEmailNotification ) checked="checked"#end/>
-
-<p><input type="button" value="$i18n.getString( 'save' )" style="width:10em"/></p>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userMessageSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userMessageSettings.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userMessageSettings.vm	2011-12-10 12:23:49 +0000
@@ -0,0 +1,26 @@
+<script type="text/javascript">
+	
+	jQuery(document).ready(function() {
+		jQuery("input[type=button]").click(function() {
+			jQuery.post( 'setUserMessageSettings.action', {
+				messageEmailNotification: jQuery( '#messageEmailNotification' ).is(':checked' ),
+				messageSmsNotification: jQuery( '#messageSmsNotification' ).is(':checked' )
+			}, function ( json ) {
+				if ( json.response == "success" )
+					setHeaderDelayMessage( json.message );
+			});
+		});
+	});
+</script>
+
+<h3>$i18n.getString("user_message_settings")</h3>
+
+<ul style="list-style-type:none">
+<li><input type="checkbox" id="messageEmailNotification" name="messageEmailNotification" #if( $messageEmailNotification ) checked="checked"#end/>
+$i18n.getString( "message_email_notification" )</li>
+
+<li><input type="checkbox" id="messageSmsNotification" name="messageSmsNotification" #if( $messageSmsNotification ) checked="checked"#end/>
+$i18n.getString( "message_sms_notification" )</li>
+</ul>
+
+<p><input type="button" value="$i18n.getString( 'save' )" style="width:10em"/></p>
\ No newline at end of file