← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5512: Disable all date fields, only click date-button to enter date-value (finished).

 

------------------------------------------------------------
revno: 5512
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-21 10:46:55 +0700
message:
  Disable all date fields, only click date-button to enter date-value (finished).
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/javascript/anonymousRegistration.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/report.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.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-21 02:54:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2011-12-21 03:46:55 +0000
@@ -27,8 +27,8 @@
 			<td><input type="text" id="executionDate" name="executionDate" style="width:300px" value="$!format.formatDate( $programStageInstance.executionDate )" >
 				<script type="text/javascript">
 				   datePickerValid( 'executionDate', false );
-				   jQuery('#executionDate').datepicker( "disable" );
 				</script>
+			</td>
 		</tr>
 	</table>
 </div>

=== 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-21 02:54:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2011-12-21 03:46:55 +0000
@@ -2,7 +2,7 @@
 function organisationUnitSelected( orgUnits )
 {
 	hideById('dataEntryFormDiv');
-	disableDataPicker( 'executionDate' );
+	disable( 'executionDate' );
 	setFieldValue('executionDate', '');
 	$('#executionDate').unbind('change');
 	
@@ -50,7 +50,7 @@
 {	
 	hideById('dataEntryFormDiv');
 	setFieldValue('executionDate', '');
-	disableDataPicker( 'executionDate' );
+	disable( 'executionDate' );
 	
 	var programId = getFieldValue('programId');
 	if( programId == '' )
@@ -76,7 +76,7 @@
 			else
 			{
 				
-				enableDataPicker( 'executionDate' );
+				enable( 'executionDate' );
 				enable('createEventBtn');
 				disable('deleteCurrentEventBtn');
 				disable('completeBtn');
@@ -105,14 +105,14 @@
 				disable('deleteCurrentEventBtn');
 				disable('completeBtn');
 				disable('validationBtn');
-				enableDataPicker( 'executionDate' );
+				enable( 'executionDate' );
 				$('#executionDate').bind('change');
 			}
 			else
 			{
 				if( getFieldValue('completed') == 'true')
 				{
-					disableDataPicker( 'executionDate' );
+					disable( 'executionDate' );
 					enable('createEventBtn');
 					enable('deleteCurrentEventBtn');
 					disable('completeBtn');
@@ -124,7 +124,7 @@
 					enable('deleteCurrentEventBtn');
 					enable('completeBtn');
 					enable('validationBtn');
-					enableDataPicker( 'executionDate' );
+					enable( 'executionDate' );
 					jQuery('#executionDate').bind('change');
 				}
 			}
@@ -184,7 +184,7 @@
 					enable('createEventBtn');
 					
 					setFieldValue('executionDate','');
-					enableDataPicker( 'executionDate' );
+					enable( 'executionDate' );
 					$('#executionDate').unbind('change');
 					
 					selection.enable();

=== 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-21 02:54:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2011-12-21 03:46:55 +0000
@@ -96,7 +96,7 @@
 			var completed = jQuery('#entryFormContainer input[id=completed]').val();
 			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
 			
-			enableDataPicker('dataRecordingSelectDiv input[id=executionDate]');
+			enable('executionDate');
 			if( executionDate != '' && completed == 'false' )
 			{
 				enable('validationBtn');
@@ -106,7 +106,7 @@
 			{
 				disable('validationBtn');
 				disable('completeBtn');
-				disableDataPicker('dataRecordingSelectDiv input[id=executionDate]');
+				disable('executionDate');
 			}
 			
 			if( completed == 'true' && irregular == 'true' )
@@ -674,7 +674,7 @@
 
     function markValue( color )
     {
-        var element = byId( 'executionDate' );
+        var element = document.getElementById( 'executionDate' );
            
         element.style.backgroundColor = color;
     }
@@ -772,7 +772,7 @@
 					
 					disable('validationBtn');
 					disable('completeBtn');
-					disableDataPicker('executionDate');
+					disable('executionDate');
 					var irregular = jQuery('#entryFormContainer [name=irregular]').val();
 					if( irregular == 'true')
 					{

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2011-12-21 02:54:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2011-12-21 03:46:55 +0000
@@ -15,8 +15,8 @@
 		if( json.programs.length == 0)
 		{
 			disable('programId');
-			disableDataPicker('startDate');
-			disableDataPicker('endDate');
+			disable('startDate');
+			disable('endDate');
 			disable('generateBtn');
 		}
 		else
@@ -28,8 +28,8 @@
 				addOptionById( 'programId', json.programs[i].id, json.programs[i].name );
 			} 
 			enable('programId');
-			enableDataPicker('startDate');
-			enableDataPicker('endDate');
+			enable('startDate');
+			enable('endDate');
 			enable('generateBtn');
 		}
 		

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-12-21 02:54:41 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-12-21 03:46:55 +0000
@@ -221,7 +221,15 @@
  */
 function enable( elementId )
 {
-    jQuery( "#" + elementId ).removeAttr( "disabled" );
+	var hasDatePicker = jQuery("#" + elementId ).data("datepicker");
+	if( hasDatePicker == undefined){
+		jQuery( "#" + elementId ).removeAttr( "disabled" );
+	}
+	else
+	{
+		jQuery('#' + elementId ).datepicker( "enable" );
+		jQuery( "#" + elementId ).attr("disabled", true );
+	} 
 }
 
 function enableGroup( selectorJQueryString )
@@ -236,7 +244,14 @@
  */
 function disable( elementId )
 {
-    jQuery( "#" + elementId ).attr("disabled", true );
+	var hasDatePicker = jQuery("#" + elementId ).data("datepicker");
+	if( hasDatePicker == undefined){
+		jQuery( "#" + elementId ).attr("disabled", true );
+	}
+	else
+	{
+		jQuery('#' + elementId ).datepicker( "disable" );
+	}    
 }
 
 function disableGroup( selectorJQueryString )
@@ -840,7 +855,7 @@
 		constrainInput: true,
         yearRange: '-100:+100',
 	});
-	disable( id );
+	jQuery( "#" + id ).attr("disabled", true );
 	s = jQuery("#" + id );		
 	if( s.val()=='' ) s.val( getCurrentDate() );		
 }
@@ -860,7 +875,7 @@
 		constrainInput: true,
         yearRange: '-100:+100'
 	});
-	disable( id );
+	jQuery( "#" + id ).attr("disabled", true );
 	
 	if( today == undefined ) today = false;
 	
@@ -885,19 +900,9 @@
 		constrainInput: true,
         yearRange: '-100:+100'
 	});		
-	disable( id );
-}
-
-function enableDataPicker( id )
-{
-	jQuery('#' + id ).datepicker( "enable" );
-	disable( id );
-}
-
-function disableDataPicker( id )
-{
-	jQuery('#' + id ).datepicker( "disable" );
-}
+	jQuery( "#" + id ).attr("disabled", true );
+}
+
 /**
  * Create jQuery datepicker for input text with id * *
  * 
@@ -919,7 +924,7 @@
 		constrainInput: true,
         yearRange: '-100:+100'
 	});
-	disable( id );
+	jQuery( "#" + id ).attr("disabled", true );
 	
 	if ( today == undefined )
 	{
@@ -972,8 +977,8 @@
 			dates.not(this).datepicker("option", option, date);
 		}
 	});
-	disable( startdate );
-	disable( enddate );
+	jQuery( "#" + startdate ).attr("disabled", true );
+	jQuery( "#" + enddate ).attr("disabled", true );
 
     $("#ui-datepicker-div").hide();
 }