← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7884: Combine Send SMS form and SMS management form in patient module.

 

------------------------------------------------------------
revno: 7884
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-08-09 17:47:22 +0700
message:
  Combine Send SMS form and SMS management form in patient module.
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetGetwayListAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/new_sms.gif
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms_list.gif
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSMSForm.vm
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms.gif
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetOutboundSmsListAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsPatientRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderSelect.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
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetGetwayListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetGetwayListAction.java	2012-08-09 08:57:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetGetwayListAction.java	1970-01-01 00:00:00 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2004-2009, 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.
- */
-
-package org.hisp.dhis.caseentry.action.reminder;
-
-import java.util.Map;
-
-import org.hisp.dhis.sms.outbound.OutboundSmsTransportService;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version GetGetwayListAction.java 1:50:25 PM Aug 9, 2012 $
- */
-public class GetGetwayListAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    @Autowired
-    private OutboundSmsTransportService transportService;
-
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    public Map<String, String> gatewayMap;
-
-    public Map<String, String> getGatewayMap()
-    {
-        return gatewayMap;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        gatewayMap = transportService.getGatewayMap();
-
-        return SUCCESS;
-    }
-
-}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetOutboundSmsListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetOutboundSmsListAction.java	2012-08-09 08:57:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetOutboundSmsListAction.java	2012-08-09 10:47:22 +0000
@@ -29,10 +29,13 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.sms.outbound.OutboundSms;
+import org.hisp.dhis.sms.outbound.OutboundSmsTransportService;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
@@ -50,16 +53,21 @@
 
     private ProgramStageInstanceService programStageInstanceService;
 
+    @Autowired
+    private OutboundSmsTransportService transportService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
 
     private Integer programStageInstanceId;
-    
+
     private ProgramStageInstance programStageInstance;
-    
+
     private List<OutboundSms> outboundSms;
 
+    public Map<String, String> gatewayMap;
+
     // -------------------------------------------------------------------------
     // Getter/Setter
     // -------------------------------------------------------------------------
@@ -84,6 +92,11 @@
         return outboundSms;
     }
 
+    public Map<String, String> getGatewayMap()
+    {
+        return gatewayMap;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -92,11 +105,12 @@
     public String execute()
         throws Exception
     {
-        programStageInstance = programStageInstanceService
-            .getProgramStageInstance( programStageInstanceId );
-        
+        programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
+
         outboundSms = new ArrayList<OutboundSms>( programStageInstance.getOutboundSms() );
-
+        
+        gatewayMap = transportService.getGatewayMap();
+        
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-08-09 09:50:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-08-09 10:47:22 +0000
@@ -978,9 +978,6 @@
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 	
-	<bean id="org.hisp.dhis.caseentry.action.reminder.GetGetwayListAction"
-		class="org.hisp.dhis.caseentry.action.reminder.GetGetwayListAction" scope="prototype" />
-	
 	<bean id="org.hisp.dhis.caseentry.action.reminder.SendSmsAction"
 		class="org.hisp.dhis.caseentry.action.reminder.SendSmsAction"
 		scope="prototype">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-08-09 09:50:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-08-09 10:47:22 +0000
@@ -814,19 +814,6 @@
 			<param name="stylesheets">style/style.css</param>
 		</action>
 		
-		<action name="getOutboundSmsList"
-			class="org.hisp.dhis.caseentry.action.reminder.GetOutboundSmsListAction">
-			<result name="success" type="velocity">/content.vm</result>
-			<param name="page">/dhis-web-caseentry/smsReminderList.vm</param>
-			<param name="stylesheets">style/style.css</param>
-		</action>
-		
-		<action name="showSendSMSForm" class="org.hisp.dhis.caseentry.action.reminder.GetGetwayListAction">
-	     <result name="success" type="velocity">/content.vm</result>
-			<param name="page">/dhis-web-caseentry/sendSMSForm.vm</param>
-			<param name="stylesheets">style/style.css</param>
-	    </action>
-	    
 	    <action name="sendSMS" class="org.hisp.dhis.caseentry.action.reminder.SendSmsAction">
 	      <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 	      <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/new_sms.gif'
Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/new_sms.gif	2012-08-09 08:57:01 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/new_sms.gif	1970-01-01 00:00:00 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms.gif'
Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms.gif	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms.gif	2012-08-09 10:47:22 +0000 differ
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms_list.gif'
Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms_list.gif	2012-08-09 08:57:01 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/sms_list.gif	1970-01-01 00:00:00 +0000 differ
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSMSForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSMSForm.vm	2012-08-09 08:57:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sendSMSForm.vm	1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-<script type="text/javascript">
-	jQuery(document).ready(	function(){
-		validation( 'sendSMSForm', function(form){
-			sendSMS();
-		});
-	});
-</script>
-
-#if ( $!gatewayMap && $!gatewayMap.size() > 0 )
-<form id="sendSMSForm" name="sendSMSForm" action="sendSMS.action">
-	<table id="detailsList">
-	    <col width="300px"/>
-		<col width="80px"/>
-		<tbody>
-			<tr>
-				<th>$i18n.getString( "gateway_type" )</th>
-			</tr>
-			<tr>
-				<td>
-					#set( $keys = $!gatewayMap.keySet() )
-					<select id="gatewayId" name="gatewayId">
-						#foreach( $key in $!keys )
-						<option value="$gatewayMap.get( $key )">$i18n.getString( $key )</option>
-						#end
-					</select>
-				</td>
-			</tr>
-			
-			<tr><th>$i18n.getString( "message" )</th></tr>
-			<tr><td><textarea id="smsMessage" name="smsMessage" class="{validate:{required:true}}"></textarea></td></tr>
-		
-			<tr>
-				<td><input type="submit" name="send" value="$i18n.getString( 'send_sms' )"/></td>
-			</tr>
-			
-		</tbody>
-	</table>
-</form>
-	<div class='hidden'>
-		<input type='hidden' id='currentDate'>
-		<script>
-			datePickerValid( 'currentDate', true );
-		</script>
-	</div>
-</div>
-#else
-<p>No Sms service available</p>
-#end
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsPatientRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsPatientRecords.vm	2012-08-09 09:11:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsPatientRecords.vm	2012-08-09 10:47:22 +0000
@@ -49,9 +49,8 @@
 									</tr>
 									<tr>
 										<td>
-											(<span id='noMessageDiv_$programStageInstance.id'>$programStageInstance.outboundSms.size()</span> $i18n.getString('messages') )<br/>
-											<img src='images/sms_list.gif' style="width:32px" title="$i18n.getString('send_message')" onclick='setFieldValue( "programStageInstanceId", "$!programStageInstance.id" );showSendSMSForm();'/>
-											<img src='images/new_sms.gif' style="width:32px" title="$i18n.getString('sms_message_management')" onclick='javascript:getOutboundSmsList( $programStageInstance.id );' />
+											<img src='images/sms.gif' style="width:24px" />
+											<span id='noMessageDiv_$programStageInstance.id'>$programStageInstance.outboundSms.size()</span> $i18n.getString('messages')
 										</td>
 									</tr>
 								</table>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderList.vm	2012-08-09 08:57:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderList.vm	2012-08-09 10:47:22 +0000
@@ -1,3 +1,12 @@
+<script type="text/javascript">
+	jQuery(document).ready(	function(){
+		$('#tabs').tabs();
+		validation( 'sendSMSForm', function(form){
+			sendSMS();
+		});
+	});
+</script>
+
 <h4>$i18n.getString( "sms_message_management" )</h4>
 
 <table class="mainPageTable"> 
@@ -15,32 +24,77 @@
 	</tr>
 </table>
 
-<table class="mainPageTable">
-	<tr>
-		<td colspan='3' align='right'><input type='button' value="$i18n.getString('send_sms')" onclick='showSendSMSForm();'></td>
-	</tr>
-	<tr>
-		<th>$i18n.getString( "date" )</th>
-		<th>$i18n.getString( "message" )</th>
-	</tr>
-		  
-    <tbody id='smsManagementList'>	
-		  #set( $mark = false )
-          #foreach( $sms in $outboundSms )
-          	<tr id="tr${sms.id}" #alternate($mark) >
-				<td>$format.formatDate($!sms.date)</td>
-				<td>$sms.message</td>
-			</tr>
-			#set( $mark = !$mark)
-    	#end
-    	</tbody>
-    
-	 </table>
-    </td>
-  </tr>
-</table>
-
-<div id="detailsInfo"></div>
+<div id="tabs">
+	<ul>
+		<li><a href="#tab-1">$i18n.getString("data_entry_screen")</a></li>
+		<li><a href="#tab-2">$i18n.getString("identifier_and_attribute")</a></li>
+	</ul>
+	
+	<div id="tab-1">
+		<table class="mainPageTable">
+			<tr>
+				<td colspan='3' align='right'><input type='button' value="$i18n.getString('send_sms')" onclick='showSendSMSForm();'></td>
+			</tr>
+			<tr>
+				<th>$i18n.getString( "date" )</th>
+				<th>$i18n.getString( "message" )</th>
+			</tr>
+			<tbody id='smsManagementList'>	
+				  #set( $mark = false )
+				  #foreach( $sms in $outboundSms )
+					<tr id="tr${sms.id}" #alternate($mark) >
+						<td>$format.formatDate($!sms.date)</td>
+						<td>$sms.message</td>
+					</tr>
+					#set( $mark = !$mark)
+				#end
+			</tbody>
+		</table>
+	</div>
+	
+	<div id="tab-2">
+		#if ( $!gatewayMap && $!gatewayMap.size() > 0 )
+		<form id="sendSMSForm" name="sendSMSForm" action="sendSMS.action">
+			<table id="detailsList">
+				<col width="300px"/>
+				<col width="80px"/>
+				<tbody>
+					<tr>
+						<th>$i18n.getString( "gateway_type" )</th>
+					</tr>
+					<tr>
+						<td>
+							#set( $keys = $!gatewayMap.keySet() )
+							<select id="gatewayId" name="gatewayId">
+								#foreach( $key in $!keys )
+								<option value="$gatewayMap.get( $key )">$i18n.getString( $key )</option>
+								#end
+							</select>
+						</td>
+					</tr>
+					
+					<tr><th>$i18n.getString( "message" )</th></tr>
+					<tr><td><textarea id="smsMessage" name="smsMessage" class="{validate:{required:true}}"></textarea></td></tr>
+				
+					<tr>
+						<td><input type="submit" name="send" value="$i18n.getString( 'send_sms' )"/></td>
+					</tr>
+					
+				</tbody>
+			</table>
+		</form>
+		<div class='hidden'>
+			<input type='hidden' id='currentDate'>
+			<script>
+				datePickerValid( 'currentDate', true );
+			</script>
+		</div>
+	</div>
+	#else
+	<p>No Sms service available</p>
+	#end
+	</div>
+</div>
 
 <script type="text/javascript">
 	var i18n_color_quick_help = '$encoder.jsEscape( $i18n.getString( "color_quick_help" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderSelect.vm	2012-08-09 10:13:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsReminderSelect.vm	2012-08-09 10:47:22 +0000
@@ -19,7 +19,7 @@
 <form>
 	<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
 	<input type='hidden' id='listAll' name='listAll'>
-	<input type='hidden' id='programStageInstanceId' name='programStageInstanceId'>
+	<input type='hidden' id='programStageInstanceId' name='programStageInstanceId' value='$programStageInstance.id'>
 	<div id='searchDiv'>
 		#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )	
 	</div>