← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9344: Allow to post patient comment in data entry form.

 

------------------------------------------------------------
revno: 9344
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-12-18 12:41:39 +0700
message:
  Allow to post patient comment in data entry form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  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/patientDashboard.vm
  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
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2012-11-23 03:02:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2012-12-18 05:41:39 +0000
@@ -70,7 +70,7 @@
     private PatientAuditService patientAuditService;
 
     private CurrentUserService currentUserService;
-    
+
     // -------------------------------------------------------------------------
     // Input && Output
     // -------------------------------------------------------------------------
@@ -165,6 +165,13 @@
         this.patientId = patientId;
     }
 
+    private String visitor;
+
+    public String getVisitor()
+    {
+        return visitor;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -209,7 +216,7 @@
         long currentTime = new Date().getTime();
         long dateOnly = (currentTime / millisInDay) * millisInDay;
         Date date = new Date( dateOnly );
-        String visitor = currentUserService.getCurrentUsername();
+        visitor = currentUserService.getCurrentUsername();
         PatientAudit patientAudit = patientAuditService.getPatientAudit( patient, visitor, date );
         if ( patientAudit == null )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-12-12 10:41:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-12-18 05:41:39 +0000
@@ -28,6 +28,28 @@
 <input type='hidden' name='validCompleteOnly' id='validCompleteOnly' value='$!programStageInstance.programStage.validCompleteOnly'>
 
 <div id='entryForm' #if($!programStageInstance.executionDate) class='visible' #else class='hidden' #end>					
+	<table class="entryScreen formSection">
+		<tr>
+			<td class="text-column">$i18n.getString('post_comment'):</td>
+			<td><input type="text" class="{validate:{maxlength:160}}" name="message_$programStageInstance.id" id="message_$programStageInstance.id" name="message_$programStageInstance.id" style="width:450px;" onkeypress="keypressOnComent(event,this,$programStageInstance.id);"></td>
+		</tr>
+		<tr>
+			<td></td>
+			<td colspan='3'>
+				<table>
+					<tbody id="commentTB">
+						#foreach( $comment in $programStageInstance.patientComments )
+						<tr>
+							<td>$format.formatDateTime($comment.createdDate) </td>
+							<td>$comment.creator </td>
+							<td>$comment.commentText</td>
+						</tr>
+						#end
+					</tbody>
+				</table>
+			</td>
+		</tr>
+	</table>
 	#if( $customDataEntryFormCode )
 		#parse( "/dhis-web-caseentry/customDataEntryForm.vm" )
 	#elseif( $sections && $sections.size() > 0 )

=== 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	2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-12-18 05:41:39 +0000
@@ -1670,6 +1670,14 @@
 		});
 }
 
+function keypressOnComent(event, field, programStageInstanceId )
+{
+	var key = getKeyCode( event );
+	if ( key==13 ){ // Enter
+		addComment( field, programStageInstanceId );
+	}
+}
+
 function addComment( field, programStageInstanceId )
 {
 	field.style.backgroundColor = SAVING_COLOR;
@@ -1689,10 +1697,14 @@
 			var programStageName = jQuery("#ps_" + programStageInstanceId).attr('programStageName');
 			var date = new Date();
 			var currentTime = date.getHours() + ":" + date.getMinutes();
-			jQuery('#commentTB').prepend("<tr><td>" + getFieldValue("currentDate") + " " + currentTime + "</td>"
-					+ "<td>" + programStageName + "</td>"
-					+ "<td>" + getFieldValue('currentUsername') + "</td>"
-					+ "<td>" + commentText + "</td></tr>");
+			var content = "<tr><td>" + getCurrentDate("currentDate") + " " + currentTime + "</td>"
+			if(programStageName!=undefined)
+			{
+				content += "<td>" + programStageName + "</td>"
+			}
+			content += "<td>" + getFieldValue('currentUsername') + "</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	2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2012-12-18 05:41:39 +0000
@@ -192,14 +192,6 @@
 // Post Comments/Send Message
 // --------------------------------------------------------------------
 
-function keypressOnComent(event, field, programStageInstanceId )
-{
-	var key = getKeyCode( event );
-	if ( key==13 ){ // Enter
-		addComment( field, programStageInstanceId );
-	}
-}
-
 function keypressOnMessage(event, field, programStageInstanceId )
 {
 	var key = getKeyCode( event );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-12-18 05:41:39 +0000
@@ -4,6 +4,7 @@
  &raquo; <a href="javascript:dashboardHistoryToggle();" >$i18n.getString( 'history' )</a>
 </h3>
 
+<input type='hidden' id='currentUsername' name='currentUsername' value='$!visitor'>
 <div class='dashboard-area'>
 
 	<div class="link-area">

=== 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	2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2012-12-18 05:41:39 +0000
@@ -15,7 +15,7 @@
 			<table>
 				<tr>            
 					<td class="bold">$i18n.getString( "full_name" ):</td>
-					<td>$encoder.htmlEncode($programStageInstance.programInstance.patient.getFullName()) ( $programStageInstance.programInstance.patient.gender ))</td>
+					<td>$encoder.htmlEncode($programStageInstance.programInstance.patient.getFullName()) ( $programStageInstance.programInstance.patient.gender )</td>
 				</tr>
 				<tr>
 					<td class="bold">$i18n.getString( "date_of_birth" ):</td>