← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16012: Display the comments of an event as a list in program-stage entry form.

 

------------------------------------------------------------
revno: 16012
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-07-08 14:30:54 +0800
message:
  Display the comments of an event as a list in program-stage entry form.
modified:
  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/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.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/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2014-04-21 16:30:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2014-07-08 06:30:54 +0000
@@ -70,6 +70,7 @@
 </div>
 
 <table id='entryPostComment' class='listTable hidden' style="width:100%;">
+<tr><td></td><td><table id='commentTB'></table></td><td></td></tr>
 <tr>
 	<th width="10%"><label for="postComment">$i18n.getString('post_comment'):</label></th>
 	<th width="85%">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2014-06-30 08:02:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2014-07-08 06:30:54 +0000
@@ -868,9 +868,13 @@
 
 			$( "input[id='dueDate']" ).val( data.dueDate );
 			$( "input[id='executionDate']" ).val( data.executionDate );
-			$( "#commentInput" ).val( data.comment );
-			$( "#commentInput" ).height(data.comment.split('\n').length * 15  + 12);
-
+			
+			for( var i in data.comments ){
+				var date = data.comments[i].date.substring(0,16);
+				var tr = "<tr><td>" + date + "</td><td>" + data.comments[i].creator + "</td><td>"+ i18n_comment + "</td><td>" + data.comments[i].text + "</td></tr>";
+				$( "#commentTB" ).append(tr);
+			}
+			
 			if ( data.program.type != '1' ) {
 				hideById( 'newEncounterBtn' );
 			}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm	2014-06-20 13:08:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm	2014-07-08 06:30:54 +0000
@@ -6,7 +6,16 @@
     "executionDate": "$!format.formatDate( $programStageInstance.executionDate )",
     "status": "$!programStageInstance.getEventStatus().getValue()",
     "completed": "$!programStageInstance.completed",
-    "comment": "$!encoder.jsonEncode( $!programStageInstance.comment.commentText )",
+	"comments":[
+		#set($size = $programStageInstance.comments.size())
+		#foreach($comment in $programStageInstance.comments)
+			{
+				"text": "$!encoder.jsonEncode( $comment.commentText )",
+				"date": "$comment.createdDate",
+				"creator": "$!encoder.jsonEncode( $comment.creator )"
+			}#if( $velocityCount < $size ),#end
+		#end
+	],
     #if($programStageInstance.programStage.captureCoordinates)
     "latitude": "$!latitude",
     "longitude": "$!longitude",

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2014-06-25 09:57:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2014-07-08 06:30:54 +0000
@@ -25,8 +25,6 @@
 		<td style="height:24px" valign="bottom" >
             <div class="commentHeader">$i18n.getString( "comment" )</div>
 		</td>
-		<td colspan='2' style="background-color: #e0e0e0; height:26px;">$i18n.getString( "updated_by" ): $!encoder.htmlEncode( $programInstance.comment.creator )</td>
-		<td colspan='2' style="background-color: #e0e0e0; height:26px;">$i18n.getString( "updated_date" ): $!format.formatDate( $programInstance.comment.createdDate )</td>
     </tr>
    
    <tr>
@@ -72,7 +70,7 @@
 			#foreach( $programStageInstance in $programStageInstances )
 				#if( $!programStageInstance.executionDate 
 					|| $!programStageInstance.outboundSms.size() > 0 
-					|| $!programStageInstance.comment )
+					|| $!programStageInstance.comments )
 					
 					#set($allowRemove = 'false')
 				#end
@@ -88,7 +86,7 @@
 		</td>
 		
 		<td valign="top" colspan='4'>
-			<input type="button" id='updateCommentBtn' name='updateCommentBtn' #if($!programStageInstance.comment) value="$i18n.getString( 'update_comment' )" #else value="$i18n.getString( 'save_comment' )" #end style="width:130px" onclick="saveComment($programInstance.id);">
+			<input type="button" id='updateCommentBtn' name='updateCommentBtn' value="$i18n.getString( 'save_comment' )" style="width:130px" onclick="saveComment($programInstance.id);">
 			<input type="button" id='sendProgramSMSBtn' name='sendProgramSMSBtn' value="$i18n.getString( 'send_message' )" style="width:130px" onclick="setFieldValue('sendFromEvent','false');sendSmsOneTrackedEntityInstanceForm();">
 		</td>
 	</tr>
@@ -176,7 +174,7 @@
 				</script>
 			</td>
 			<td>
-				<input type='text' value='$!programStageInstance.comment.commentText' id='message_$programStageInstance.id' name='message_$programStageInstance.id' class="{validate:{required:true,maxlength:160}}" style="width:100%" onchange="addComment(byId('message_$programStageInstance.id'),'$programStageInstance.id')" >
+				<input type='text' id='message_$programStageInstance.id' name='message_$programStageInstance.id' class="{validate:{required:true,maxlength:160}}" style="width:100%" onchange="addComment(byId('message_$programStageInstance.id'),'$programStageInstance.id')" >
 			</td>
 			<td>
 				<input type='button' class='normal-button' onclick="addComment(byId('message_$programStageInstance.id'),'$programStageInstance.id')" value="$i18n.getString('save')" >