[TYPO3-mvc] Mootools Datepicker

Claus Due claus at wildside.dk
Mon Jun 20 17:05:47 CEST 2011


Hi Zalán,

Here's a suggestion in rough detail:

1) Create DatePickerViewHelper class which simply calls a special UserFunction for the "real" rendering
2) Create UserFunction (in Class...) which renders your Mootools DatePicker with initial values and configuration etc.
3) Add FlexForm/TCEForms "user" type and point to the user class wherever you want to use a DatePicker

The same class would be used to render the complete DatePicker and attach resources so you would have identical look and settings between FE and BE, if you wish. However, the renderer class would have to know the difference between BE and FE since script resources are attached differently. I suggest using a custom class method to add script files - this method could then determine how to include it depending on BE/FE. This would minimize your effort and let you concentrate on the best way to configure and render the DatePicker instead of struggling with resource files etc.

As a bonus, the same ViewHelper can be used in both FE and BE Extbase modules (if you are a bit careful about how you configure the HTML which is returned - in short, be mindful about field names). For record fields you would still need to use the TCEforms/FlexForm approach.

Mootools might conflict with parts of the FE/BE. It conflicts with jQuery unless compatibility is set. Perhaps someone else will know if it conflicts with the BE?

A practical example of a UserFunction FlexForm/TCEforms definition:
http://fedext.net/documentation/miscellaneous/t3editor-flexform-fields/

And this:
class Tx_Fed_Configuration_Wizard_FlexFormCodeEditor {
	public function renderField(&$parameters, &$pObj) {
		// $parameters contain the configuration and the configuration can be changed from within this method (due to reference &)
		// $pObj contains various settings about the context from which this method was called
		// for BE, scripts can be attached directly in the output body, for FE use additionalHeaderData...
		return $output;
	}
}

Remember ext_autoload.php registration of the renderer class or TCEform/FlexForm use of this class will fail.

If you are making ViewHelpers then FED could be a useful extension in general, although it does focus much on jQuery and ExtJS(4) and not at all on Mootools...

Cheers,
Claus


PS: hope you share the result ;). Sounds interesting with an advanced DatePicker for those cases where you need to set a DateTime and not just a Date...


On Jun 20, 2011, at 4:33 PM, Zalán Somogyváry wrote:

> Hi Stefan,
> 
> Am 19.06.2011 um 18:18 schrieb Stefan Neufeind:
> 
>>> I'm trying to write a extbase/Fluid DateViewHelper, which includes the Mootools-Datepicker [1]
> 
>> there is a slider-element in the works for backend-functionality and
>> it's already working great imho:
>> http://forge.typo3.org/issues/25315
> 
> Thanks for the link, but I need the picker for a fluid extension not for a backend form. I can't use TCEforms in a fluid extension, can I?
> 
>> Maybe that could be a basis for integrating an ExtJS datepicker for the
>> backend as well? We already have ExtJS in the backend anyway.
>> 
>> http://docs.sencha.com/ext-js/4-0/#/api/Ext.menu.DatePicker
> 
> 
> I've looked at the ExtJS DatePicker but this does not meet my needs. The Mootools Datepicker can enable time picking too (and that is a cool feature I need!) Another reason I would like to use Mootools is that I am not very familiar with ExtJS... Is there a way to replace ExtJS for my module?
> 
> Bye,
> Zalán Somogyváry
> 
> 
> 
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list