← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3041: Date picker year list length set to 12.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 3041 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-03-15 14:45:17 +0100
message:
  Date picker year list length set to 12.
modified:
  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-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-03-10 16:34:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-03-15 13:37:36 +0000
@@ -774,15 +774,16 @@
 {
 	$("#" + id).datepicker(
 	{
-		dateFormat:dateFormat,
+		dateFormat: dateFormat,
 		changeMonth: true,
-		changeYear: true,			
+		changeYear: true,
 		monthNamesShort: monthNames,
 		dayNamesMin: dayNamesMin,
 		showOn: 'both',
 		buttonImage: '../images/calendar.png',
 		buttonImageOnly: true,
-		constrainInput: true		
+		constrainInput: true,
+        yearRange: '-11'
 	});
 	s = jQuery("#" + id );		
 	if( s.val()=='' ) s.val( getCurrentDate() );		
@@ -792,38 +793,40 @@
 {
 	$("#" + id).datepicker(
 	{
-		dateFormat:dateFormat,
+		dateFormat: dateFormat,
 		changeMonth: true,
-		changeYear: true,			
+		changeYear: true,
 		monthNamesShort: monthNames,
 		dayNamesMin: dayNamesMin,
 		showOn: 'both',
 		buttonImage: '../images/calendar.png',
 		buttonImageOnly: true,
-		constrainInput: true		
+		constrainInput: true,
+        yearRange: '-11'
 	});
 	
 	if( today == undefined ) today = false;
 	
 	if( today ){
-		s = jQuery("#" + id );		
-		if( s.val()=='' ) s.val( getCurrentDate() );		
-	}		
+		s = jQuery("#" + id );
+		if( s.val()=='' ) s.val( getCurrentDate() );
+	}
 }
 
 function datePickerjQuery( jQueryString )
 {
 	jQuery( jQueryString ).datepicker(
 	{
-		dateFormat:dateFormat,
+		dateFormat: dateFormat,
 		changeMonth: true,
-		changeYear: true,			
+		changeYear: true,
 		monthNamesShort: monthNames,
 		dayNamesMin: dayNamesMin,
 		showOn: 'both',
 		buttonImage: '../images/calendar.png',
 		buttonImageOnly: true,
-		constrainInput: true		
+		constrainInput: true,
+        yearRange: '-11'
 	});
 		
 }
@@ -833,26 +836,27 @@
  * @param id the id of input field which you want enter date *
  */
 function datePickerValid( id, today )
-{	
+{
 	jQuery("#" + id).datepicker(
 	{
-		dateFormat:dateFormat,
+		dateFormat: dateFormat,
 		changeMonth: true,
-		changeYear: true,			
+		changeYear: true,
 		monthNamesShort: monthNames,
 		dayNamesMin: dayNamesMin,
 		showOn: 'both',
 		buttonImage: '../images/calendar.png',
 		buttonImageOnly: true,
 		maxDate: '+0d +0w',
-		constrainInput: true
+		constrainInput: true,
+        yearRange: '-11'
 	});
 	
 	if( today == undefined ) today = false;
 	
 	if( today ){
-		s = jQuery("#" + id );		
-		if( s.val()=='' ) s.val( getCurrentDate() );		
+		s = jQuery("#" + id );
+		if( s.val()=='' ) s.val( getCurrentDate() );
 	}
 }
 
@@ -869,31 +873,31 @@
 	
 	s = jQuery("#" + startdate );
 	e = jQuery("#" + enddate );
-	if( setCurrentStartDate && s.val()=='') s.val( getCurrentDate() );	
+	if( setCurrentStartDate && s.val()=='') s.val( getCurrentDate() );
 	if( setCurrentEndDate && e.val()=='' ) e.val( getCurrentDate() );
 
 	var dates = $('#'+startdate+', #' + enddate).datepicker(
 	{
-		dateFormat:dateFormat,
+		dateFormat: dateFormat,
 		defaultDate: "+1w",
 		changeMonth: true,
 		changeYear: true,
 		numberOfMonths: 1,
 		monthNamesShort: monthNames,
 		dayNamesMin: dayNamesMin,
-		showAnim:'',
+		showAnim: '',
 		showOn: 'both',
 		buttonImage: '../images/calendar.png',
-		buttonImageOnly: true,	
+		buttonImageOnly: true,
+		constrainInput: true,
+        yearRange: '-11',
 		onSelect: function(selectedDate)
 		{
 			var option = this.id == startdate ? "minDate" : "maxDate";
 			var instance = $(this).data("datepicker");
 			var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
 			dates.not(this).datepicker("option", option, date);
-		},
-		constrainInput: true
-		
+		}
 	});
 }