[FEATURE] Checkbox for confirmation in FormWizard 36/9136/5
authorFlorian Scholz <florian.scholz@hmmh.de>
Tue, 21 Feb 2012 15:00:41 +0000 (16:00 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 31 Mar 2013 20:09:51 +0000 (22:09 +0200)
Adds an extra BEHAVIOUR section to form tab with a
checkbox to control whether the confirmation page
should be shown.

Change-Id: Id58ad0f8fa7fbbd5470e9a87e5fe31098b777a13
Resolves: #28628
Releases: 6.1
Reviewed-on: https://review.typo3.org/9136
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/form/Classes/View/Wizard/WizardView.php
typo3/sysext/form/Configuration/PageTS/modWizards.ts
typo3/sysext/form/Resources/Private/Language/locallang_wizard.xlf
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form.js
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/Behaviour.js [new file with mode: 0644]

index 287c5fb..382a080 100644 (file)
@@ -208,6 +208,7 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
                        'Viewport/Left/Options/Forms/Validation/Required.js',
                        'Viewport/Left/Options/Forms/Validation/Uri.js',
                        'Viewport/Left/Form.js',
+                       'Viewport/Left/Form/Behaviour.js',
                        'Viewport/Left/Form/Attributes.js',
                        'Viewport/Left/Form/Prefix.js',
                        'Viewport/Left/Form/PostProcessor.js',
index ea09997..a1fbf38 100644 (file)
@@ -148,7 +148,7 @@ prefix = tx_form
                                        }
                                }
                                form {
-                                       showAccordions = prefix, attributes, postProcessor
+                                       showAccordions = behaviour, prefix, attributes, postProcessor
                                        accordions {
                                                attributes {
                                                        showProperties = accept, acceptcharset, action, class, dir, enctype, id, lang, method, name, style, title
index 92c67c0..58e9c6c 100644 (file)
                        <trans-unit id="form_prefix" xml:space="preserve">
                                <source>Prefix</source>
                        </trans-unit>
+                       <trans-unit id="form_behaviour" xml:space="preserve">
+                               <source>Behaviour</source>
+                       </trans-unit>
+                       <trans-unit id="behaviour_confirmation_page" xml:space="preserve">
+                               <source>Confirmation page</source>
+                       </trans-unit>
                        <trans-unit id="form_postprocessor" xml:space="preserve">
                                <source>Post Processors</source>
                        </trans-unit>
index 13a8888..5b884b5 100644 (file)
@@ -64,6 +64,7 @@ TYPO3.Form.Wizard.Viewport.Left.Form = Ext.extend(Ext.Panel, {
         * values
         */
        validAccordions: {
+               behaviour: true,
                prefix: true,
                attributes: true,
                postProcessor: true
@@ -109,6 +110,18 @@ TYPO3.Form.Wizard.Viewport.Left.Form = Ext.extend(Ext.Panel, {
                if (form) {
                        allowedAccordions.each(function(option, index, length) {
                                switch (option) {
+                                       case 'behaviour':
+                                               this.accordion.add({
+                                                       xtype: 'typo3-form-wizard-viewport-left-form-behaviour',
+                                                       element: form,
+                                                       listeners: {
+                                                               'validation': {
+                                                                       fn: this.validation,
+                                                                       scope: this
+                                                               }
+                                                       }
+                                               });
+                                               break;
                                        case 'prefix':
                                                this.accordion.add({
                                                        xtype: 'typo3-form-wizard-viewport-left-form-prefix',
diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/Behaviour.js b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/Behaviour.js
new file mode 100644 (file)
index 0000000..b846fba
--- /dev/null
@@ -0,0 +1,128 @@
+Ext.namespace('TYPO3.Form.Wizard.Viewport.Left.Form');
+
+/**
+ * The behaviour panel in the accordion of the form tab on the left side
+ *
+ * @class TYPO3.Form.Wizard.Viewport.Left.Form.Behaviour
+ * @extends Ext.Panel
+ */
+TYPO3.Form.Wizard.Viewport.Left.Form.Behaviour = Ext.extend(Ext.FormPanel, {
+       /**
+        * @cfg {String} id
+        * The unique id of this component (defaults to an auto-assigned id).
+        * You should assign an id if you need to be able to access the component
+        * later and you do not have an object reference available
+        * (e.g., using Ext.getCmp).
+        *
+        * Note that this id will also be used as the element id for the containing
+        * HTML element that is rendered to the page for this component.
+        * This allows you to write id-based CSS rules to style the specific
+        * instance of this component uniquely, and also to select sub-elements
+        * using this component's id as the parent.
+        */
+       id: 'formwizard-left-form-behaviour',
+
+       /**
+        * @cfg {String} title
+        * The title text to be used as innerHTML (html tags are accepted) to
+        * display in the panel header (defaults to '').
+        */
+       title: TYPO3.l10n.localize('form_behaviour'),
+
+       /**
+        * @cfg {String} defaultType
+        *
+        * The default xtype of child Components to create in this Container when
+        * a child item is specified as a raw configuration object,
+        * rather than as an instantiated Component.
+        *
+        * Defaults to 'panel', except Ext.menu.Menu which defaults to 'menuitem',
+        * and Ext.Toolbar and Ext.ButtonGroup which default to 'button'.
+        */
+       defaultType: 'textfield',
+
+       /**
+        * @cfg {Object} element
+        * The form component
+        */
+       element: null,
+
+       /**
+        * Constructor
+        *
+        * @param config
+        */
+       constructor: function(config){
+               // Call our superclass constructor to complete construction process.
+               TYPO3.Form.Wizard.Viewport.Left.Form.Behaviour.superclass.constructor.call(this, config);
+       },
+
+       /**
+        * Constructor
+        *
+        * Add the form elements to the tab
+        */
+       initComponent: function() {
+               var config = {
+                       items: [{
+                               xtype: 'fieldset',
+                               title: '',
+                               ref: 'fieldset',
+                               autoHeight: true,
+                               border: false,
+                               defaults: {
+                                       width: 150,
+                                       msgTarget: 'side'
+                               },
+                               defaultType: 'checkbox',
+                               items: [
+                                       {
+                                               fieldLabel: TYPO3.l10n.localize('behaviour_confirmation_page'),
+                                               name: 'confirmation',
+                                               listeners: {
+                                                       'check': {
+                                                               scope: this,
+                                                               fn: this.storeValue
+                                                       }
+                                               }
+                                       }
+                               ]
+                       }]
+               };
+
+               // Apply config
+               Ext.apply(this, Ext.apply(this.initialConfig, config));
+
+               // Call parent
+               TYPO3.Form.Wizard.Viewport.Left.Form.Behaviour.superclass.initComponent.apply(this, arguments);
+
+               // Fill the form with the configuration values
+               this.fillForm();
+       },
+
+
+       /**
+        * Store a changed value from the form in the element
+        *
+        * @param {Object} field The field which has changed
+        */
+       storeValue: function(field) {
+               var fieldName = field.getName();
+
+               var formConfiguration = {};
+               formConfiguration[fieldName] = field.getValue();
+
+               this.element.setConfigurationValue(formConfiguration);
+       },
+
+       /**
+        * Fill the form with the configuration of the element
+        *
+        * @return void
+        */
+       fillForm: function() {
+               this.getForm().setValues(this.element.configuration);
+       }
+});
+
+Ext.reg('typo3-form-wizard-viewport-left-form-behaviour', TYPO3.Form.Wizard.Viewport.Left.Form.Behaviour);
\ No newline at end of file