← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9920: Remove calendar-icon and add a icon for deleting a date value in date-fields. Please click on the...

 

------------------------------------------------------------
revno: 9920
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-28 13:45:35 +0700
message:
  Remove calendar-icon and add a icon for deleting a date value in date-fields. Please click on the field to show calendar box.
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/calendar-delete.png
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm
  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/jsonPatientProperties.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm	2013-02-28 04:34:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm	2013-02-28 06:45:35 +0000
@@ -17,7 +17,7 @@
   {
 	"id": "fixedAttr_gender",
 	"name": "$i18n.getString('gender')",
-	"valueType": "list"
+	"valueType": "string"
   },
   {
 	"id": "fixedAttr_birthDate",

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-02-22 13:10:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-02-28 06:45:35 +0000
@@ -14,9 +14,6 @@
 		<td class='text-column'><label for="registration_date">$i18n.getString( "registration_date" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td class="input-column" colspan='2'>
 			<input type="text" id="registrationDate" name="registrationDate" class="{validate:{required:true}}"/>
-			<script type="text/javascript">
-				datePickerValid( 'registrationDate', true );
-			</script>    
 		</td>		
 	</tr>
 
@@ -150,18 +147,18 @@
 			<tr>
 				<td class='text-column'><label>$encoder.htmlEncode($attribute.displayName) #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
 				<td class="input-column">
-					#if( $attribute.valueType == "YES/NO" )
+					#if( $attribute.valueType == "bool" )
 						<select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit"> 
 							<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 							<option value="true" #if($value=='true') selected #end>$i18n.getString( "yes" )</option>
 							<option value="false" #if($value=='false') selected #end>$i18n.getString( "no" )</option>
 						</select>                
-					#elseif( $attribute.valueType == "DATE" )
+					#elseif( $attribute.valueType == "date" )
 						<input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class=' #validate( "default"  $attribute.mandatory )'/>
 						<script type="text/javascript">
 							datePickerValid( 'attr$attribute.id' );
 						</script>                    
-					#elseif( $attribute.valueType == "COMBO" )  
+					#elseif( $attribute.valueType == "combo" )  
 						<select  id="attr$attribute.id"  name="attr$attribute.id" inherit="$!attribute.inherit" class='#validate( "default"  $attribute.mandatory )'>
 							<option value="">[$i18n.getString( "please_select" )]</option>
 							#foreach ($option in $attribute.attributeOptions )
@@ -188,22 +185,22 @@
 		#elseif( $!attribute )
 			#set( $attributeValue = "" )
 			#set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
-			#if( $attribute.valueType != 'CALCULATED')
+			#if( $attribute.valueType != 'calculated')
 			<tr>
 				<td class='text-column'><label>$encoder.htmlEncode($attribute.displayName) #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
 				<td class="input-column">
-					#if( $attribute.valueType == "YES/NO" )
+					#if( $attribute.valueType == "bool" )
 						<select id="attr$attribute.id"  name="attr$attribute.id" inherit="$!attribute.inherit">              
 							<option value="">[$i18n.getString( "please_select" )]</option>
 							<option value="true" #if( $attributeValue ) selected="selected" #end>$i18n.getString( "yes" )</option>
 							<option value="false" #if( !$attributeValue ) selected="selected" #end>$i18n.getString( "no" )</option>
 						</select>                
-					#elseif( $attribute.valueType == "DATE" )
+					#elseif( $attribute.valueType == "date" )
 						<input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value="$!attributeValue" class=' #validate( "default"  $attribute.mandatory )'>
 						<script type="text/javascript">
 							datePickerValid( 'attr$attribute.id' );
 						</script>                    
-					#elseif( $attribute.valueType == "COMBO" )
+					#elseif( $attribute.valueType == "combo" )
 						<select  id="attr$attribute.id"  name="attr$attribute.id" inherit="$!attribute.inherit" class=' #validate( "default"  $attribute.mandatory )' >
 							 <option value="">[$i18n.getString( "please_select" )]</option>
 						#foreach ($option in $attribute.attributeOptions )

=== 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-06 12:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2013-02-28 06:45:35 +0000
@@ -879,6 +879,9 @@
         yearRange: '-100:+100'
 	});
 	jQuery( "#" + id ).attr("readonly", true );
+	jQuery( ".ui-datepicker-trigger").hide();
+	addRemoveDateButton( id );
+	
 	s = jQuery("#" + id );		
 	if( s.val()=='' ) s.val( getCurrentDate() );		
 }
@@ -899,6 +902,8 @@
         yearRange: '-100:+100'
 	});
 	jQuery( "#" + id ).attr("readonly", true );
+	jQuery( ".ui-datepicker-trigger").hide();
+	addRemoveDateButton( id );
 	
 	if( today == undefined ) today = false;
 	
@@ -924,6 +929,8 @@
         yearRange: '-100:+100'
 	});		
 	jQuery( "#" + id ).attr("readonly", true );
+	jQuery( ".ui-datepicker-trigger").hide();
+	addRemoveDateButton( id );
 }
 
 /**
@@ -948,7 +955,9 @@
         yearRange: '-100:+100'
 	});
 	jQuery( "#" + id ).attr("readonly", true );
-	
+	jQuery( ".ui-datepicker-trigger").hide();
+	addRemoveDateButton( id );
+
 	if ( today == undefined )
 	{
 		today = false;
@@ -978,6 +987,8 @@
         yearRange: '-100:+100'
 	});
 	jQuery( "#" + id ).attr("readonly", true );
+	jQuery( ".ui-datepicker-trigger").hide();
+	addRemoveDateButton( id );
 	
 	if ( today == undefined )
 	{
@@ -1033,7 +1044,10 @@
 
 	jQuery( "#" + startdate ).attr("readonly", true );
 	jQuery( "#" + enddate ).attr("readonly", true );
-
+	jQuery( ".ui-datepicker-trigger").hide();
+	addRemoveDateButton( startdate );
+	addRemoveDateButton( enddate );
+	
     $("#ui-datepicker-div").hide();
 }
 
@@ -1075,10 +1089,20 @@
 
 	jQuery( "#" + startdate ).attr("readonly", true );
 	jQuery( "#" + enddate ).attr("readonly", true );
-
+	jQuery( ".ui-datepicker-trigger").hide();
+	addRemoveDateButton( startdate );
+	addRemoveDateButton( enddate );
+	
+	
     $("#ui-datepicker-div").hide();
 }
 
+function addRemoveDateButton( id )
+{
+	jQuery("#" + id).after(function() {
+	  return ' <img src="../images/calendar-delete.png" align="justify" id="delete_' + id + '" onclick="jQuery( \'#' + id + '\').val(\'\');jQuery( \'#' + id + '\').change();"> ';
+	});
+}
 
 function getCurrentDate()
 {	

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/calendar-delete.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/calendar-delete.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/calendar-delete.png	2013-02-28 06:45:35 +0000 differ