0a98507d25338e585278a3a5cdcbbd341f2243d7
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Resources / Public / JavaScript / Wizard / Viewport / Left / Elements / Basic.js
1 Ext.namespace('TYPO3.Form.Wizard.Viewport.Left.Elements');
2
3 /**
4 * The basic elements in the elements tab on the left side
5 *
6 * @class TYPO3.Form.Wizard.Viewport.Left.Elements.Basic
7 * @extends TYPO3.Form.Wizard.Viewport.Left.Elements.ButtonGroup
8 */
9 TYPO3.Form.Wizard.Viewport.Left.Elements.Basic = Ext.extend(TYPO3.Form.Wizard.Viewport.Left.Elements.ButtonGroup, {
10 /**
11 * @cfg {String} id
12 * The unique id of this component (defaults to an auto-assigned id).
13 * You should assign an id if you need to be able to access the component
14 * later and you do not have an object reference available
15 * (e.g., using Ext.getCmp).
16 *
17 * Note that this id will also be used as the element id for the containing
18 * HTML element that is rendered to the page for this component.
19 * This allows you to write id-based CSS rules to style the specific
20 * instance of this component uniquely, and also to select sub-elements
21 * using this component's id as the parent.
22 */
23 id: 'formwizard-left-elements-basic',
24
25 /**
26 * @cfg {String} title
27 * The title text to be used as innerHTML (html tags are accepted) to
28 * display in the panel header (defaults to '').
29 */
30 title: TYPO3.lang.left_elements_basic,
31
32 /**
33 * Constructor
34 *
35 * Add the buttons to the accordion
36 */
37 initComponent: function() {
38 var allowedButtons = TYPO3.Form.Wizard.Settings.defaults.tabs.elements.accordions.basic.showButtons.split(/[, ]+/);
39 var buttons = [];
40
41 allowedButtons.each(function(option, index, length) {
42 switch (option) {
43 case 'button':
44 buttons.push({
45 text: TYPO3.lang.basic_button,
46 id: 'basic-button',
47 clickEvent: 'dblclick',
48 handler: this.onDoubleClick,
49 iconCls: 'formwizard-left-elements-basic-button',
50 scope: this
51 });
52 break;
53 case 'checkbox':
54 buttons.push({
55 text: TYPO3.lang.basic_checkbox,
56 id: 'basic-checkbox',
57 clickEvent: 'dblclick',
58 handler: this.onDoubleClick,
59 iconCls: 'formwizard-left-elements-basic-checkbox',
60 scope: this
61 });
62 break;
63 case 'fieldset':
64 buttons.push({
65 text: TYPO3.lang.basic_fieldset,
66 id: 'basic-fieldset',
67 clickEvent: 'dblclick',
68 handler: this.onDoubleClick,
69 iconCls: 'formwizard-left-elements-basic-fieldset',
70 scope: this
71 });
72 break;
73 case 'fileupload':
74 buttons.push({
75 text: TYPO3.lang.basic_fileupload,
76 id: 'basic-fileupload',
77 clickEvent: 'dblclick',
78 handler: this.onDoubleClick,
79 iconCls: 'formwizard-left-elements-basic-fileupload',
80 scope: this
81 });
82 break;
83 case 'hidden':
84 buttons.push({
85 text: TYPO3.lang.basic_hidden,
86 id: 'basic-hidden',
87 clickEvent: 'dblclick',
88 handler: this.onDoubleClick,
89 iconCls: 'formwizard-left-elements-basic-hidden',
90 scope: this
91 });
92 break;
93 case 'password':
94 buttons.push({
95 text: TYPO3.lang.basic_password,
96 id: 'basic-password',
97 clickEvent: 'dblclick',
98 handler: this.onDoubleClick,
99 iconCls: 'formwizard-left-elements-basic-password',
100 scope: this
101 });
102 break;
103 case 'radio':
104 buttons.push({
105 text: TYPO3.lang.basic_radio,
106 id: 'basic-radio',
107 clickEvent: 'dblclick',
108 handler: this.onDoubleClick,
109 iconCls: 'formwizard-left-elements-basic-radio',
110 scope: this
111 });
112 break;
113 case 'reset':
114 buttons.push({
115 text: TYPO3.lang.basic_reset,
116 id: 'basic-reset',
117 clickEvent: 'dblclick',
118 handler: this.onDoubleClick,
119 iconCls: 'formwizard-left-elements-basic-reset',
120 scope: this
121 });
122 break;
123 case 'select':
124 buttons.push({
125 text: TYPO3.lang.basic_select,
126 id: 'basic-select',
127 clickEvent: 'dblclick',
128 handler: this.onDoubleClick,
129 iconCls: 'formwizard-left-elements-basic-select',
130 scope: this
131 });
132 break;
133 case 'submit':
134 buttons.push({
135 text: TYPO3.lang.basic_submit,
136 id: 'basic-submit',
137 clickEvent: 'dblclick',
138 handler: this.onDoubleClick,
139 iconCls: 'formwizard-left-elements-basic-submit',
140 scope: this
141 });
142 break;
143 case 'textarea':
144 buttons.push({
145 text: TYPO3.lang.basic_textarea,
146 id: 'basic-textarea',
147 clickEvent: 'dblclick',
148 handler: this.onDoubleClick,
149 iconCls: 'formwizard-left-elements-basic-textarea',
150 scope: this
151 });
152 break;
153 case 'textline':
154 buttons.push({
155 text: TYPO3.lang.basic_textline,
156 id: 'basic-textline',
157 clickEvent: 'dblclick',
158 handler: this.onDoubleClick,
159 iconCls: 'formwizard-left-elements-basic-textline',
160 scope: this
161 });
162 break;
163 }
164 }, this);
165
166 var config = {
167 items: buttons
168 };
169
170 // apply config
171 Ext.apply(this, Ext.apply(this.initialConfig, config));
172
173 // call parent
174 TYPO3.Form.Wizard.Viewport.Left.Elements.Basic.superclass.initComponent.apply(this, arguments);
175 }
176 });
177
178 Ext.reg('typo3-form-wizard-viewport-left-elements-basic', TYPO3.Form.Wizard.Viewport.Left.Elements.Basic);