← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11600: Fixed bug - Don't delete the new message created in lost-to-follow-up form.

 

------------------------------------------------------------
revno: 11600
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-08-07 15:46:28 +0700
message:
  Fixed bug - Don't delete the new message created in lost-to-follow-up form.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackingEventMessage.vm
modified:
  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/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java	2013-08-07 08:46:28 +0000
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2004-2013, 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 org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ GetProgramStageInstanceByIdAction.java Aug 7, 2013 3:10:01 PM $
+ */
+public class GetProgramStageInstanceByIdAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ProgramStageInstanceService programStageInstanceService;
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getter && Setter
+    // -------------------------------------------------------------------------
+
+    private Integer programStageInstanceId;
+
+    public void setProgramStageInstanceId( Integer programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
+
+    private ProgramStageInstance programStageInstance;
+
+    public ProgramStageInstance getProgramStageInstance()
+    {
+        return programStageInstance;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
+        
+        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	2013-08-07 04:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-08-07 08:46:28 +0000
@@ -1168,6 +1168,12 @@
 			ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
 	</bean>
 
+    <bean id="org.hisp.dhis.caseentry.action.reminder.GetProgramStageInstanceByIdAction"
+		class="org.hisp.dhis.caseentry.action.reminder.GetProgramStageInstanceByIdAction" scope="prototype">
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+	</bean>
+
 	<!-- Program-stage-completeness -->
 
 	<bean

=== 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	2013-08-06 06:33:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-08-07 08:46:28 +0000
@@ -1082,6 +1082,13 @@
       <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
       <param name="requiredAuthorities">F_PROGRAM_ENROLLMENT</param>
     </action>
+    
+    <action name="getProgramStageInstanceById"
+      class="org.hisp.dhis.caseentry.action.reminder.GetProgramStageInstanceByIdAction">
+      <result name="success" type="velocity">/content.vm</result>
+      <param name="page">/dhis-web-caseentry/trackingEventMessage.vm</param>
+      <param name="stylesheets">style/style.css</param>
+    </action>
 
     <!-- Dashboard -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-08-07 06:24:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-08-07 08:46:28 +0000
@@ -1843,6 +1843,7 @@
 					+ "<td>" + getFieldValue('programStageName') + "</td>"
 					+ "<td>" + getFieldValue('currentUsername') + "</td>"
 					+ "<td>" + i18n_message + "</td>"
+					+ "<td>" + field.value + "</td>"+
 					+ "<td>" + field.value + "</td></tr>");
 				field.style.backgroundColor = SUCCESS_COLOR;
 				
@@ -1906,7 +1907,6 @@
 			content += "<td>" + i18n_comment + "</td>";
 			content += "<td>" + commentText + "</td></tr>";
 			jQuery('#commentTB').prepend(content);
-			field.value="";
 			showSuccessMessage( i18n_comment_added );
 			field.style.backgroundColor = SUCCESS_COLOR;
 			

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2013-08-02 04:53:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2013-08-07 08:46:28 +0000
@@ -316,3 +316,10 @@
 		});
 }
 
+function getProgramStageInstanceById(programStageInstanceId)
+{
+	$('#tab-2').load("getProgramStageInstanceById.action", 
+	{
+		programStageInstanceId:programStageInstanceId
+	});
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2013-08-07 06:24:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2013-08-07 08:46:28 +0000
@@ -75,12 +75,12 @@
 
 <div id='tabs-tracking'>
 	<ul>
-		<li><a href="#tab-3">$i18n.getString("reschedule_and_set_status")</a></li>
-		<li><a href="#tab-1">$i18n.getString("comments_and_sms_message")</a></li>
-		<li><a href="#tab-2">$i18n.getString("program_report")</a></li>
+		<li><a href="#tab-1">$i18n.getString("reschedule_and_set_status")</a></li>
+		<li><a href="#tab-2">$i18n.getString("comments_and_sms_message")</a></li>
+		<li><a href="#tab-3">$i18n.getString("program_report")</a></li>
 	</ul>
 	
-	<div id='tab-3'>
+	<div id='tab-1'>
 		<table id='progarmStageListDiv' name='progarmStageListDiv' >
 			<tr>
 				<td>$i18n.getString( "due_date" )</td>        
@@ -183,56 +183,11 @@
 		</table>
 	</div>
 	
-	<div id='tab-1'>
-		<table class="mainPageTable" id='messageList'>
-			<colgroup>
-				<col width="160px"/>
-				<col width="160px"/>
-				<col width="100px"/>
-				<col/>
-			</colgroup>
-			<tr>
-				<th class="{sorter: false}">$i18n.getString( "date" )</th>
-				<th class="{sorter: false}">$i18n.getString( "program_stage" )</th>
-				<th class="{sorter: false}">$i18n.getString( "sender" )</th>
-				<th class="{sorter: false}">$i18n.getString( "type" )</th>
-				<th class="{sorter: false}">$i18n.getString( "message" )</th>
-				<th class="{sorter: false}">$i18n.getString( "operation" )</th>
-			</tr>
-			<tbody id='commentTB' name='commentTB'>
-				#set( $mark = false )
-				#foreach( $comment in $comments )
-					<tr id="comment_$comment.id" #alternate( $mark )>
-						<td>$format.formatDateTime($comment.createdDate)</td>
-						<td>$encoder.htmlEncode($programStageInstance.programStage.displayName)</td>
-						<td>$encoder.htmlEncode($comment.creator)</td>
-						<td>$i18n.getString('comment')</td>
-						<td>$encoder.htmlEncode($comment.commentText)</td>
-						<td>
-							<a href="javascript:removeComment( '$programStageInstance.id', '$comment.id' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
-						</td>
-					</tr>
-					#set( $mark = !$mark )
-				#end
-				#foreach( $sms in $outboundSms )
-					<tr id="tr${sms.id}" #alternate( $mark )>
-						<td>$format.formatDateTime($!sms.date)</td>
-						<td>$encoder.htmlEncode($programStageInstance.programStage.displayName)</td>
-						<td>$encoder.htmlEncode($sms.sender)</td>
-						<td>$i18n.getString('message')</td>
-						<td>$encoder.htmlEncode($sms.message)</td>
-						<td>
-							<a href="javascript:removeMessage('', $programStageInstance.id, $sms.id )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
-						</td>
-					</tr>
-					#set( $mark = !$mark )
-				#end
-			</tbody>
-		</table>
-		
-	</div>
-	
 	<div id='tab-2'>
+		#parse( "/dhis-web-caseentry/trackingEventMessage.vm" )
+	</div>
+	
+	<div id='tab-3'>
 		<p>
 			<input type="button" onclick="exportProgramReports( '$programInstance.id', 'xls' )" value="$i18n.getString('get_report_as_xls')" style='width:150px;'>
 			<input type="button" onclick="exportProgramReports( '$programInstance.id', 'pdf' )" value="$i18n.getString('get_report_as_pdf')" style='width:150px;'>
@@ -251,6 +206,9 @@
 	
 	$( "#tabs-tracking" ).bind( "tabsselect", function(event, ui) {
 		if( ui.tab.hash == '#tab-2' ){
+			getProgramStageInstanceById($!programStageInstance.id);
+		}
+		else if( ui.tab.hash == '#tab-3' ){
 			programReports(getFieldValue('programInstanceId'));
 		}
 	});

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackingEventMessage.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackingEventMessage.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackingEventMessage.vm	2013-08-07 08:46:28 +0000
@@ -0,0 +1,45 @@
+<table class="mainPageTable" id='messageList'>
+	<colgroup>
+		<col width="160px"/>
+		<col width="160px"/>
+		<col width="100px"/>
+		<col/>
+	</colgroup>
+	<tr>
+		<th class="{sorter: false}">$i18n.getString( "date" )</th>
+		<th class="{sorter: false}">$i18n.getString( "program_stage" )</th>
+		<th class="{sorter: false}">$i18n.getString( "sender" )</th>
+		<th class="{sorter: false}">$i18n.getString( "type" )</th>
+		<th class="{sorter: false}">$i18n.getString( "message" )</th>
+		<th class="{sorter: false}">$i18n.getString( "operation" )</th>
+	</tr>
+	<tbody id='commentTB' name='commentTB'>
+		#set( $mark = false )
+		#foreach( $comment in $programStageInstance.patientComments )
+			<tr id="comment_$comment.id" #alternate( $mark )>
+				<td>$format.formatDateTime($comment.createdDate)</td>
+				<td>$encoder.htmlEncode($programStageInstance.programStage.displayName)</td>
+				<td>$encoder.htmlEncode($comment.creator)</td>
+				<td>$i18n.getString('comment')</td>
+				<td>$encoder.htmlEncode($comment.commentText)</td>
+				<td>
+					<a href="javascript:removeComment( '$programStageInstance.id', '$comment.id' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+				</td>
+			</tr>
+			#set( $mark = !$mark )
+		#end
+		#foreach( $sms in $programStageInstance.outboundSms )
+			<tr id="tr${sms.id}" #alternate( $mark )>
+				<td>$format.formatDateTime($!sms.date)</td>
+				<td>$encoder.htmlEncode($programStageInstance.programStage.displayName)</td>
+				<td>$encoder.htmlEncode($sms.sender)</td>
+				<td>$i18n.getString('message')</td>
+				<td>$encoder.htmlEncode($sms.message)</td>
+				<td>
+					<a href="javascript:removeMessage('', $programStageInstance.id, $sms.id )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+				</td>
+			</tr>
+			#set( $mark = !$mark )
+		#end
+	</tbody>
+</table>
\ No newline at end of file