← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7894: improve SMS config interface

 

------------------------------------------------------------
revno: 7894
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-08-10 17:02:21 +0700
message:
  improve SMS config interface
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SaveSmsConfigurationAction.java
  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/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-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java	2012-08-10 06:29:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java	2012-08-10 10:02:21 +0000
@@ -75,11 +75,6 @@
     {
         Device device = deviceResolver.resolveDevice( ServletActionContext.getRequest() );
         
-        System.out.println(ServletActionContext.getRequest().getHeader( "User-Agent" ));
-        System.out.println(ServletActionContext.getRequest().getHeader("x-wap-profile"));
-        System.out.println(ServletActionContext.getRequest().getHeader("Profile"));
-        System.out.println(ServletActionContext.getRequest().getHeader("Accept"));
-        
         if ( device.isMobile() )
         {
             return "mobile";

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.java	2012-08-10 04:12:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/GetSmsConfigurationAction.java	2012-08-10 10:02:21 +0000
@@ -55,14 +55,14 @@
 
     @Autowired
     private SmsConfigurationManager smsConfigurationManager;
-    
+
     @Autowired
     private OutboundSmsTransportService smsLibService;
 
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
-    
+
     private String index;
 
     public String getIndex()
@@ -90,20 +90,19 @@
     }
 
     private String smsServiceStatus;
-    
+
     public String getSmsServiceStatus()
     {
         return this.smsServiceStatus;
     }
-    
+
     public Integer bulkIndex;
 
-
     public Integer getBulkIndex()
     {
         return bulkIndex;
     }
-    
+
     public Integer clickatellIndex;
 
     public Integer getClickatellIndex()
@@ -112,18 +111,19 @@
     }
 
     public Integer modemIndex;
-    
+
     public Integer getModemIndex()
     {
         return modemIndex;
     }
 
     public Integer httpIndex;
-    
+
     public Integer getHttpIndex()
     {
         return httpIndex;
     }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -131,9 +131,9 @@
     public String execute()
         throws Exception
     {
-        
+
         smsServiceStatus = smsLibService.getServiceStatus();
-        
+
         smsConfig = smsConfigurationManager.getSmsConfiguration();
 
         if ( smsConfig != null )
@@ -147,11 +147,11 @@
                 gatewayConfigMap.put( index, gw );
 
                 if ( gw instanceof BulkSmsGatewayConfig )
-                {                    
+                {
                     bulkIndex = index;
                 }
                 else if ( gw instanceof ClickatellGatewayConfig )
-                {   
+                {
                     clickatellIndex = index;
                 }
                 else if ( gw instanceof ModemGatewayConfig )
@@ -159,7 +159,7 @@
                     modemIndex = index;
                 }
                 else
-                {   
+                {
                     httpIndex = index;
                 }
             }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SaveSmsConfigurationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SaveSmsConfigurationAction.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/SaveSmsConfigurationAction.java	2012-08-10 10:02:21 +0000
@@ -81,6 +81,7 @@
         }
 
         smsConfig.setPollingInterval( pollingInterval );
+
         smsConfig.setLongNumber( serverPhoneNumber );
 
         smsConfigurationManager.updateSmsConfiguration( smsConfig );

=== 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-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.properties	2012-08-10 10:02:21 +0000
@@ -50,7 +50,7 @@
 api_id=API ID
 outboundsms_saved=The gateway details have been saved, but no message was sent.
 save_settings=Save Settings
-add_update_gw=Add or update gateway
+add_gw=Add gateway
 start_sms_service=Start SMS Service
 stop_sms_service=Stop SMS Service
 show_send_sms_form=Send SMS

=== 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-08-10 06:29:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smsServiceConfiguration.vm	2012-08-10 10:02:21 +0000
@@ -35,6 +35,17 @@
 			actionType = "start";
 			jQuery( "#startStopButton" ).attr( "value", i18n_start_sms_service );
 		#end
+		
+		if ( getFieldValue( 'isSettingAvailable' ) == 'false' )
+		{
+			hideById('listTable');
+			hideById('btnAddGw');
+		}
+		else
+		{
+			showById('listTable');
+			showById('btnAddGw');
+		}
 	} );
 
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_gateway" ) , "'")';
@@ -47,9 +58,9 @@
 </script>
 
 <h3>$i18n.getString( "sms_service_configuration" )</h3>
-
+<input id="isSettingAvailable" name="isSettingAvailable" type="hidden" #if ( $!smsConfig ) value="true" #else value="false" #end/>
 <form id="saveSmsConfigurationForm" name="saveSmsConfigurationForm" action="saveSmsConfiguration.action" method="post" >
-  <table id="detailsList">
+  <table id="detailsList" border="0">
     <col/> ## Labels
     <col/> ## Input
     <thead>
@@ -93,13 +104,12 @@
 		<tr>
 			<td><label for="serverPhoneNumber">$i18n.getString( "server_phone_number" )</label></td>
 			<td><input type="text" id="serverPhoneNumber" name="serverPhoneNumber" style="width:20em" value="$!smsConfig.longNumber"/>
-			<input type="submit" value="$i18n.getString( 'save_settings' )" style="width:13em"/></td>
-		</tr>
-		<tr>
-			<td align="right" colspan="2">
-				<input type="button" value="$i18n.getString( 'add_update_gw' )" style="width:13em" #if( !$smsConfig )disabled="true"#end onclick="window.location.href='showUpdateGateWayConfigForm.action'"/>
+				<input type="submit" value="$i18n.getString( 'save_settings' )" style="width:13em"/>
 			</td>
 		</tr>
+
+		<tr><td align="right" colspan="2"><br/></td></tr>
+
 		<tr>
 			<td colspan="2">
 				<table id="listTable" class="listTable">
@@ -109,6 +119,7 @@
 							<th style="text-align:center; width: 50px;">$i18n.getString( "operation" )</th>
 						</tr>
 					</thead>
+					
 					<tbody id="list">
 					#set( $keys = $!gatewayConfigMap.keySet() )
 					#foreach ($key in $!keys )
@@ -120,11 +131,16 @@
 							  <a href="javascript:removeGateway( $key, '$!encoder.jsEncode( $gw.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
 							</td>
 						</tr>
-					#end 					
-					</tbody>
+					#end
+					</tbody>					
 				</table>
 			</td>
 		</tr>
+		<tr>
+			<td align="right" colspan="2">
+				<input type="button" id="btnAddGw" value="$i18n.getString( 'add_gw' )" style="width:13em" onclick="window.location.href='showUpdateGateWayConfigForm.action'"/>
+			</td>
+		</tr>	
 	</tbody>
 	</table>
 </form>