← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14928: Fixed bugs in single event entry form, include Load data entry form, Add new TEI,

 

------------------------------------------------------------
revno: 14928
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-04-22 00:30:29 +0800
message:
  Fixed bugs in single event entry form, include Load data entry form, Add new TEI, 
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.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/addSingleEventRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm
  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/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.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/selectTrackedEntityInstance.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updateTrackedEntityInstanceForm.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/caseentry/DataRecordingSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	1970-01-01 00:00:00 +0000
@@ -1,119 +0,0 @@
-package org.hisp.dhis.caseentry.action.caseentry;
-
-/*
- * Copyright (c) 2004-2014, 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.
- */
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.trackedentity.TrackedEntityInstance;
-import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Abyot Asalefew Gizaw
- * @version $Id$
- */
-public class DataRecordingSelectAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private TrackedEntityInstanceService entityInstanceService;
-
-    public void setEntityInstanceService( TrackedEntityInstanceService entityInstanceService )
-    {
-        this.entityInstanceService = entityInstanceService;
-    }
-
-    private ProgramService programService;
-
-    public void setProgramService( ProgramService programService )
-    {
-        this.programService = programService;
-    }
-
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input/Output
-    // -------------------------------------------------------------------------
-
-    private Integer entityInstanceId;
-
-    public void setEntityInstanceId( Integer entityInstanceId )
-    {
-        this.entityInstanceId = entityInstanceId;
-    }
-
-    private TrackedEntityInstance entityInstance;
-
-    public TrackedEntityInstance getEntityInstance()
-    {
-        return entityInstance;
-    }
-
-    private Collection<Program> programs = new HashSet<Program>();
-
-    public Collection<Program> getPrograms()
-    {
-        return programs;
-    }
-
-    // -------------------------------------------------------------------------
-    // Implementation Action
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        OrganisationUnit orgunit = selectionManager.getSelectedOrganisationUnit();
-
-        entityInstance = entityInstanceService.getTrackedEntityInstance( entityInstanceId );
-
-        // ---------------------------------------------------------------------
-        // Get programs which entity-instance enrolls
-        // ---------------------------------------------------------------------
-
-        programs = programService.getProgramsByCurrentUser( orgunit );
-
-        return SUCCESS;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java	2014-04-06 15:48:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java	2014-04-21 16:30:29 +0000
@@ -86,9 +86,9 @@
     // Input && Output
     // -------------------------------------------------------------------------
 
-    private Integer entityInstanceId;
+    private String entityInstanceId;
 
-    public void setEntityInstanceId( Integer entityInstanceId )
+    public void setEntityInstanceId( String entityInstanceId )
     {
         this.entityInstanceId = entityInstanceId;
     }

=== 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	2014-04-21 13:16:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2014-04-21 16:30:29 +0000
@@ -26,16 +26,6 @@
 	</bean>
 
 	<bean
-		id="org.hisp.dhis.caseentry.action.caseentry.DataRecordingSelectAction"
-		class="org.hisp.dhis.caseentry.action.caseentry.DataRecordingSelectAction"
-		scope="prototype">
-		<property name="entityInstanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
-		<property name="selectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-	</bean>
-
-	<bean
 		id="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction"
 		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	2014-04-08 11:37:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2014-04-21 16:30:29 +0000
@@ -58,14 +58,6 @@
 			<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_SEARCH</param>
 		</action>
 
-		<action name="selectDataRecording"
-			class="org.hisp.dhis.caseentry.action.caseentry.DataRecordingSelectAction">
-			<result name="success" type="velocity">/content.vm</result>
-			<param name="page">/dhis-web-caseentry/dataRecordingSelect.vm</param>
-			<param name="stylesheets">style/style.css</param>
-			<param name="requiredAuthorities">F_TRACKED_ENTITY_DATAVALUE_ADD,F_TRACKED_ENTITY_DATAVALUE_DELETE</param>
-		</action>
-
 		<action name="loadProgramStageInstances"
 			class="org.hisp.dhis.caseentry.action.caseentry.LoadProgramStageInstancesAction">
 			<result name="success" type="velocity-json">
@@ -77,6 +69,8 @@
 			class="org.hisp.dhis.caseentry.action.caseentry.GetProgramStageInstanceAction">
 			<result name="success" type="velocity-json">/dhis-web-caseentry/jsonProgramStageInstance.vm
 			</result>
+			<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm
+			</result>
 		</action>
 
 		<action name="editDataEntryForm" class="org.hisp.dhis.caseentry.action.NoAction">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2014-04-06 15:48:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2014-04-21 16:30:29 +0000
@@ -4,19 +4,25 @@
 		checkedDuplicate = false;
 		
 		jQuery("#singleEventForm").validate({
-				 meta:"validate"
-				,errorElement:"span"
-				,submitHandler: function(form)
-					{
-						validateData();
-					}
-			});
-		
-		addEventForEntityInstanceForm( 'entityInstanceForm' );
+			 meta:"validate"
+			,errorElement:"span"
+			,submitHandler: function(form)
+				{
+					validateData();
+				}
+		});
 	});	
 	
 </script>
-	
+
+<h3 id='entityInstanceMamagementLink'>
+	<a href="javascript:onClickBackBtn();">$i18n.getString( 'tracked_entity_instance_management' )</a>
+	#if($!relatedProgram)
+		&#8226; <a href="javascript:showTrackedEntityInstanceDashboardForm('$!entityInstanceUid');">$i18n.getString( 'dashboard' )</a>
+	#end
+	&#8226; $i18n.getString( "add_new_tracked_entity_instance" )
+</h3>
+
 <form id='singleEventForm'>
 	<input type="hidden" id="representativeId" name="representativeId"/> 
 	<input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm	2014-04-11 10:36:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm	2014-04-21 16:30:29 +0000
@@ -1,23 +1,20 @@
 <script>
 	jQuery(document).ready(	function(){
 		currentDiv = 'entityInstanceForm';
-		checkedDuplicate = false;
 		jQuery("#entityInstanceForm").validate({
-				 meta:"validate"
-				,errorElement:"span"
-				,submitHandler: function(form)
-					{
-						#if($!relatedProgram)
-							var programId = getFieldValue("relatedProgramId");
-							addTrackedEntityInstance( programId, true, isContinue);
-						#else
-							var programId = getFieldValue('program');
-							addTrackedEntityInstance(programId, false, isContinue);
-						#end
-					}
-			});
-		
-		addEventForEntityInstanceForm( 'entityInstanceForm' );
+			 meta:"validate"
+			,errorElement:"span"
+			,submitHandler: function(form)
+				{
+					#if($!relatedProgram)
+						var programId = getFieldValue("relatedProgramId");
+						addTrackedEntityInstance( programId, true, isContinue);
+					#else
+						var programId = getFieldValue('program');
+						addTrackedEntityInstance(programId, false, isContinue);
+					#end
+				}
+		});
 	});	
 	
 	addRelationship = false;
@@ -25,7 +22,7 @@
 </script>
 
 <h3 id='entityInstanceMamagementLink'>
-	<a href="javascript:loadTrackedEntityInstanceList();">$i18n.getString( 'tracked_entity_instance_management' )</a>
+	<a href="javascript:onClickBackBtn();">$i18n.getString( 'tracked_entity_instance_management' )</a>
 	#if($!relatedProgram)
 		&#8226; <a href="javascript:showTrackedEntityInstanceDashboardForm('$!entityInstanceUid');">$i18n.getString( 'dashboard' )</a>
 	#end

=== 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-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2014-04-21 16:30:29 +0000
@@ -50,13 +50,6 @@
 		</tr>
 		#end
 		
-		<tr>
-			<td colspan='3'>
-				<table>
-					<tbody></tbody>
-				</table>
-			</td>
-		</tr>
 		#foreach($key in $programIndicatorsMap.keySet())
 		<tr>
 			<td colspan='3' class='bold'>$key: $programIndicatorsMap.get($key)</td>
@@ -64,7 +57,6 @@
 		#end
 		
 	</table>
-	</table>
 
 	<br>
 

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2014-01-05 14:04:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<form id='dataRecordingSelectForm' name='dataRecordingSelectForm' method='post'></form>
\ No newline at end of file

=== 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	2014-04-21 14:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-04-21 16:30:29 +0000
@@ -963,11 +963,7 @@
 				showById('editEntityInstanceDiv');
 			});
 }
-function addEventForEntityInstanceForm(divname) {
-	$("#" + divname + " [id=checkDuplicateBtn]").click(function() {
-		checkDuplicate(divname);
-	});
-}
+
 function showRepresentativeInfo(entityInstanceId) {
 	$('#representativeInfo').dialog({
 		title : i18n_representative_info,
@@ -1354,39 +1350,11 @@
 		}
 	});
 }
-// ----------------------------------------------------------------
-// Show selected data-recording
-// ----------------------------------------------------------------
-function showSelectedDataRecoding(entityInstanceId) {
-	showLoader();
-	hideById('searchDiv');
-	hideById('dataEntryFormDiv');
-	hideById('migrationEntityInstanceDiv');
-	hideById('dataRecordingSelectDiv');
-	$('#dataRecordingSelectDiv')
-			.load(
-					'selectDataRecording.action',
-					{
-						entityInstanceId : entityInstanceId
-					},
-					function() {
-						$('#dataRecordingSelectDiv [id=backBtnFromEntry]')
-								.hide();
-						showById('dataRecordingSelectDiv');
-						var programId = $(
-								'#programEnrollmentSelectDiv [id=programId] option:selected')
-								.val();
-						$('#dataRecordingSelectDiv [id=programId]').val(
-								programId);
-						$('#dataRecordingSelectDiv [id=inputCriteria]').hide();
-						showById('dataRecordingSelectDiv');
-						hideLoader();
-						hideById('contentDiv');
-					});
-}
+
 // ----------------------------------------------------------------
 // EntityInstance Location
 // ----------------------------------------------------------------
+
 function getTrackedEntityInstanceLocation(entityInstanceId) {
 	hideById('listEntityInstanceDiv');
 	hideById('selectDiv');
@@ -1409,17 +1377,21 @@
 		showSuccessMessage(i18n_save_success);
 	});
 }
+
 // ----------------------------------------------------------------
 // List program-stage-instance of selected program
 // ----------------------------------------------------------------
+
 function getVisitSchedule(programInstanceId) {
 	$('#tab-3').load("getVisitSchedule.action", {
 		programInstanceId : programInstanceId
 	});
 }
+
 // ----------------------------------------------------------------
 // Dash board
 // ----------------------------------------------------------------
+
 function showTrackedEntityInstanceDashboardForm(entityInstanceId) {
 	hideById('selectDiv');
 	hideById('searchDiv');
@@ -1431,6 +1403,7 @@
 	hideById('smsManagementDiv');
 	hideById('dataEntryFormDiv');
 	setInnerHTML('listEventDiv', '');
+	
 	$('#loaderDiv').show();
 	$('#entityInstanceDashboard').load('trackedEntityInstanceDashboard.action',
 			{

=== 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-01-23 15:36:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2014-04-21 16:30:29 +0000
@@ -847,67 +847,69 @@
         type: 'GET',
         dataType: 'json'
     } ).done(function(data) {
-        $( "#programStageInstanceId" ).val( data.id );
-        $( "#entryFormContainer input[id='programStageInstanceId']" ).val( data.id );
-        $( "#entryFormContainer input[id='incidentDate']" ).val( data.programInstance.dateOfIncident );
-        $( "#entryFormContainer input[id='programInstanceId']" ).val( data.programInstance.id );
-        $( "#entryFormContainer input[id='irregular']" ).val( data.programStage.irregular );
-        $( "#entryFormContainer input[id='displayGenerateEventBox']" ).val( data.programStage.displayGenerateEventBox );
-        $( "#entryFormContainer input[id='completed']" ).val( data.completed );
-        $( "#entryFormContainer input[id='programStageId']" ).val( data.programStage.id  );
-        $( "#entryFormContainer input[id='programStageUid']" ).val( data.programStage.uid  );
-        $( "#entryFormContainer input[id='programId']" ).val( data.program.id );
-        $( "#entryFormContainer input[id='validCompleteOnly']" ).val( data.programStage.validCompleteOnly );
-        $( "#entryFormContainer input[id='currentUsername']" ).val( data.currentUsername );
-        $( "#entryFormContainer input[id='blockEntryForm']" ).val( data.programStage.blockEntryForm );
-        $( "#entryFormContainer input[id='remindCompleted']" ).val( data.programStage.remindCompleted );
-        $( "#entryFormContainer input[id='displayOptionSetAsRadioButton']" ).val( data.displayOptionSetAsRadioButton );
-        $( "#entryFormContainer input[id='allowGenerateNextVisit']" ).val( data.programStage.allowGenerateNextVisit );
-
-        $( "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);
-
-        if ( data.program.type != '1' ) {
-            hideById( 'newEncounterBtn' );
-        }
-
-        if ( data.program.type == '1' && data.programInstance.status == '1' ) {
-            var blockEntry = getFieldValue('blockEntryForm');
-            if( blockEntry == 'true' ){
-                blockEntryForm();
-            }
-        }
-
-        if(data.executionDate) {
-            $( '#executionDate' ).val(data.executionDate);
-            $( '#entryForm' ).removeClass( 'hidden' ).addClass( 'visible' );
-            $( '#inputCriteriaDiv' ).removeClass( 'hidden' );
-        }
-
-        if ( data.programStage.captureCoordinates ) {
-            $( '#longitude' ).val( data.longitude );
-            $( '#latitude' ).val( data.latitude );
-        }
-
-        _.each( data.dataValues, function ( value, key ) {
-            var fieldId = getProgramStageUid() + '-' + key + '-val';
-            var field = $('#' + fieldId);
-
-            if ( field ) {
-                var value = value.value;
-
-                if( !checkAndSetRadio(field, value) ) {
-                    field.val(decodeURI(value));
-                    checkAndSetCheckbox(field, value);
-                }
-            }
-        } );
-
-        $('#commentInput').removeAttr('disabled');
-        $('#commentButton').removeAttr('disabled');
-        $('#validateBtn').removeAttr('disabled');
+		if( data.response=='undefined'){
+			$( "#programStageInstanceId" ).val( data.id );
+			$( "#entryFormContainer input[id='programStageInstanceId']" ).val( data.id );
+			$( "#entryFormContainer input[id='incidentDate']" ).val( data.programInstance.dateOfIncident );
+			$( "#entryFormContainer input[id='programInstanceId']" ).val( data.programInstance.id );
+			$( "#entryFormContainer input[id='irregular']" ).val( data.programStage.irregular );
+			$( "#entryFormContainer input[id='displayGenerateEventBox']" ).val( data.programStage.displayGenerateEventBox );
+			$( "#entryFormContainer input[id='completed']" ).val( data.completed );
+			$( "#entryFormContainer input[id='programStageId']" ).val( data.programStage.id  );
+			$( "#entryFormContainer input[id='programStageUid']" ).val( data.programStage.uid  );
+			$( "#entryFormContainer input[id='programId']" ).val( data.program.id );
+			$( "#entryFormContainer input[id='validCompleteOnly']" ).val( data.programStage.validCompleteOnly );
+			$( "#entryFormContainer input[id='currentUsername']" ).val( data.currentUsername );
+			$( "#entryFormContainer input[id='blockEntryForm']" ).val( data.programStage.blockEntryForm );
+			$( "#entryFormContainer input[id='remindCompleted']" ).val( data.programStage.remindCompleted );
+			$( "#entryFormContainer input[id='displayOptionSetAsRadioButton']" ).val( data.displayOptionSetAsRadioButton );
+			$( "#entryFormContainer input[id='allowGenerateNextVisit']" ).val( data.programStage.allowGenerateNextVisit );
+
+			$( "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);
+
+			if ( data.program.type != '1' ) {
+				hideById( 'newEncounterBtn' );
+			}
+
+			if ( data.program.type == '1' && data.programInstance.status == '1' ) {
+				var blockEntry = getFieldValue('blockEntryForm');
+				if( blockEntry == 'true' ){
+					blockEntryForm();
+				}
+			}
+
+			if(data.executionDate) {
+				$( '#executionDate' ).val(data.executionDate);
+				$( '#entryForm' ).removeClass( 'hidden' ).addClass( 'visible' );
+				$( '#inputCriteriaDiv' ).removeClass( 'hidden' );
+			}
+
+			if ( data.programStage.captureCoordinates ) {
+				$( '#longitude' ).val( data.longitude );
+				$( '#latitude' ).val( data.latitude );
+			}
+
+			_.each( data.dataValues, function ( value, key ) {
+				var fieldId = getProgramStageUid() + '-' + key + '-val';
+				var field = $('#' + fieldId);
+
+				if ( field ) {
+					var value = value.value;
+
+					if( !checkAndSetRadio(field, value) ) {
+						field.val(decodeURI(value));
+						checkAndSetCheckbox(field, value);
+					}
+				}
+			} );
+
+			$('#commentInput').removeAttr('disabled');
+			$('#commentButton').removeAttr('disabled');
+			$('#validateBtn').removeAttr('disabled');
+		}
     } );
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2014-04-21 14:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2014-04-21 16:30:29 +0000
@@ -5,8 +5,7 @@
 	setInnerHTML( 'contentDiv', '' );
 	setFieldValue( 'orgunitName', orgUnitNames[0] );
 	
-	hideById('dataEntryFormDiv');
-	hideById('dataRecordingSelectDiv');
+	hideById('singleDataEntryFormDiv');
 	showById('searchDiv');
 	
 	enable('searchObjectId');
@@ -20,9 +19,9 @@
 
 function loadDataEntry( programStageInstanceId )
 {
-	setInnerHTML('dataEntryFormDiv', '');
+	setInnerHTML('singleDataEntryFormDiv', '');
 	showById('executionDateTB');
-	showById('dataEntryFormDiv');
+	showById('singleDataEntryFormDiv');
 	setFieldValue( 'dueDate', '' );
 	setFieldValue( 'executionDate', '' );
 	disableCompletedButton(true);
@@ -30,23 +29,16 @@
 	jQuery( 'input[id=programStageInstanceId]').val(programStageInstanceId );
 			
 	showLoader();	
-	$( '#dataEntryFormDiv' ).load( "dataentryform.action", 
+	$( '#singleDataEntryFormDiv' ).load( "dataentryform.action", 
 		{ 
 			programStageInstanceId: programStageInstanceId
-		},function( )
+		},function( html )
 		{
-			var executionDate = jQuery('#dataRecordingSelectDiv input[id=executionDate]').val();
+			var programName = $('#program option:selected').text();
+			setInnerHTML( 'singleDataEntryFormDiv', '<h3>' + programName + '</h3><br>' + html);
 			var completed = jQuery('#entryFormContainer input[id=completed]').val();
 			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
 			showById('inputCriteriaDiv');
-			if( executionDate != '' && completed == 'false' )
-			{
-				disableCompletedButton(false);
-			}
-			else if( completed == 'true' )
-			{
-				disableCompletedButton(true);
-			}
 			showById('entryForm');
 			hideLoader();
 			hideById('listEntityInstanceDiv'); 
@@ -59,14 +51,11 @@
 
 function showSearchForm()
 {
-	hideById('dataRecordingSelectDiv');
-	hideById('dataEntryFormDiv');
+	hideById('singleDataEntryFormDiv');
 	hideById('addNewDiv');
 	showById('searchDiv');
 	showById('listEntityInstanceDiv');
 	showById('mainLinkLbl');
-	jQuery('#createNewEncounterDiv').dialog('close');
-	jQuery('#resultSearchDiv').dialog('close');
 }
 
 //--------------------------------------------------------------------------------------------
@@ -100,6 +89,7 @@
 			setInnerHTML('listEntityInstanceDiv', displayTEIList(json, page));
 			showById('listEntityInstanceDiv');
 			jQuery('#loaderDiv').hide();
+			statusSearching = 1;
 			setTableStyles();
 		}
 	});
@@ -130,25 +120,38 @@
 // Show selected data-recording
 //--------------------------------------------------------------------------------------------
 
-function showSelectedDataRecoding( entityInstanceId, programId )
-{
-	showLoader();
-	hideById('searchDiv');
-	hideById('dataEntryFormDiv');
-	jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action', 
-		{
-			entityInstanceId: entityInstanceId
-		},
-		function()
-		{
-			showById('dataRecordingSelectDiv');
-			hideLoader();
-			hideById('listEntityInstanceDiv');
-			hideById('listEntityInstanceDiv');
-			hideById('mainLinkLbl');
-			setInnerHTML('singleProgramName',jQuery('#program option:selected').text());
-			loadProgramStages( entityInstanceId, programId );
-		});
+
+function onClickBackBtn() {
+	showById('mainLinkLbl');
+	showById('selectDiv');
+	showById('searchDiv');
+	hideById('addNewDiv');
+	hideById('editEntityInstanceDiv');
+	hideById('enrollmentDiv');
+	hideById('listRelationshipDiv');
+	hideById('addRelationshipDiv');
+	hideById('migrationEntityInstanceDiv');
+	setInnerHTML('entityInstanceDashboard', '');
+	loadTrackedEntityInstanceList();
+}
+
+function loadTrackedEntityInstanceList() {
+	hideById('editEntityInstanceDiv');
+	hideById('enrollmentDiv');
+	hideById('listRelationshipDiv');
+	hideById('addRelationshipDiv');
+	hideById('singleDataEntryFormDiv');
+	hideById('migrationEntityInstanceDiv');
+	setInnerHTML('entityInstanceDashboard', '');
+	setInnerHTML('editEntityInstanceDiv', '');
+	showById('mainLinkLbl');
+	showById('selectDiv');
+	showById('searchDiv');
+	if (statusSearching == 0) {
+		return;
+	} else if (statusSearching == 1) {
+		showById('listTrackedEntityInstanceDiv');
+	}
 }
 
 function advancedSearch( params, page )
@@ -162,6 +165,7 @@
 			setInnerHTML('listEntityInstanceDiv', displayTEIList(json, page));
 			showById('listEntityInstanceDiv');
 			jQuery('#loaderDiv').hide();
+			statusSearching = 1;
 			setTableStyles();
 		}
 	});
@@ -233,13 +237,6 @@
 		
 		// Operations column
 		table += "<td>";
-		table += "<a href=\"javascript:isDashboard=true;showTrackedEntityInstanceDashboardForm( '"
-				+ uid
-				+ "' )\" title='"
-				+ i18n_dashboard
-				+ "'><img src='../images/enroll.png' alt='"
-				+ i18n_dashboard
-				+ "'></a>";
 		table += "<a href=\"javascript:isDashboard=false;showUpdateTrackedEntityInstanceForm( '"
 				+ uid
 				+ "' )\" title='"
@@ -247,21 +244,6 @@
 				+ "'><img src= '../images/edit.png' alt='"
 				+ i18n_data_entry
 				+ "'></a>";
-		table += "<a href=\"javascript:setFieldValue( 'isShowEntityInstanceList', 'false' ); showRelationshipList('"
-				+ uid
-				+ "' )\" title='"
-				+ i18n_manage_relationship
-				+ "'><img src='../images/relationship.png' alt='"
-				+ i18n_manage_relationship + "'></a>";
-		if (canChangeLocation) {
-			table += "<a href=\"javascript:isDashboard=false;getTrackedEntityInstanceLocation( '"
-					+ uid
-					+ "' );\" title='"
-					+ i18n_change_location
-					+ "'><img src='../icons/dataentry.png' alt='"
-					+ i18n_change_location
-					+ "' style='width:25px; height:25px'></a>";
-		}
 		table += "<a href=\"javascript:removeTrackedEntityInstance( '" + uid
 				+ "', '', '" + i18n_confirm_delete_tracked_entity_instance
 				+ "' )\" title='" + i18n_remove

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2014-04-21 14:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2014-04-21 16:30:29 +0000
@@ -45,17 +45,17 @@
 	hideById('contentDiv');
 	hideById('searchDiv');
 	hideById('advanced-search');
+	hideById('listRelationshipDiv');
+	showById('entityInstanceMamagementLink');
+	hideById('mainLinkLbl');
 	setInnerHTML('addNewDiv','');
-	setInnerHTML('dataRecordingSelectDiv','');
 	jQuery('#loaderDiv').show();
 	jQuery('#addNewDiv').load('showEventWithRegistrationForm.action',
 		{
 			programId: getFieldValue('program')
 		}, function()
 		{
-			setInnerHTML('singleProgramName',jQuery('#program option:selected').text());	
 			unSave = true;
-			showById('singleProgramName');
 			showById('addNewDiv');
 			jQuery('#loaderDiv').hide();
 		});
@@ -63,21 +63,18 @@
 
 function showUpdateTrackedEntityInstanceForm( entityInstanceId )
 {
+	showLoader();
+	hideById('searchDiv');
+	hideById('singleDataEntryFormDiv');
 	hideById('dataEntryMenu');
 	showById('eventActionMenu');
 	hideById('nextEventLink');
-	setInnerHTML('singleProgramName',jQuery('#program option:selected').text());	
-	showById('singleProgramName');
 	setInnerHTML('addNewDiv','');
+	hideById('listEntityInstanceDiv');
+	hideById('mainLinkLbl');
+	
 	unSave = false;
-	showSelectedDataRecoding(entityInstanceId, getFieldValue('program'));
-}
-
-function addEventForEntityInstanceForm( divname )
-{
-	jQuery("#" + divname + " [id=checkDuplicateBtn]").click(function() {
-		checkDuplicate( divname );
-	});
+	loadProgramStages(entityInstanceId, getFieldValue('program'));
 }
 
 function validateData()
@@ -177,7 +174,6 @@
 			}
 			else
 			{
-				setInnerHTML('singleProgramName','');
 				hideById('addNewDiv');
 				if( getFieldValue('listAll')=='true'){
 					listAllTrackedEntityInstance();
@@ -197,14 +193,12 @@
 function showEntryFormDiv()
 {
 	hideById('singleEventForm');
-	jQuery("#resultSearchDiv").dialog("close");
 }
 
 function backEventList()
 {
 	showById('dataEntryMenu');
 	hideById('eventActionMenu');
-	hideById('singleProgramName');
 	showSearchForm();
 	if( getFieldValue('listAll')=='true'){
 		listAllTrackedEntityInstance();

=== 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-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm	2014-04-21 16:30:29 +0000
@@ -6,7 +6,7 @@
     "executionDate": "$!format.formatDate( $programStageInstance.executionDate )",
     "status": "$!programStageInstance.getEventStatus()",
     "completed": "$!programStageInstance.completed",
-    "comment": "$!programStageInstance.comment.commentText",
+    "comment": "$!encoder.jsonEncode( $!programStageInstance.comment.commentText )",
     #if($programStageInstance.programStage.captureCoordinates)
     "latitude": "$!latitude",
     "longitude": "$!longitude",

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectTrackedEntityInstance.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectTrackedEntityInstance.vm	2014-04-21 14:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectTrackedEntityInstance.vm	2014-04-21 16:30:29 +0000
@@ -137,7 +137,7 @@
 	var checkedDuplicate = false;
 	// -1: no search anything
 	//  0: show list all tracked_entity_instance
-	//  1: search with conditions
+	//  1: advanced-search
 	var statusSearching = -1;
 	unSave = false;
 	isAjax = true;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	2014-03-20 10:17:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	2014-04-21 16:30:29 +0000
@@ -176,20 +176,22 @@
 
 </div>
 #else
+
 <!-- DEFAULT -->
+#set($programStage = '')
+#foreach($ps in $program.programStages)
+	#set($programStage = $ps)
+#end
 
 <tbody id="entryForm">
 	<tr>
-		<th colspan='2'>$!programStage.program.displayName</th>
+		<th colspan='2'>$!program.displayName</th>
 	</tr>
-	<!-- Identifiers/Attributes belong to the selected single program -->
-	#set($program = $programStage.program)
-	#parse( "/dhis-web-caseentry/attributeFormDiv.vm" )
 	
 	<!-- Data elements -->
 #set( $dataElementRowCount = 0 )
 #set( $tabIndex = 1 )
-#foreach( $programStageDataElement in $programStageDataElements )
+#foreach( $programStageDataElement in $programStage.programStageDataElements )
 	#set( $dataElementRowCount = $dataElementRowCount + 1 )    
 	#set( $dataValue = false )
 	#set( $key = $programStageDataElement.dataElement.id )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2014-04-21 14:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2014-04-21 16:30:29 +0000
@@ -10,15 +10,14 @@
 		if(jQuery("#program option").length==0)
 		{
 			jQuery( '#program').append( '<option value="" type="">' + i18n_none_program + '</option>' );
-			disable('listEntityInstanceBtn');
-			disable('addEntityInstanceBtn');
 		}
 		else{
 			jQuery( '#program').prepend( '<option value="" type="" selected>' + i18n_please_select + '</option>' );
-			enable('listEntityInstanceBtn');
-			enable('addEntityInstanceBtn');
 		}
 		
+		disable('addEntityInstanceBtn');
+		disable('listEntityInstanceBtn');
+		disable('advancedSearchBtn');
 		hideById('removeEventLink');
 		setFieldValue('isSearchByProgram', true);
 		registration = false;
@@ -29,8 +28,6 @@
 </script>
 
 <h3 id='mainLinkLbl'>$i18n.getString( "single_event_with_registration_management" ) #openHelp('single_event_with_registration')</h3>
-<h4 id='singleProgramName' name='singleProgramName'></h4>
-
 <input type='hidden' id='isRegistration' name= 'isRegistration' value='true'>
 <input type='hidden' id='listAll' name='listAll'>
 <select class='hidden' id='repeatableProgramStageId' name='repeatableProgramStageId'></select>
@@ -52,15 +49,13 @@
 
 <div id='listEntityInstanceDiv'></div>
 <div id='addNewDiv'></div>
-<div id='dataRecordingSelectDiv'></div>
-<div id='dataEntryFormDiv'></div>
 <div id='entityInstanceDashboard'></div> <!-- TrackedEntityInstance dashboard -->
+<div id='singleDataEntryFormDiv'></div>
 <div id='editEntityInstanceDiv'></div> <!-- Add TrackedEntityInstance Form -->
 <div id='resultSearchDiv' style='font-size:13px'></div> <!-- List searching entityInstances -->
 <div id='enrollmentDiv'></div> <!-- Program Enrollment Form -->
-<div id='listRelationshipDiv'></div> <!-- List relationship -->
 <div id='addRelationshipDiv'></div> <!-- Add relationship -->
-<div id='migrationEntityInstanceDiv'></div> <!-- Migration TrackedEntityInstance -->
+<div id='detailsInfo'></div>
 
 <script type="text/javascript">
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
@@ -165,7 +160,9 @@
 	var i18n_for = '$encoder.jsEscape( $i18n.getString( "for" ) , "'")';
 	var i18n_data_entry = '$encoder.jsEscape( $i18n.getString( "data_entry" ) , "'")';
 
-	var canChangeLocation = $auth.hasAccess( "dhis-web-caseentry", "getTrackedEntityInstanceLocation" );
-	
 	datePickerValid( 'executionDateNewEvent', true );
+	
+	//  0: no search anything
+	//  1: List/Advanced-search
+	var statusSearching = 0;
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updateTrackedEntityInstanceForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updateTrackedEntityInstanceForm.vm	2014-02-26 15:09:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updateTrackedEntityInstanceForm.vm	2014-04-21 16:30:29 +0000
@@ -19,13 +19,10 @@
 				}
 		});
 		
-		checkedDuplicate = false;
 		#if($!customRegistrationForm)
 		#else
 			datePickerValid( 'entityInstanceForm [id=deathDate]' );
 		#end
-		
-		addEventForEntityInstanceForm('entityInstanceForm');
 	});
 	
 	addRelationship = false;