Bug with DatePicker in Catalog Edition
Hello,
I'm using Contao 2.11.11 and Catalog 2.0 ß2 rev 74.
I got a Catalog with a date field. I've created a cataloglist module which is editable and a catalog edition module…
My problem is the page where is the Catalog edition module dysplays this part of the php code at the top of the page :
Code:
window.addEvent('domready', function() { new DatePicker('#ctrl_date_panier', { allowEmpty: true, toggleElements: '#toggle_date_panier', pickerClass: 'datepicker_dashboard', format: 'd-m-Y', inputOutputFormat: 'd-m-Y', positionOffset: { x:130, y:-185 }, startDay: 0, days: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], dayShort: 3, months: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'], monthShort: 3 }); });
And so, the green datepicker button is not located at the right place and is no more active.
I suppose this a syntax problem in the code. Here is the concerned part of the code in ModuleCatalogEdit.php.
Code:
// Add datepicker
$datepicker = '';
if (in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
{
$objDate = new Date($objWidget->value, $GLOBALS['TL_CONFIG'][$arrData['eval']['rgxp'] . 'Format']);
$objWidget->value = $objDate->$arrData['eval']['rgxp'];
// date picker was changed in 2.10
if(version_compare(VERSION, '2.10', '>='))
{
$rgxp = $arrData['eval']['rgxp'];
switch ($rgxp)
{
case 'datim':
$time = ",\n timePicker: true";
break;
case 'time':
$time = ",\n timePickerOnly: true";
break;
default:
$time = '';
break;
}
$format = $GLOBALS['TL_CONFIG'][$rgxp.'Format'];
$datepicker = '[img]plugins/datepicker/icon.gif[/img]id . '" style="vertical-align:-6px;">';
$GLOBALS['TL_HEAD'][]=
'window.addEvent(\'domready\', function() {
new DatePicker(\'#ctrl_' . $objWidget->id . '\', {
allowEmpty: true,
toggleElements: \'#toggle_' . $objWidget->id . '\',
pickerClass: \'datepicker_dashboard\',
format: \'' . $format . '\',
inputOutputFormat: \'' . $format . '\',
positionOffset: { x:130, y:-185 }' . $time . ',
startDay: ' . $GLOBALS['TL_LANG']['MSC']['weekOffset'] . ',
days: [\''. implode("','", $GLOBALS['TL_LANG']['DAYS']) . '\'],
dayShort: ' . $GLOBALS['TL_LANG']['MSC']['dayShortLength'] . ',
months: [\''. implode("','", $GLOBALS['TL_LANG']['MONTHS']) . '\'],
monthShort: ' . $GLOBALS['TL_LANG']['MSC']['monthShortLength'] . '
});
});';
} else {
//$objWidget->datepicker = '
$GLOBALS['TL_HEAD'][]='
<script type="text/javascript"><![CDATA[//><!--
window.addEvent(\'domready\', function() { ' . sprintf($this->getDatePickerString(), 'ctrl_' . $objWidget->id) . ' });
//--><!]]></script>';
// files moved since 2.8 RC1
if(version_compare(VERSION.'.'.BUILD, '2.8.0', '<'))
{
$GLOBALS['TL_HEAD'][]='<script src="plugins/calendar/calendar.js" type="text/javascript"></script>';
$GLOBALS['TL_CSS'][] = 'plugins/calendar/calendar.css';
} else {
$GLOBALS['TL_HEAD'][]='<script src="plugins/calendar/js/calendar.js" type="text/javascript"></script>';
$GLOBALS['TL_CSS'][] = 'plugins/calendar/css/calendar.css';
}
}
}
I think the problem is located somewhere around the lines (line 784 in the php file) :
Code:
$GLOBALS['TL_HEAD'][]=
'window.addEvent(\'domready\', function() {
What is wrong with that syntax ? Thanks for your help.
Re: Bug with DatePicker in Catalog Edition
There is nothing wrong with the code you show. The first block is JS, not PHP. I see too little info to help. But the version of Catalog you refer to is a beta, it is expected to have problems. (So don't use it for a production site)
But to help more info is needed. What did you expect in the output, but what did you find. Can you coerce the code at the lines you found to do something that looks more like the desired outcome?
Re: Bug with DatePicker in Catalog Edition
I think this Problemm was solved in the SVN Version of the Catalog. So maybe you should use the SVN Version.. give it a try..
regards
Re: Bug with DatePicker in Catalog Edition
Re: Bug with DatePicker in Catalog Edition
Quote:
Originally Posted by Ruud
There is nothing wrong with the code you show. The first block is JS, not PHP. I see too little info to help. But the version of Catalog you refer to is a beta, it is expected to have problems. (So don't use it for a production site)
Hello Ruud,
Thanks for you help. Catalog 2.0.0 beta2 is the newer and more stable version in repo. Many consider it as the stable one.
Quote:
But to help more info is needed. What did you expect in the output, but what did you find. Can you coerce the code at the lines you found to do something that looks more like the desired outcome?
Here are two screen capture.
The first one shows you the problem on my FE page. A part of source code is displayed as html text instead of being parsed. That's why I suppose there is a syntax error in source code.
[attachment=1:2ujpp5wo]capture bug datepicker.png[/attachment:2ujpp5wo]
The second one shows the part of source code where i think the problem is located. Precisely line 785 as the syntax color isn't the same as in line 805.