← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2685: Fix bug: Don't fill current date on empty date fields.

 

------------------------------------------------------------
revno: 2685
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-01-21 09:26:00 +0700
message:
  Fix bug: Don't fill current date on empty date fields.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java
  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/dataRecordingSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.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
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java	2011-01-06 16:37:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java	2011-01-21 02:26:00 +0000
@@ -1081,9 +1081,9 @@
         // Metadata code to add to HTML before outputting
         // ---------------------------------------------------------------------    
         
-        final String jQueryCalendar = "<script> jQuery(function(){" +
-                                            "setupDataEntryCalendar(\"value\\\\\\\\[$PROGRAMSTAGEID\\\\\\\\]\\\\\\\\.date\\\\\\\\:value\\\\\\\\[$DATAELEMENTID\\\\\\\\]\\\\\\\\.date\")" + 
-                                            "});</script>";
+        final String jQueryCalendar = "<script> " +
+                                            "datePicker(\"value\\\\\\\\[$PROGRAMSTAGEID\\\\\\\\]\\\\\\\\.date\\\\\\\\:value\\\\\\\\[$DATAELEMENTID\\\\\\\\]\\\\\\\\.date\", false)" + 
+                                      ";</script>";
 
         final String metaDataCode = "<span id=\"value[$DATAELEMENTID].name\" style=\"display:none\">$DATAELEMENTNAME</span>"
             + "<span id=\"value[$DATAELEMENTID].type\" style=\"display:none\">$DATAELEMENTTYPE</span>";

=== 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-12-08 07:17:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2011-01-21 02:26:00 +0000
@@ -19,7 +19,7 @@
 	       $customDataEntryFormCode
 	    #else <span style="font-style:italic; color:blue"> $i18n.getString( "no_custom_data_entry_exist" )
 	    #end
-</span>
+</span> 
 </div>
 <script>
 	initCustomCheckboxes();
@@ -83,7 +83,7 @@
             #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');
+						datePicker('value\\[$programStageDataElement.dataElement.id\\]\\.date', false);
                     </script>  					
             #else
                 <input name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].value" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveValue( $programStageDataElement.dataElement.id, '$encoder.jsEncode( $programStageDataElement.dataElement.name )' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
@@ -135,5 +135,6 @@
     var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
     var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
 	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
+	
 </script>
 

=== modified 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	2011-01-20 08:58:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2011-01-21 02:26:00 +0000
@@ -72,8 +72,8 @@
             <td><label for="executionDate">$i18n.getString( "report_date" ) </label></td>
             <td><input type="text" id="executionDate" name="executionDate" value="$!format.formatDate( $programStageInstance.executionDate )" onchange="saveExecutionDate( $programStageInstance.id, '$encoder.jsEncode( $programStageInstance.programStage.name )' )" >
 				<script type="text/javascript">
-					datePickerValid('executionDate');
-                </script>  						
+					datePickerValid('executionDate', false);
+                </script>
         #end
     </tr>   
     <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-01-20 06:06:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-01-21 02:26:00 +0000
@@ -1,19 +1,3 @@
-function setupDataEntryCalendar( id )
-{	
-	jQuery("#" + id).datepicker(
-	{
-		dateFormat:dateFormat,
-		changeMonth: true,
-		changeYear: true,			
-		monthNamesShort: monthNames,
-		dayNamesMin: dayNamesMin,
-		showOn: 'button',
-		buttonImage: '../images/calendar.png',
-		buttonImageOnly: true
-	});	
-	
-}
-
 function viewPrgramStageRecords( programStageInstanceId ) 
 {
 	var url = 'viewProgramStageRecords.action?programStageInstanceId=' + programStageInstanceId;
@@ -1080,13 +1064,16 @@
             function(){
                 //				jQuery(this).siblings("td").removeClass("focusCell");
                 var childrens = jQuery(this).children("input[name='entryfield'],select[name='entryselect']");
-                if( jQuery(childrens[0]).is(":disabled")) {
+                
+				if( jQuery(childrens[0]).is(":disabled")) {
                     //					jQuery(this).addClass("focusCell");
                     DRAG_DIV.showData(jQuery(childrens[0]).metadata({
                         "type":"attr",
                         "name":"data"
                     }));
                 }
+				
+				
             },
             function(){
             //				if( currentFocus )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm	2011-01-20 08:58:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm	2011-01-21 02:26:00 +0000
@@ -38,7 +38,7 @@
             <td><label for="executionDate">$i18n.getString( "report_date" ) </label></td>
             <td><input type="text" id="executionDate" name="executionDate" value="$!format.formatDate( $programStageInstance.executionDate )" onchange="saveExecutionDate( $programStageInstance.id, '$encoder.jsEncode( $programStageInstance.programStage.name )' )" >
                 <script type="text/javascript">
-                   datePickerValid( 'executionDate' );
+                   datePickerValid( 'executionDate', false );
                 </script>                
         #end
     </tr>   

=== 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-01-20 23:05:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-01-21 02:26:00 +0000
@@ -827,8 +827,7 @@
 		buttonImageOnly: true,
 		constrainInput: true		
 	});
-	s = jQuery( jQueryString );		
-	if( s.val()=='' ) s.val( getCurrentDate() );		
+		
 }
 
 /**

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2010-11-25 22:22:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2011-01-21 02:26:00 +0000
@@ -380,14 +380,7 @@
 		id = boolPSDataEntryId;
 	}else if (dataElementType == "date")
 	{
-		clazz = "date_" + associationId + "_" + dataElementId;
-		selectString = "<input type=\"text\" id=\"" + datePSDataEntryId + "\" name=\"entryfield\" value=\"\" class=\"" + clazz + "\">";	
-		selectString += "<script type=\"text/javascript\">";
-		selectString += "jQuery(function(){";
-		selectString += "datePickerjQuery('." + clazz + "');";	
-		selectString += "});";	
-		selectString += "<\/script>";
-		
+		selectString = "<input type=\"text\" id=\"" + datePSDataEntryId + "\" name=\"entryfield\" value=\"\">";	
 		id = datePSDataEntryId;
 	} else if ( dataElementType == "int" )
 	{