Project

General

Profile

Bug #20829 » tceforms_datepicker_v3.diff

Administrator Admin, 2009-08-05 14:08

View differences:

t3lib/class.t3lib_tceforms.php (working copy)
}
$GLOBALS['SOBE']->doc->loadPrototype();
$GLOBALS['SOBE']->doc->loadExtJS();
$this->loadJavascriptLib('../t3lib/jsfunc.evalfield.js');
// @TODO: Change to loadJavascriptLib(), but fix "TS = new typoScript()" issue first - see bug #9494
$jsFile[] = '<script type="text/javascript" src="'.$this->backPath.'jsfunc.tbe_editor.js"></script>';
//needed for tceform manipulation (datePicker)
$this->loadJavascriptLib('../t3lib/js/tceforms.js');
// if IRRE fields were processed, add the JavaScript functions:
if ($this->inline->inlineCount) {
$GLOBALS['SOBE']->doc->loadScriptaculous();
t3lib/js/tceforms.js (revision 0)
/***************************************************************
* extJS for TCEforms
*
* $Id$
*
* Copyright notice
*
* (c) 2009 Steffen Kamper <info@sk-typo3.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project 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.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
Ext.onReady(function() {
Ext.QuickTips.init();
convertDateFieldsToDatePicker();
});
function convertDateFieldsToDatePicker() {
Ext.util.CSS.createStyleSheet(
'.ext-gecko .x-form-text, .ext-ie8 .x-form-text {padding:0;}' +
'.ext-strict .x-form-text {height: 12px;}' +
'.x-trigger-wrap-focus .x-form-trigger {border: none;}' +
'.x-form-field-wrap .x-form-date-trigger {background-position:-102px; border-width: 0;}',
'tceforms-datePicker-CSS'
);
var dateFields = Ext.select("*[id^=tceforms-datefield-], *[id^=tceforms-datetimefield-]");
var f = [];
dateFields.each(function(el) {
var ck = el.prev("input");
var hasCheckbox = Ext.isObject(ck);
if (el.dom.id.match(/tceforms-datefield-/)) {
f = ['j-n-Y', 'j.n.Y|Y-n-j'];
} else {
f = ['G:i j-n-Y', 'G:i j.n.Y|Y-n-j G:i'];
}
var dp = new Ext.form.DateField({
format: f[0],
altFormats: f[1],
applyTo: el.dom,
width: 185,
height: 12,
listeners: {
select: function(picker,date) {
eval(el.dom.attributes['onchange'].value);
}
}
});
if (hasCheckbox) {
ck.dom.setStyle({float: 'left'});
if (Ext.isIE) {
dp.wrap.dom.style.marginTop = '4px';
dp.wrap.dom.style.float = 'left';
} else {
dp.wrap.dom.setStyle({marginTop: '4px',float:'left'});
}
}
});
}
(1-1/5)