[BUGFIX] EXT:form - Wrong attribute handling for attributes in wizard 84/43884/6
authorSebastian Wagner <sebastian.wagner@tritum.de>
Wed, 7 Oct 2015 12:38:31 +0000 (14:38 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Oct 2015 16:20:28 +0000 (18:20 +0200)
Introduce ValueCheckbox to extend Checkbox that returns inputValue when
retrieving its value.

The xtype "typo3-form-wizard-valuecheckbox" is used for the following
attributes:
autofocus, checked, disabled, hidden, multiple, novalidate, readonly,
required and selected

The stored "TypoScript" contains inputValue and restores correct
checking when opening the wizard again.

Resolves: #70455
Releases: master
Change-Id: I6fce9a86b8c1c107c4776aa38ee3764ef7f90233
Reviewed-on: http://review.typo3.org/43884
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/form/Classes/View/Wizard/WizardView.php
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.form.ValueCheckbox.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Attributes.js

index 5374694..9e61801 100644 (file)
@@ -115,6 +115,7 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
                        'Ux/Ext.ux.spinner.js',
                        'Ux/Ext.ux.form.spinnerfield.js',
                        'Ux/Ext.ux.form.textfieldsubmit.js',
+                       'Ux/Ext.ux.form.ValueCheckbox.js', // required by Viewport/Left/Options/Forms/Attributes.js
                        'Ux/Ext.ux.grid.CheckColumn.js',
                        'Ux/Ext.ux.grid.SingleSelectCheckColumn.js',
                        'Ux/Ext.ux.grid.ItemDeleter.js',
diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.form.ValueCheckbox.js b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.form.ValueCheckbox.js
new file mode 100644 (file)
index 0000000..b40f821
--- /dev/null
@@ -0,0 +1,21 @@
+Ext.ns('Ext.ux.form');
+
+/**
+ * @class Ext.ux.form.ValueCheckbox
+ * @extends Ext.form.Checkbox
+ * getValue returns inputValue when checked
+ *
+ * @see TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes.initComponent
+ * @xtype typo3-form-wizard-valuecheckbox
+ */
+Ext.ux.form.ValueCheckbox = Ext.extend(Ext.form.Checkbox, {
+
+       getValue : function(){
+               var checked = Ext.ux.form.ValueCheckbox.superclass.getValue.call(this);
+               if(this.inputValue !== undefined && checked)
+                       return this.inputValue;
+               return checked;
+       }
+});
+
+Ext.reg('typo3-form-wizard-valuecheckbox', Ext.ux.form.ValueCheckbox);
index db2eb53..d4b7dc3 100644 (file)
@@ -151,7 +151,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'autofocus':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_autofocus'),
                                                name: 'autofocus',
                                                inputValue: 'autofocus',
@@ -165,7 +165,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'checked':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_checked'),
                                                name: 'checked',
                                                inputValue: 'checked',
@@ -276,7 +276,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'disabled':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_disabled'),
                                                name: 'disabled',
                                                inputValue: 'disabled',
@@ -376,7 +376,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'hidden':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_hidden'),
                                                name: 'hidden',
                                                inputValue: 'hidden',
@@ -561,7 +561,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'multiple':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_multiple'),
                                                name: 'multiple',
                                                inputValue: 'multiple',
@@ -588,7 +588,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'novalidate':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_novalidate'),
                                                name: 'novalidate',
                                                inputValue: 'novalidate',
@@ -626,7 +626,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'readonly':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_readonly'),
                                                name: 'readonly',
                                                inputValue: 'readonly',
@@ -640,7 +640,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'required':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_required'),
                                                name: 'required',
                                                inputValue: 'required',
@@ -672,7 +672,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                        break;
                                case 'selected':
                                        formItems.push({
-                                               xtype: 'checkbox',
+                                               xtype: 'typo3-form-wizard-valuecheckbox',
                                                fieldLabel: TYPO3.l10n.localize('attributes_selected'),
                                                name: 'selected',
                                                inputValue: 'selected',