← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2246: Fix bug: Remove currently date into date-field with empty value in Case-entry form.

 

------------------------------------------------------------
revno: 2246
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-12-01 16:23:05 +0700
message:
  Fix bug: Remove currently date into date-field with empty value in Case-entry form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties


--
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	2010-11-29 07:29:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2010-12-01 09:23:05 +0000
@@ -1,7 +1,7 @@
 <script>
 function setupDataEntryCalendar( id )
 {
-	datePicker( id );
+	datePicker( id,  false);
 }
 </script>
 #parse( "/dhis-web-caseentry/dataRecordingSelect.vm" )
@@ -86,8 +86,8 @@
                         <option value="$optionValue.id" #if( $patientDataValue.value == $optionValue.id ) selected="selected" #end>$encoder.htmlEncode( $optionValue.name )</option>
                     #end
                 </select>
-            #elseif( $programStageDataElement.dataElement.type == "date" )
-                <input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].date" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveDateValue( $programStageDataElement.dataElement.id, '$encoder.jsEncode( $programStageDataElement.dataElement.name )' )" tabindex="$tabIndex" >
+            #elseif( $programStageDataElement.dataElement.type == "date" ) 
+                <input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].date" name="entryfield" value="$!encoder.htmlEncode($patientDataValue.value)" onchange="saveDateValue( $programStageDataElement.dataElement.id, '$encoder.jsEncode( $programStageDataElement.dataElement.name )' )" tabindex="$tabIndex" >
                     <script type="text/javascript">
 						setupDataEntryCalendar('value\\[$programStageDataElement.dataElement.id\\]\\.date');
                     </script>  					

=== 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	2010-11-29 14:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2010-12-01 09:23:05 +0000
@@ -774,6 +774,29 @@
 	if( s.val()=='' ) s.val( getCurrentDate() );		
 }
 
+function datePicker( id, today )
+{
+	$("#" + id).datepicker(
+	{
+		dateFormat:dateFormat,
+		changeMonth: true,
+		changeYear: true,			
+		monthNamesShort: monthNames,
+		dayNamesMin: dayNamesMin,
+		showOn: 'both',
+		buttonImage: '../images/calendar.png',
+		buttonImageOnly: true,
+		constrainInput: true		
+	});
+	
+	if( today == undefined ) today = false;
+	
+	if( today ){
+		s = jQuery("#" + id );		
+		if( s.val()=='' ) s.val( getCurrentDate() );		
+	}		
+}
+
 function datePickerjQuery( jQueryString )
 {
 	jQuery( jQueryString ).datepicker(

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2010-11-29 13:06:19 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2010-12-01 09:23:05 +0000
@@ -5,13 +5,13 @@
 
 #-- Date Formats --------------------------------------------------------------#
 
-format.date = yyyy-MM-dd
-format.date.label = yyyy-mm-dd
+format.date = dd-MM-yyyy
+format.date.label = dd-mm-yyyy
 format.time = HH:mm
 format.time.label = hh:mm
-format.datetime = yyyy-MM-dd HH:mm
-format.datetime.label = yyyy-mm-dd hh:mm
-format.date.label.jquery = yy-mm-dd
+format.datetime = dd-MM-yyyy HH:mm
+format.datetime.label = dd-mm-yyyy hh:mm
+format.date.label.jquery = dd-mm-yy
 
 #-- dhis-wp -------------------------------------------------------------------#