Fixing wrong bug in calendar popup \"year\" comes blank see CT#1236

skala
Julio Montoya 16 years ago
parent 52676c15dd
commit 4e106bc543
  1. 27
      main/inc/lib/formvalidator/Element/datepicker.php
  2. 31
      main/inc/lib/formvalidator/Element/datepickerdate.php
  3. 30
      main/inc/lib/formvalidator/Element/tbl_change.js.php

@ -1,26 +1,5 @@
<?php
// $Id: datepicker.php 20456 2009-05-10 17:27:44Z ivantcholakov $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
require_once ('HTML/QuickForm/date.php');
/**
* Form element to select a date and hour (with popup datepicker)
@ -53,8 +32,8 @@ class HTML_QuickForm_datepicker extends HTML_QuickForm_date
$this->_locale[$lang_code]['months_long'] = api_get_months_long();
}
$this->_options['format'] = 'dFY '.$popup_link.' H '.$hour_minute_devider.' i';
$this->_options['minYear'] = date('Y')-7;
$this->_options['maxYear'] = date('Y')+15;
$this->_options['minYear'] = date('Y')-5;
$this->_options['maxYear'] = date('Y')+10;
$this->_options['language'] = $lang_code;
//$this->_options['addEmptyOption'] = true;
//$this->_options['emptyOptionValue'] = 0;

@ -1,25 +1,5 @@
<?php // $Id: datepickerdate.php 16033 2008-08-20 21:21:44Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2008 Dokeos SPRL.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
<?php
/* For licensing terms, see /license.txt */
require_once ('HTML/QuickForm/date.php');
/**
* Form element to select a date and hour (with popup datepicker)
@ -29,8 +9,7 @@ class HTML_QuickForm_datepickerdate extends HTML_QuickForm_date
/**
* Constructor
*/
function HTML_QuickForm_datepickerdate($elementName = null, $elementLabel = null, $attributes = null)
{
function HTML_QuickForm_datepickerdate($elementName = null, $elementLabel = null, $attributes = null) {
global $myMinYear, $myMaxYear;
$js_form_name = $attributes['form_name'];
unset($attributes['form_name']);
@ -51,8 +30,8 @@ class HTML_QuickForm_datepickerdate extends HTML_QuickForm_date
$this->_locale[$lang_code]['months_long'] = api_get_months_long();
}
$this->_options['format'] = 'dFY '.$popup_link;
$this->_options['minYear'] = date('Y')-1;
$this->_options['maxYear'] = date('Y')+15;
$this->_options['minYear'] = date('Y')-5;
$this->_options['maxYear'] = date('Y')+10;
$this->_options['language'] = $lang_code;
//$this->_options['addEmptyOption'] = true;
//$this->_options['emptyOptionValue'] = 0;

@ -1,5 +1,5 @@
<?php
// $Id: tbl_change.js.php 18078 2009-01-29 17:21:11Z cfasanando $
/* For licensing terms, see /license.txt */
require '../../../global.inc.php';
?>
var day;
@ -27,11 +27,13 @@ function openCalendar(form, field) {
if (regex.test(forminputs[i].getAttribute('name'))) {
datevalues[dateindex++] = forminputs[i].value;
}
}
}
window.open("<?php echo api_get_path(WEB_LIBRARY_PATH); ?>formvalidator/Element/calendar_popup.php", "calendar", "width=260,height=230,status=no");
day = datevalues[0];
month = datevalues[1];
year = datevalues[2];
month--;
formName = form;
fieldName =field;
@ -162,6 +164,7 @@ function initCalendar() {
* @param string date text
*/
function returnDate(d,m,y) {
formblock= window.opener.document.getElementById(window.opener.formName);
forminputs = formblock.getElementsByTagName('select');
var datevalues = new Array();
@ -169,24 +172,25 @@ function returnDate(d,m,y) {
for (i = 0; i < forminputs.length; i++) {
// regex here to check name attribute
var regex = new RegExp(window.opener.fieldName, "i");
if (regex.test(forminputs[i].getAttribute('name'))) {
datevalues[dateindex++] = forminputs[i];
if (regex.test(forminputs[i].getAttribute('name'))) {
datevalues[dateindex] = forminputs[i];
dateindex++;
window.close();
}
}
datevalues[0].selectedIndex = (d-1) ;
datevalues[0].selectedIndex = (d-1) ;
datevalues[1].selectedIndex = m;
date = new Date();
year = 1900;
datevalues[2].selectedIndex = (y-year);
for(i = 0; i<= 3; i++)
{
//Selecting the first option of the year
year = datevalues[2].options[0].value;
datevalues[2].selectedIndex = y - year;
for(i = 0; i<= 3; i++) {
attributes = datevalues[i].attributes;
for (attr=0; attr<attributes.length; attr++)
if(attributes[attr].nodeName == 'onchange')
{
if(attributes[attr].nodeName == 'onchange') {
datevalues[i].onchange();
}
}

Loading…
Cancel
Save