← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5470: Show comfirm box before deleting current event; Remove validation button; Only show anonymous pro...

 

------------------------------------------------------------
revno: 5470
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-12-19 17:00:03 +0700
message:
  Show comfirm box before deleting current event; Remove validation button; Only show anonymous programs which are assigned for the selected programs.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js


--
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/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2011-12-15 06:47:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2011-12-19 10:00:03 +0000
@@ -451,4 +451,5 @@
 create_new_event=Create new event
 delete_current_event = Delete current event
 delete_current_event_success=Delete current event successfully
-please_enter_report_date = Please enter report date
\ No newline at end of file
+please_enter_report_date = Please enter report date
+comfirm_delete_current_event = Are you sure you want to delete the current event ?
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2011-12-19 03:08:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2011-12-19 10:00:03 +0000
@@ -3,7 +3,6 @@
 	
 <div id="actions">	
 	<input type="button" id="createEventBtn" value="$i18n.getString('create_new_event')" onClick="javascript: createNewEvent();" style="width:12em " disabled="disabled">
-	<input type="button" id="validationBtn" value="$i18n.getString('run_validation')" onClick="javascript: runValidation();" style="width:12em " disabled="disabled" >
 	<input type="button" id="completeBtn" value="$i18n.getString('complete')" onClick="doComplete(); afterCompleteStage()" style="width:12em" disabled="disabled" >
 	<input type="button" id="deleteCurrentEventBtn" value="$i18n.getString('delete_current_event')" onClick="javascript: deleteCurrentEvent();" style="width:12em " disabled="disabled" >
 </div>	
@@ -14,7 +13,7 @@
 		<tr>
 			<td>$i18n.getString('program')</td>
 			<td>
-				<select id='programId' style='width:300px' onchange='showEventForm();'>
+				<select id='programId' name='programId' style='width:300px' onchange='showEventForm();'>
 					<option value="">[ $i18n.getString('please_select') ]</option>
 					#foreach( $programInstance in $programInstances)
 						<option value="$programInstance.program.id" singleevent='$programInstance.program.singleEvent' programInstanceId='$programInstance.id'>$programInstance.program.name</option>
@@ -58,4 +57,5 @@
 	
 	var i18n_delete_current_event_success = '$encoder.jsEscape( $i18n.getString( "delete_current_event_success" ) , "'")';
 	var i18n_please_enter_report_date = '$encoder.jsEscape( $i18n.getString( "please_enter_report_date" ) , "'")';
+	var i18n_comfirm_delete_current_event = '$encoder.jsEscape( $i18n.getString( "comfirm_delete_current_event" ) , "'")';
 </script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2011-12-19 03:08:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2011-12-19 10:00:03 +0000
@@ -7,7 +7,6 @@
 	disable('createEventBtn');
 	disable('deleteCurrentEventBtn');
 	
-	
 	$.postJSON( 'loadAnonymousPrograms.action',{}
 		, function( json ) 
 		{
@@ -140,33 +139,38 @@
 
 function deleteCurrentEvent()
 {	
-	jQuery.postJSON( "removeCurrentEncounter.action",
-		{
-			programStageInstanceId: getFieldValue('programStageInstanceId')
-		}, 
-		function( json ) 
-		{    
-			var type = json.response;
-			
-			if( type == 'success' )
-			{
-				hideById('dataEntryFormDiv');
-				
-				showSuccessMessage( i18n_delete_current_event_success );
-				setFieldValue('executionDate','');
-				
-				disable('deleteCurrentEventBtn');
-				enable('createEventBtn');
-				
-				enable('executionDate');
-				
-				$('#executionDate').unbind('change');
-			}
-			else if( type == 'input' )
-			{
-				showWarningMessage( json.message );
-			}
-		});
+	var result = window.confirm( i18n_comfirm_delete_current_event );
+    
+    if ( result )
+    {
+		jQuery.postJSON( "removeCurrentEncounter.action",
+			{
+				programStageInstanceId: getFieldValue('programStageInstanceId')
+			}, 
+			function( json ) 
+			{    
+				var type = json.response;
+				
+				if( type == 'success' )
+				{
+					hideById('dataEntryFormDiv');
+					
+					showSuccessMessage( i18n_delete_current_event_success );
+					setFieldValue('executionDate','');
+					
+					disable('deleteCurrentEventBtn');
+					enable('createEventBtn');
+					
+					enable('executionDate');
+					
+					$('#executionDate').unbind('change');
+				}
+				else if( type == 'input' )
+				{
+					showWarningMessage( json.message );
+				}
+			});
+	}
 }
 
 function afterCompleteStage()