← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5493: Enable/disable the orgunit selection tree in Event Registration form.

 

------------------------------------------------------------
revno: 5493
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-20 09:45:16 +0700
message:
  Enable/disable the orgunit selection tree in Event Registration form.
modified:
  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/dataEntryForm.vm
  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/entry.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/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2011-12-19 10:00:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2011-12-20 02:45:16 +0000
@@ -3,7 +3,7 @@
 	
 <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="completeBtn" value="$i18n.getString('complete')" onClick="doComplete(); afterCompleteStage()" style="width:12em" disabled="disabled" >
+	<input type="button" id="completeBtn" value="$i18n.getString('complete')" onClick="doComplete();" 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>	
 			

=== 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	2011-12-16 06:45:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2011-12-20 02:45:16 +0000
@@ -10,11 +10,9 @@
 		}
 		#end
 		
-		#if( $program.anonymous == "false" )
-			$('#executionDate').change(function() {
+		$('#executionDate').change(function() {
 				saveExecutionDate( getFieldValue('programStageId'), getFieldValue('executionDate') );
 			});
-		#end
 			
 		entryFormContainerOnReady();
 	});

=== 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 10:00:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2011-12-20 02:45:16 +0000
@@ -3,6 +3,7 @@
 {
 	disable('executionDate');
 	setFieldValue('executionDate', '');
+	$('#executionDate').unbind('change');
 	
 	disable('createEventBtn');
 	disable('deleteCurrentEventBtn');
@@ -81,9 +82,11 @@
 				disable('completeBtn');
 				disable('validationBtn');
 				
-				$('#executionDate').change(function() {
-					saveExecutionDate( getFieldValue('programStageId'), getFieldValue('executionDate') );
-				});
+				//$('#executionDate').change(function() {
+				//	saveExecutionDate( getFieldValue('programStageId'), getFieldValue('executionDate') );
+				//});
+				
+				$('#executionDate').bind('change');
 			}
 			else
 			{
@@ -103,9 +106,10 @@
 					enable('completeBtn');
 					enable('validationBtn');
 					
-					$('#executionDate').change(function() {
-						saveExecutionDate( getFieldValue('programStageId'), getFieldValue('executionDate') );
-					});
+					//$('#executionDate').change(function() {
+					//	saveExecutionDate( getFieldValue('programStageId'), getFieldValue('executionDate') );
+					//});
+					$('#executionDate').bind('change');
 				}
 			}
 			
@@ -121,12 +125,16 @@
 		}, 
 		function( json ) 
 		{    
+			selection.enable();
+			
 			if(json.response=='success')
 			{
 				disable('createEventBtn');
 				enable('deleteCurrentEventBtn');
 				setFieldValue('programStageInstanceId', json.message );
 				
+				selection.disable();
+				
 				loadEventRegistrationForm();
 			}
 			else
@@ -154,16 +162,18 @@
 				if( type == 'success' )
 				{
 					hideById('dataEntryFormDiv');
-					
-					showSuccessMessage( i18n_delete_current_event_success );
+					byId('programId').selectedIndex = 0;
+					
+					disable('deleteCurrentEventBtn');
+					enable('createEventBtn');
+					
 					setFieldValue('executionDate','');
-					
-					disable('deleteCurrentEventBtn');
-					enable('createEventBtn');
-					
 					enable('executionDate');
-					
 					$('#executionDate').unbind('change');
+					
+					selection.enable();
+					
+					showSuccessMessage( i18n_delete_current_event_success );
 				}
 				else if( type == 'input' )
 				{
@@ -171,9 +181,4 @@
 				}
 			});
 	}
-}
-
-function afterCompleteStage()
-{
-	enable('createEventBtn');
 }
\ No newline at end of file

=== 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	2011-12-15 06:47:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2011-12-20 02:45:16 +0000
@@ -779,6 +779,9 @@
 						enable('newEncounterBtn');
 					}
 					
+					enable('createEventBtn');
+					selection.enable();
+		
 					hideLoader();
 					hideById('contentDiv');
 				},'xml');