dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14799
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5124: implement SMS Config UI (WIP)
------------------------------------------------------------
revno: 5124
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Tue 2011-11-08 15:30:03 +0700
message:
implement SMS Config UI (WIP)
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowMobileConfigurationFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm
modified:
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/menu.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.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
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowMobileConfigurationFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowMobileConfigurationFormAction.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/ShowMobileConfigurationFormAction.java 2011-11-08 08:30:03 +0000
@@ -0,0 +1,74 @@
+package org.hisp.dhis.mobile.action;
+
+/*
+ * Copyright (c) 2004-2010, 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.api.sms.SmsConfig;
+import org.hisp.dhis.api.sms.SmsService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowMobileConfigurationFormAction implements Action {
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired(required = false)
+ private SmsService smsService;
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private SmsConfig smsConfig;
+
+ @Override
+ public String execute() throws Exception {
+ if (this.smsService != null) {
+ this.smsConfig = this.smsService.getConfig();
+ }
+ return SUCCESS;
+ }
+
+ public boolean getSmsServiceStatus() {
+ return this.smsService != null;
+ }
+
+ public void setSmsService(SmsService smsService) {
+ this.smsService = smsService;
+ }
+
+ public SmsConfig getSmsConfig() {
+ return smsConfig;
+ }
+
+ public void setSmsConfig(SmsConfig smsConfig) {
+ this.smsConfig = smsConfig;
+ }
+}
=== 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 2011-11-04 11:27:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2011-11-08 08:30:03 +0000
@@ -8,7 +8,7 @@
<bean id="org.hisp.dhis.mobile.action.SendSMSAction" class="org.hisp.dhis.mobile.action.SendSMSAction" scope="prototype" />
- <!-- Patient Mobile Settings -->
+ <!-- Patient Mobile Settings -->
<bean id="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction" class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
scope="prototype">
@@ -22,7 +22,7 @@
<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
</bean>
- <!-- Mobile DataSet -->
+ <!-- Mobile DataSet -->
<bean id="org.hisp.dhis.mobile.action.MobileDataSetListAction" class="org.hisp.dhis.mobile.action.MobileDataSetListAction"
scope="prototype">
<property name="dataSetService">
@@ -37,6 +37,9 @@
</property>
</bean>
+ <!-- SMS Service Configuration -->
+ <bean id="org.hisp.dhis.mobile.action.ShowMobileConfigurationFormAction" class="org.hisp.dhis.mobile.action.ShowMobileConfigurationFormAction"
+ scope="prototype"/>
<!-- JAX-RS resources -->
=== 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 2011-11-01 06:09:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2011-11-08 08:30:03 +0000
@@ -13,4 +13,19 @@
mobile_dataset = Dataset for Mobile
available_for_mobile_reporting = Available for Mobile Reporting
available_datasets = Available DataSets
-mobile_configuration = Mobile Configuration
\ No newline at end of file
+mobile_configuration = Mobile Configuration
+
+sms_service_configuration = SMS Service Configuration
+service_status = Service Status
+sms_service_is_runnning = SMS Service is running
+sms_service_is_stopped = SMS Service is stopped
+reload_configuration = Reload Configuration
+stop_sms_service = Stop SMS Service
+configuration = Configuration
+polling_interval_in_seconds = Polling interval in seconds
+server_phone_number = Server Phone Number
+gateways = Gateways
+operation = Operation
+gateway_type = Gateway Type
+
+send_sms = Send SMS
\ 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 2011-10-31 11:38:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2011-11-08 08:30:03 +0000
@@ -53,7 +53,14 @@
<action name="updateMobileDataset" class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction">
<result name="success" type="redirect">showMobileDataSet.action</result>
</action>
-
-
+
+ <!-- SMS Service Configuration Action -->
+
+ <action name="showSMSServiceConfiguration" class="org.hisp.dhis.mobile.action.ShowMobileConfigurationFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-mobile/smsServiceConfiguration.vm</param>
+ <param name="menu">/dhis-web-maintenance-mobile/menu.vm</param>
+ </action>
+
</package>
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm 2011-11-04 11:27:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm 2011-11-08 08:30:03 +0000
@@ -3,5 +3,6 @@
<!-- <li><a href = "mobileSettings.action">Settings</a></li>-->
<li><a href="patientMobileSetting.action">$i18n.getString( "patient_mobile_setting" )</a></li>
<li><a href="showMobileDataSet.action">$i18n.getString( "mobile_dataset" ) </a></li>
- <li><a href = "sendSMS.action">Send SMS</a></li>
+ <li><a href = "sendSMS.action">$i18n.getString( "send_sms" )</a></li>
+ <li><a href = "showSMSServiceConfiguration.action">$i18n.getString( "sms_service_configuration" )</a></li>
</ul>
\ 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/sendSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2011-11-04 11:27:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2011-11-08 08:30:03 +0000
@@ -8,7 +8,7 @@
}
</style>
-<h1>Send SMS</h1>
+<h3>Send SMS</h3>
#if ($smsServiceStatus)
<div>
<form method="post">
=== added 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 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/smsServiceConfiguration.vm 2011-11-08 08:30:03 +0000
@@ -0,0 +1,87 @@
+<style>
+ .overlaps {
+ background-color: #BAFFBC;
+ border: 1px solid #12CD17;
+ display: none;
+ margin: 1em;
+ padding: 1em;
+ width: 500px;
+}
+</style>
+
+<h3>$i18n.getString("sms_service_configuration")</h3>
+#if($smsServiceStatus)
+<form id="add" name="addGateWayConfig" action="addGateWayConfig.action" method="post" >
+ <table id="detailsList">
+ <col/> ## Labels
+ <col/> ## Input
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString("service_status")</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="2">
+ <div class="overlaps" id="noOverlapsDiv" style="display: block;">
+ #if($smsService.isRunning())
+ $i18n.getString("sms_service_is_runnning")
+ #else
+ $i18n.getString("sms_service_is_stopped")
+ #end
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right"><input type="button" value="$i18n.getString('reload_configuration')"/><input type="button" value="$i18n.getString('stop_sms_service')"/></td>
+ </tr>
+ <tr><td> </td><td> </td></tr>
+ </tbody>
+
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString("configuration")</th>
+ </tr>
+
+ <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>
+ </tr>
+ <tr>
+ <td>$i18n.getString("server_phone_number"):</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')"/></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table id="listTable" class="listTable">
+ <thead>
+ <tr>
+ <th>$i18n.getString("gateways")</th>
+ <th style="text-align:center; width: 50px;">$i18n.getString("operation")</th>
+ </tr>
+ </thead>
+ <tbody>
+ #set( $gateWays = $smsConfig.gateways )
+ #foreach ($gateWay in $gateWays)
+ <tr>
+ <td>$gateWay.name</td>
+ <td style="text-align:right">
+ <a title="Edit" href="editGateWayConfig.action?gateWayID="><img alt="Edit" src="../images/edit.png"></a>
+ <a title="Remove" href="#"><img alt="Remove" src="../images/delete.png"></a>
+ </td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</form>
+#else
+ <p>SMS Service is not available</p>
+#end