![]() |
|
sfMooToolsFormExtraPlugin - 1.1.0Symfony widgets for use with the MooTools javascript framework |
|
![]() |
3
users
Sign-in
to change your status |
This plugin contains several widgets (and a validator) for use with the MooTools (http://mootools.net/) javascript framework. |
This symfony plugin contains several widgets (and a validator) for use with the MooTools javascript framework.
| Name | Status | |
|---|---|---|
|
|
lead | ku.oc.relloh <<ta>> retracoj |
|
|
developer | ku.em.rets <<ta>> cnalneb |
Copyright (c) 2011, Holler & Leo Burnett Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 1.3.0stable | MIT license | 1.0.0stable | 17/05/2012 |
| 1.2.0stable | MIT license | 1.0.0stable | 15/05/2012 |
| 1.1.0stable | MIT license | 1.0.0stable | 06/10/2011 |
| 1.0.1stable | MIT license | 1.0.0stable | 11/08/2011 |
| Version | License | API | Released |
|---|---|---|---|
| 1.3.0stable | MIT license | 1.0.0stable | 17/05/2012 |
| 1.2.0stable | MIT license | 1.0.0stable | 15/05/2012 |
| 1.1.0stable | MIT license | 1.0.0stable | 06/10/2011 |
| 1.0.1stable | MIT license | 1.0.0stable | 11/08/2011 |
| Version | License | API | Released |
|---|---|---|---|
| 1.3.0stable | MIT license | 1.0.0stable | 17/05/2012 |
| 1.2.0stable | MIT license | 1.0.0stable | 15/05/2012 |
| 1.1.0stable | MIT license | 1.0.0stable | 06/10/2011 |
| 1.0.1stable | MIT license | 1.0.0stable | 11/08/2011 |
Re-factored with a new base widget class for the date pickers, added option to include javascript with widget or in slot
Added Autocompleter widget
Added Colour Picker widget
Re-factored with a new base widget class for the date pickers, added option to include javascript with widget or in slot
Updating images in README to work on symfony website
This symfony plugin contains several widgets (and a validator) for use with the MooTools javascript framework.
All default configuration is controlled in plugins/sfMooToolsFormExtraPlugin/config/app.yml.
See Setup for publishing assets.
NOTE: Using custom fork of Mooditable for convenience.
NOTE: Using custom fork for Datepicker as file structure changed, also added 'datepicker_light' theme (default) with calendar icon - meshes better with symfony
If using SVN you will need to add these dependancies (custom forks) as svn:externals in the project's lib/vendor folder
(they cannot be added in the plugin, as the SVN bridge converts the existing submodules in Git to folders and svn:externals cannot override existing files)
Datepicker https://svn.github.com/angelsk/mootools-datepicker.git
MooEditable https://svn.github.com/angelsk/mooeditable.git
The plugin's lib/vendor folder contains submodules for the javascript libraries, if the repository is exported then these will also need to be exported in the appropriate place.
path = lib/vendor/MooEditable url = git://github.com/angelsk/mooeditable.git [submodule "lib/vendor/Datepicker"] path = lib/vendor/Datepicker url = git://github.com/angelsk/mootools-datepicker.git
Run ./symfony mootools:publish-assets after installation to ensure all the JavaScript and Stylesheet files are in place.
This plugin has a custom task due to symlinks in web being required from lib/vendor in the plugin or in the project, rather than just creating a symlink to the web/ folder as normal.
By default, the accompanying JavaScript to configure the widgets are placed inline with the inputs themselves, which may cause problems if your JavaScript files (especially MooTools Core/More) are included in the footer.
As such, each of the widgets accepts a use_slots option, which defaults to the boolean value set in app_datepicker_use_slots (false by default). When this is set to true (either in app.yml or in the forms' options), the accompanying JavaScript added to a slot named date_picker_js, which you should include in your template after JavaScript libraries are included, e.g.:
<?php
include_javascripts();
include_slot('date_picker_js');
?>
All of the widget initialision JavaScript is fired on domready, so the slot is also safe to include in the head.
If you have multiple date picker widgets, then the javascript is concatenated safely. If you’re adding the slot to your layout, you need to wrap it in a partial, because slots aren’t parsed in the layout.
An enhanced string validator which allows HTML strings to have a max length which doesn't include the tags (especially useful if the character limit is for display purposes). Adds an extra dynamic option to the validator message to tell the user how many characters they have actually used, to make it easier to reduce. Can be used in conjunction with other validators.
sfValidatorString so all options and messages for that are used%current_length% to the options for the validator messages
Default implementation:
$this->validatorSchema['text'] = new sfEnhancedValidatorString(array('max_length'=>200),
array('max_length'=>'Content is too long (%current_length% characters), please limit to %max_length% characters'));
A configurable rich text editor widget, which includes (turned on by default) a clean paste from Word
config: Additional MooEditable configurationwidth: The width of the editable areaheight: The height of the editable areaextratoolbar: Any additional toolbar options - include | to separate
Default implementation:
$this->widgetSchema['text'] = new sfWidgetFormTextareaMooEditable();
A date picker with the calendar control appearing when the user clicks on the input box to enter the date
en-GB), and location of locale files - must include all locales if local fileslocale: if this is changed from the default, will require additional JS locale filesdate_format: The JavaScript format of the date in the input box (defaults to %Y-%m-%d - see below) - see MooTools Date Format.
If this is changed should be paired with appropriate sfValidatorDate and regex - see Example usage.
Ensure includes time if below option is 'true'
php_date_format: If the date_format for display is changed to a more user friendly format than %Y-%m-%d - the value needs to be converted from the database format.
This field should contain the corresponding PHP date_format for use with date() - see PHP Date Format
with_time: defaults to 'false', include time in the date picker (date format defaults to %Y-%m-%d %H:%i instead of %Y-%m-%d)
true', click on the month name twice to select year - if date range restricted within one year then set to 'false'
Just date:
$this->widgetSchema['date'] = new sfWidgetFormInputDateTimeMooPicker();
Date with min and max:
$minDate = '2006-01-01';
$maxDate = (date('Y') + 1) . '-12-31';
$this->widgetSchema['date'] = new sfWidgetFormInputDateTimeMooPicker(array('min_date'=>$minDate, 'max_date'=>$maxDate));
With time:
$this->widgetSchema['date'] = new sfWidgetFormInputDateTimeMooPicker(array('with_time'=>'true'));
With a different date format:
$regex = '~(?P<day>\d{2})/(?P<month>\d{2})/(?P<year>\d{4})~';
$date_format = '%d/%m/%Y';
$php_date_format = 'd/m/Y';
$this->widgetSchema['date'] = new sfWidgetFormInputDateTimeMooPicker(array('date_format'=>$date_format, 'php_date_format'=>$php_date_format));
$this->validatorSchema['date'] = new sfValidatorDate(array('date_format'=>$regex));
A date picker with the calendar control appearing when the user clicks on the calendar image.
en-GB), and location of locale files - must include all locales if moved(date):
locale: if this is changed from the default, will require additional JS locale filesyear_picker: defaults to 'true', click on the month name twice to select year - if date range restricted within one year then set to 'false'min_date: default is none, set to restrict date range (format: Y-m-d)max_date: default is none, set to restrict date range (format: Y-m-d)date_widget: The date widget to render with the calendar(datetime):
locale: if this is changed from the default, will require additional JS locale filesyear_picker: defaults to 'true', click on the month name twice to select year - if date range restricted within one year then set to 'false'min_date: default is none, set to restrict date range (format: Y-m-d)max_date: default is none, set to restrict date range (format: Y-m-d)date_time_widget: The datetime widget to render with the calendar
Just date:
$this->widgetSchema['date'] = new sfWidgetFormDateMooPicker();
Date with min and max and customised date widget:
$years = range(2006, (date('Y') + 1));
$minDate = '2006-01-01';
$maxDate = (date('Y') + 1) . '-12-31';
$this->widgetSchema['date'] = new sfWidgetFormDateMooPicker(array('min_date'=>$minDate, 'max_date'=>$maxDate,
'date_widget'=>new sfWidgetFormDate(array('years'=>array_combine($years, $years),
'format'=>'%day% %month% %year%'))));
With time:
$this->widgetSchema['date'] = new sfWidgetFormDateTimeMooPicker();

Customised datetime widget:
$years = range(2006, (date('Y') + 1));
$minDate = '2006-01-01';
$maxDate = (date('Y') + 1) . '-12-31';
$this->widgetSchema['date'] = new sfWidgetFormDateTimeMooPicker(array('min_date'=>$minDate, 'max_date'=>$maxDate,
'date_time_widget'=>new sfWidgetFormDateTime(array('date' => array('years'=>array_combine($years, $years),
'format'=>'%day% %month% %year%'),
'time'=> array('format'=>'%hour% %minute%')))));
By default, the accompanying JavaScript to configure the widgets are placed inline with the inputs themselves, which may cause problems if your JavaScript files (especially MooTools Core/More) are included in the footer.
As such, each of the widgets accepts a use_slots option, which defaults to the boolean value set in app_datepicker_use_slots (false by default). When this is set to true (either in app.yml or in the forms' options), the accompanying JavaScript added to a slot named date_picker_js, which you should include in your template after JavaScript libraries are included, e.g.:
<?php
include_javascripts();
include_slot('date_picker_js');
?>
All of the widget initialision JavaScript is fired on domready, so the slot is also safe to include in the head.
If you have multiple date picker widgets, then the javascript is concatenated safely. If you’re adding the slot to your layout, you need to wrap it in a partial, because slots aren’t parsed in the layout.
