← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9987: Add a property to display/hide remove-date icon of date-fields.

 

------------------------------------------------------------
revno: 9987
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-05 21:39:17 +0700
message:
  Add a property to display/hide remove-date icon of date-fields.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  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/addValidationCriteria.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2013-02-18 09:50:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2013-03-05 14:39:17 +0000
@@ -111,7 +111,7 @@
         // Inline Javascript to add to HTML before outputting
         // ---------------------------------------------------------------------
 
-        final String jQueryCalendar = "<script>datePicker(\"$PROGRAMSTAGEID-$DATAELEMENTID-val\", false);</script>";
+        final String jQueryCalendar = "<script>datePicker(\"$PROGRAMSTAGEID-$DATAELEMENTID-val\", false, false);</script>";
 
         StringBuffer sb = new StringBuffer();
 

=== 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	2013-02-28 16:25:21 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2013-03-05 14:39:17 +0000
@@ -863,7 +863,7 @@
  * 
  * @param id the id of input field which you want enter date *
  */
-function datePicker( id )
+function datePicker( id, hideDel )
 {
 	$("#" + id).datepicker(
 	{
@@ -879,13 +879,14 @@
 	});
 	jQuery( "#" + id ).attr("readonly", true );
 	jQuery( ".ui-datepicker-trigger").hide();
-	addRemoveDateButton( id );
+	
+	addRemoveDateButton( id, hideDel );
 	
 	s = jQuery("#" + id );		
 	if( s.val()=='' ) s.val( getCurrentDate() );		
 }
 
-function datePicker( id, today )
+function datePicker( id, today, hideDel )
 {
 	$("#" + id).datepicker(
 	{
@@ -900,7 +901,7 @@
 	});
 	jQuery( "#" + id ).attr("readonly", true );
 	jQuery( ".ui-datepicker-trigger").hide();
-	addRemoveDateButton( id );
+	addRemoveDateButton( id, hideDel );
 	
 	if( today == undefined ) today = false;
 	
@@ -908,9 +909,11 @@
 		s = jQuery("#" + id );
 		if( s.val()=='' ) s.val( getCurrentDate() );
 	}
+	
+	addRemoveDateButton( id, hideDel );
 }
 
-function datePickerjQuery( jQueryString )
+function datePickerjQuery( jQueryString, hideDel )
 {
 	jQuery( jQueryString ).datepicker(
 	{
@@ -925,7 +928,7 @@
 	});		
 	jQuery( "#" + id ).attr("readonly", true );
 	jQuery( ".ui-datepicker-trigger").hide();
-	addRemoveDateButton( id );
+	addRemoveDateButton( id, hideDel );
 }
 
 /**
@@ -933,7 +936,7 @@
  * 
  * @param id the id of input field which you want enter date *
  */
-function datePickerValid( id, today )
+function datePickerValid( id, today, hideDel )
 {
 	jQuery("#" + id).datepicker(
 	{
@@ -949,7 +952,7 @@
 	});
 	jQuery( "#" + id ).attr("readonly", true );
 	jQuery( ".ui-datepicker-trigger").hide();
-	addRemoveDateButton( id );
+	addRemoveDateButton( id, hideDel );
 
 	if ( today == undefined )
 	{
@@ -963,7 +966,7 @@
 	}
 }
 
-function datePickerFuture( id, today )
+function datePickerFuture( id, today, hideDel )
 {
 	jQuery("#" + id).datepicker(
 	{
@@ -979,7 +982,7 @@
 	});
 	jQuery( "#" + id ).attr("readonly", true );
 	jQuery( ".ui-datepicker-trigger").hide();
-	addRemoveDateButton( id );
+	addRemoveDateButton( id, hideDel );
 	
 	if ( today == undefined )
 	{
@@ -999,7 +1002,7 @@
  * @param startdate the id of input field which you want enter start date *
  * @param enddate the id of input field which you want enter end date *
  */
-function datePickerInRange ( startdate, enddate, setCurrentStartDate, setCurrentEndDate )
+function datePickerInRange ( startdate, enddate, setCurrentStartDate, setCurrentEndDate, hideDel )
 {
 	if( setCurrentStartDate == undefined ) setCurrentStartDate = true;
 	if( setCurrentEndDate == undefined ) setCurrentEndDate = true;
@@ -1034,13 +1037,13 @@
 	jQuery( "#" + startdate ).attr("readonly", true );
 	jQuery( "#" + enddate ).attr("readonly", true );
 	jQuery( ".ui-datepicker-trigger").hide();
-	addRemoveDateButton( startdate );
-	addRemoveDateButton( enddate );
+	addRemoveDateButton( startdate, hideDel );
+	addRemoveDateButton( enddate, hideDel );
 	
     $("#ui-datepicker-div").hide();
 }
 
-function datePickerInRangeValid( startdate, enddate, setCurrentStartDate, setCurrentEndDate )
+function datePickerInRangeValid( startdate, enddate, setCurrentStartDate, setCurrentEndDate, hideDel )
 {
 	if( setCurrentStartDate == undefined ) setCurrentStartDate = true;
 	if( setCurrentEndDate == undefined ) setCurrentEndDate = true;
@@ -1076,18 +1079,21 @@
 	jQuery( "#" + startdate ).attr("readonly", true );
 	jQuery( "#" + enddate ).attr("readonly", true );
 	jQuery( ".ui-datepicker-trigger").hide();
-	addRemoveDateButton( startdate );
-	addRemoveDateButton( enddate );
+	addRemoveDateButton( startdate, hideDel );
+	addRemoveDateButton( enddate, hideDel );
 }
 
-function addRemoveDateButton( id )
+function addRemoveDateButton( id, hideDel )
 {
-	var removeId = 'delete_' + id;
-	if( jQuery("#" + removeId).length == 0 )
-	{
-		jQuery("#" + id).after(function() {
-		  return ' <img src="../images/calendar-delete.png" align="justify" id="'+ removeId +'" onclick="jQuery( \'#' + id + '\').val(\'\');jQuery( \'#' + id + '\').change();"> ';
-		});
+	if( hideDel == undefined ) hideDel = true;
+	if( !hideDel ){
+		var removeId = 'delete_' + id;
+		if( jQuery("#" + removeId).length == 0 )
+		{
+			jQuery("#" + id).after(function() {
+			  return ' <img src="../images/calendar-delete.png" align="justify" id="'+ removeId +'" onclick="jQuery( \'#' + id + '\').val(\'\');jQuery( \'#' + id + '\').change();"> ';
+			});
+		}
 	}
 	jQuery( "#" + id).click(function() {
 		$("#ui-datepicker-div").show();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm	2012-10-22 06:34:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm	2013-03-05 14:39:17 +0000
@@ -65,7 +65,7 @@
 				
 				<!-- birthDate -->
 				<div id="birthDateDiv" style="display:none ">
-					<input type="text" id="birthDateValue" name="birthDateValue" onChange="fillValue(this.value);"style="width: 14em"/>			
+					<input type="text" id="birthDateValue" name="birthDateValue" onChange="fillValue(this.value);" style="width:215px"/>			
 					<script type="text/javascript">
 						datePickerValid( 'birthDateValue' );
 					</script> 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm	2012-10-22 06:34:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm	2013-03-05 14:39:17 +0000
@@ -68,7 +68,7 @@
 
 							<!-- birthDate -->
 							<div id="birthDateDiv" style="display:none ">
-								<input type="text" id="birthDateValue" name="birthDateValue" onChange="fillValue(this.value);"style="width: 14em"/>
+								<input type="text" id="birthDateValue" name="birthDateValue" onChange="fillValue(this.value);"style="width:215px"/>
 								<script type="text/javascript">datePickerValid( 'birthDateValue' );</script> 
 							</div>