Index: globals.js =================================================================== --- globals.js (revision 13) +++ globals.js (working copy) @@ -18,7 +18,8 @@ */ JSDatePicker = function() { var _aDisableDaysOfWeek = [false, false, false, false, false, false, false], - _aAllowedRange = [null, null]; + _aAllowedRange = [null, null], + _iDisableBeforeToday=0; this.form = { name: "mod_datepicker_form", // required, please use a unique name for all your instances @@ -45,7 +46,9 @@ this.setAllowedDateRange = function(From, To) { _aAllowedRange = [From, To]; } - + this.disableBeforeToday = function(Disable) { + _iDisableBeforeToday = Disable; + } this.show = function(x, y) { var _oForm, _nWidth = 370, @@ -71,6 +74,10 @@ forms[this.form.name]._g_oDatePicker = this; // Pass on the disabled week days array forms[this.form.name]._g_aDisableDaysOfWeek = _aDisableDaysOfWeek; + forms[this.form.name]._g_aAllowedRange = _aAllowedRange; + forms[this.form.name]._g_iDisableBeforeToday = _iDisableBeforeToday; + + // Show the form in a modal dialog application.showFormInDialog(forms[this.form.name], (x == null) ? -1 : x, (y == null) ? -1 : y, -1, -1, this.form.title, false, false, this.form.name, true); Index: forms/mod_datepicker.js =================================================================== --- forms/mod_datepicker.js (revision 13) +++ forms/mod_datepicker.js (working copy) @@ -1,4 +1,9 @@ /** + * @properties={typeid:35,uuid:"FF3AD843-565D-4059-AE10-0791A7676ED0",variableType:4} + */ +var _g_iDisableBeforeToday = 0; + +/** * @properties={typeid:35,uuid:"EEE913E5-AEB9-48F1-93FF-52D3AF2FA7EC",variableType:-4} */ var _g_aAllowedRange = [null,null]; @@ -147,8 +152,13 @@ // Button label _oLabel = _oForm.newLabel(_d.getDate(), _nX, _nY, _nBtnWidth, _nBtnHeight); - if ( _g_aDisableDaysOfWeek[_d.getDay()] ) { + if ( _g_aDisableDaysOfWeek[_d.getDay()]) { _oLabel.styleClass = "datebuttontext_disabled"; + } else if (_g_iDisableBeforeToday==1 && _d < Date.today()) { + _oLabel.styleClass = "datebuttontext_disabled"; + } else if ((_g_aAllowedRange[0] && _d < _g_aAllowedRange[0]) || (_g_aAllowedRange[1] && _d > _g_aAllowedRange[1]) ) { + _oLabel.styleClass = "datebuttontext_disabled"; + } else if (_d == Date.today()) { _oLabel.styleClass = "datebuttontext_today"; _oLabel.onAction = _oMethod