[TYPO3-core] RFC feature #16393: date ranges for ExtJS date pickers
Stefano Cecere
scecere at krur.com
Wed Nov 17 15:56:03 CET 2010
hi
here is the latest revised and (thanks to Dirk Rudolph) really optimized
patch for this feature.
any +1 around? :)
stefano
Index: t3lib/class.t3lib_tceforms.php
--- t3lib/class.t3lib_tceforms.php Base (BASE)
+++ t3lib/class.t3lib_tceforms.php Locally Modified (Based On LOCAL)
@@ -1097,7 +1097,17 @@
// css class and id will show the kind of field
if (in_array('date', $evalList)) {
$inputId = uniqid('tceforms-datefield-');
- $cssClasses[] = 'tceforms-textfield tceforms-datefield';
+
+ $dateRange = '';
+ if ($config['range']['lower'] > 0 ) {
+ $dateRange .= ' lower-' . $config['range']['lower'];
+ }
+ if ($config['range']['upper'] > 0 ) {
+ $dateRange .= ' upper-' . $config['range']['upper'];
+ }
+
+ $cssClasses[] = 'tceforms-textfield tceforms-datefield' . $dateRange;
+
$fieldAppendix = t3lib_iconWorks::getSpriteIcon(
'actions-edit-pick-date',
array(
Index: t3lib/js/extjs/tceforms.js
--- t3lib/js/extjs/tceforms.js Base (BASE)
+++ t3lib/js/extjs/tceforms.js Locally Modified (Based On LOCAL)
@@ -45,10 +45,18 @@
var datepicker = element.next('span');
+ // check for daterange
+ var lowerMatch = element.dom.className.match(/lower-(\d+)\b/);
+ minDate = lowerMatch ? new Date(lowerMatch[1] * 1000) : null;
+ var upperMatch = element.dom.className.match(/upper-(\d+)\b/);
+ maxDate = upperMatch ? new Date(upperMatch[1] * 1000) : null;
+
var menu = new Ext.menu.DateMenu({
id: 'p' + element.dom.id,
format: format[index],
value: Date.parseDate(element.dom.value, format[index]),
+ minDate: minDate,
+ maxDate: maxDate,
handler: function(picker, date){
var relElement = Ext.getDom(picker.ownerCt.id.substring(1));
relElement.value = date.format(format[index]);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0016393c.patch
Type: application/octet-stream
Size: 1656 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101117/4c46cd01/attachment-0001.obj>
More information about the TYPO3-team-core
mailing list