Author: KRavEN
Date: 2010-05-13 18:39:19 +0200 (Thu, 13 May 2010)
New Revision: 29436
Modified:
plugins/ExtjsGeneratorPlugin/trunk/lib/generator/ExtjsGenerator.class.php
plugins/ExtjsGeneratorPlugin/trunk/lib/widget/ExtjsWidgetFormDateTime.class.php
plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinComboBox.js
plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinDateField.js
Log:
Fixed bugs with dates on forms and filters. Fixed bug with date widget and
combo widget clear button working when disabled.
Modified:
plugins/ExtjsGeneratorPlugin/trunk/lib/generator/ExtjsGenerator.class.php
===================================================================
--- plugins/ExtjsGeneratorPlugin/trunk/lib/generator/ExtjsGenerator.class.php
2010-05-13 12:27:14 UTC (rev 29435)
+++ plugins/ExtjsGeneratorPlugin/trunk/lib/generator/ExtjsGenerator.class.php
2010-05-13 16:39:19 UTC (rev 29436)
@@ -100,12 +100,13 @@
$fieldArr = array(
'name' => $field->getName(),
'type' => $field->getReaderFieldType()
- );
+ );
if(isset($form))
{
$fieldArr['mapping'] = $field->getName();
$fieldArr['name'] =
sprintf($form[$field->getName()]->getParent()->getWidget()->getNameFormat(),
$field->getName());
+ if($fieldArr['type']=='date') $fieldArr['dateFormat'] = 'Y-m-d H:i:s';
}
return sprintf("\$readerFields[] = %s", $this->asPhp($fieldArr));
Modified:
plugins/ExtjsGeneratorPlugin/trunk/lib/widget/ExtjsWidgetFormDateTime.class.php
===================================================================
---
plugins/ExtjsGeneratorPlugin/trunk/lib/widget/ExtjsWidgetFormDateTime.class.php
2010-05-13 12:27:14 UTC (rev 29435)
+++
plugins/ExtjsGeneratorPlugin/trunk/lib/widget/ExtjsWidgetFormDateTime.class.php
2010-05-13 16:39:19 UTC (rev 29436)
@@ -18,6 +18,7 @@
*/
class ExtjsWidgetFormDateTime extends ExtjsWidgetForm
{
+
/**
* Configures the current widget.
*
@@ -28,10 +29,10 @@
*
* Available options:
*
- * * date: Options for the date widget (see sfWidgetFormDate)
- * * time: Options for the time widget (see sfWidgetFormTime)
- * * with_time: Whether to include time (true by default)
- * * format: The format string for the date and the time widget (default
to %date% %time%)
+ * * date: Options for the date widget (see sfWidgetFormDate)
+ * * time: Options for the time widget (see sfWidgetFormTime)
+ * * with_time: Whether to include time (true by default)
+ * * format: The format string for the date and the time widget (default
to %date% %time%)
*
* @param array $options An array of options
* @param array $attributes An array of default HTML attributes
@@ -58,75 +59,21 @@
*/
function render($name, $value = null, $attributes = array(), $errors =
array())
{
- $date = $this->getDateWidget($attributes)->render($name, $value);
-
- if (!$this->getOption('with_time'))
- {
- return $date;
- }
-
- return strtr($this->getOption('format'), array(
- '%date%' => $date,
- '%time%' => $this->getTimeWidget($attributes)->render($name, $value),
- ));
+ return $this->renderExtjsContentBlock('form', 'TwinDateField',
array_merge(array(
+ 'name' => $name,
+ 'value' => $value,
+ ), $attributes));
+
+// $date = $this->getDateWidget($attributes)->render($name, $value);
+//
+// if(! $this->getOption('with_time'))
+// {
+// return $date;
+// }
+//
+// return strtr($this->getOption('format'), array(
+// '%date%' => $date,
+// '%time%' => $this->getTimeWidget($attributes)->render($name, $value)
+// ));
}
-
- /**
- * Returns the date widget.
- *
- * @param array $attributes An array of attributes
- *
- * @return sfWidgetForm A Widget representing the date
- */
- protected function getDateWidget($attributes = array())
- {
- return new sfWidgetFormDate($this->getOptionsFor('date'),
$this->getAttributesFor('date', $attributes));
- }
-
- /**
- * Returns the time widget.
- *
- * @param array $attributes An array of attributes
- *
- * @return sfWidgetForm A Widget representing the time
- */
- protected function getTimeWidget($attributes = array())
- {
- return new sfWidgetFormTime($this->getOptionsFor('time'),
$this->getAttributesFor('time', $attributes));
- }
-
- /**
- * Returns an array of options for the given type.
- *
- * @param string $type The type (date or time)
- *
- * @return array An array of options
- *
- * @throws InvalidArgumentException when option date|time type is not array
- */
- protected function getOptionsFor($type)
- {
- $options = $this->getOption($type);
- if (!is_array($options))
- {
- throw new InvalidArgumentException(sprintf('You must pass an array for
the %s option.', $type));
- }
-
- return $options;
- }
-
- /**
- * Returns an array of HTML attributes for the given type.
- *
- * @param string $type The type (date or time)
- * @param array $attributes An array of attributes
- *
- * @return array An array of HTML attributes
- */
- protected function getAttributesFor($type, $attributes)
- {
- $defaults = isset($this->attributes[$type]) ? $this->attributes[$type] :
array();
-
- return isset($attributes[$type]) ? array_merge($defaults,
$attributes[$type]) : $defaults;
- }
}
Modified: plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinComboBox.js
===================================================================
--- plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinComboBox.js
2010-05-13 12:27:14 UTC (rev 29435)
+++ plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinComboBox.js
2010-05-13 16:39:19 UTC (rev 29436)
@@ -132,13 +132,15 @@
},
onTrigger1Click : function() {
- this.clearValue();
- this.triggers[0].hide();
- if (this.submitOnClear && this.ownerCt && this.ownerCt.buttons) {
- this.ownerCt.buttons[0].handler.call(this.ownerCt);
- }
- this.el.dom.qtip = null;
- this.fireEvent('clear', this);
+ if(!this.disabled) {
+ this.clearValue();
+ this.triggers[0].hide();
+ if (this.submitOnClear && this.ownerCt && this.ownerCt.buttons) {
+ this.ownerCt.buttons[0].handler.call(this.ownerCt);
+ }
+ this.el.dom.qtip = null;
+ this.fireEvent('clear', this);
+ }
}
});
Ext.ComponentMgr.registerType('twincombo', Ext.ux.form.TwinComboBox);
\ No newline at end of file
Modified: plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinDateField.js
===================================================================
--- plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinDateField.js
2010-05-13 12:27:14 UTC (rev 29435)
+++ plugins/ExtjsGeneratorPlugin/trunk/web/js/Ext.ux.form.TwinDateField.js
2010-05-13 16:39:19 UTC (rev 29436)
@@ -1,14 +1,15 @@
Ext.namespace('Ext.ux.form');
Ext.ux.form.TwinDateField = Ext.extend(Ext.form.DateField, {
- submitOnSelect: true,
- submitOnClear: true,
+ submitOnSelect : true,
+ submitOnClear : true,
initComponent : function() {
Ext.ux.form.TwinDateField.superclass.initComponent.call(this);
this.triggerConfig = {
tag : 'span',
cls : 'x-form-twin-triggers',
- cn : [{
+ cn : [
+ {
tag : 'img',
src : Ext.BLANK_IMAGE_URL,
cls : 'x-form-trigger ' + this.trigger1Class
@@ -16,7 +17,8 @@
tag : 'img',
src : Ext.BLANK_IMAGE_URL,
cls : 'x-form-trigger ' + this.trigger2Class
- }]
+ }
+ ]
};
this.addEvents('valuechange');
},
@@ -25,10 +27,10 @@
Ext.ux.form.TwinDateField.superclass.initEvents.call(this);
this.on({
- 'select' : {
+ 'select' : {
fn : function() {
if (this.value && this.ownerCt && this.ownerCt.buttons &&
this.submitOnSelect) {
- this.ownerCt.buttons[0].handler();
+ this.ownerCt.buttons[0].handler.call(this.ownerCt);
}
},
scope : this
@@ -52,6 +54,7 @@
hideTrigger1 : true,
reset : Ext.form.Field.prototype.reset.createSequence(function() {
+ this.setValue(null);
this.triggers[0].hide();
}),
@@ -60,12 +63,14 @@
},
onTrigger1Click : function() {
- this.clearValue();
- this.triggers[0].hide();
- if (this.ownerCt && this.ownerCt.buttons && this.submitOnClear) {
- this.ownerCt.buttons[0].handler();
- }
- this.fireEvent('clear', this);
+ if(!this.disabled) {
+ this.clearValue();
+ this.triggers[0].hide();
+ if (this.ownerCt && this.ownerCt.buttons && this.submitOnClear) {
+ this.ownerCt.buttons[0].handler.call(this.ownerCt);
+ }
+ this.fireEvent('clear', this);
+ }
},
/**
@@ -80,10 +85,14 @@
this.applyEmptyText();
this.value = '';
},
- setValue : function(date) {
- Ext.form.DateField.superclass.setValue.call(this,
this.formatDate(this.parseDate(date)));
- this.fireEvent('valuechange', this);
- }
+
+ setValue : Ext.form.DateField.prototype.setValue.createSequence(function(v) {
+ if (v !== null && v != '') {
+ this.triggers[0].show();
+ } else {
+ this.triggers[0].hide();
+ }
+ })
});
Ext.ComponentMgr.registerType('twindatefield', Ext.ux.form.TwinDateField);
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.