Index.rst 158 KB
Newer Older
Carsten  Rose's avatar
Carsten Rose committed
1
.. ==================================================
2
3
4
5
6
7
8
9
10
11
12
13
.. FOR YOUR INFORMATION
.. --------------------------------------------------
.. -*- coding: utf-8 -*- with BOM.

.. include:: ../Includes.txt


.. _users-manual:

Users manual
============

Carsten  Rose's avatar
Carsten Rose committed
14
The QFQ extension is activated through tt-content records. One or more tt-content records per page are necessary to render
15
*forms*, *reports* (exports) or to perform *delete* and *save* commands submitted by a QFQ form.
16
17


18
Features not implemented yet
19
20
21
----------------------------

* Multi Forms
22
23
24
25

QFQ content element
-------------------

26
QFQ is used by configuring Typo3 content elements. Insert one or more QFQ content elements on a Typo3 page.
27
28
29
30
31
32
33
34
Specify column and language per content record as wished.

The title of the QFQ content element will not be rendered. It's only visible in the backend for orientation.


QFQ Keywords (Bodytext)
^^^^^^^^^^^^^^^^^^^^^^^

35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 +-------------------+---------------------------------------------------------------------------------+
 | Name              | Explanation                                                                     |
 +===================+=================================================================================+
 | form              | Formname defined in ttcontent record bodytext                                   |
 |                   | * Fix. E.g.: **form = person**                                                  |
 |                   | * by SIP: **form = {{form}}**                                                   |
 |                   | * by SQL: **form = {{SELECT c.form FROM conference AS c WHERE c.id={{a:C}} }}** |
 +-------------------+---------------------------------------------------------------------------------+
 | r                 | recordId. If specified, the form will load the record with the specified id     |
 |                   | * Fix. E.g.: **r = 123**, by SQL: **r = {{SELECT ...}}**                        |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.db        | Select a DB. Only necessary if a different than the standard DB should be used. |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.fbeg      | Start token for every field (=column)                                           |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.fend      | End token for every field (=column)                                             |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.head      | Start token for whole <level>                                                   |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.tail      | End token for whole <level>                                                     |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rbeg      | Start token for row.                                                            |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rbgd      | Alternating (per row) token                                                     |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rend      | End token for row. Will be rendered **before** subsequent levels are processed  |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.renr      | End token for row. Will be rendered **after** subsequent levels are processed   |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rsep      | Seperator token between rows                                                    |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.fsep      | Seperator token between fields (=columns)                                       |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.sql       | SQL Query                                                                       |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.althead   | If <level>.sql is empty, these token will be rendered                           |
 +-------------------+---------------------------------------------------------------------------------+
73
 | debugShowBodyText | If ='1' and config.ini:*showDebugInfo=yes*: shows a tooltip with bodytext       |
74
 +-------------------+---------------------------------------------------------------------------------+
75

76
77
.. _debug:

78
79
80
81
82
Debug
^^^^^

* config.ini: *SHOW_DEBUG_INFO = yes|no|auto*

83
84
85
86
87
88
  * *yes*:

    * Form:

      * For every internal link/button, show tooltips with decoded SIP on mouseover.
      * Shows 'Edit form' (wrench symbol) button on a form.
89

90
    * Report: Will be configured per tt-content record.
91

92
      *debugShowBodyText = 1*
93

94
  * *no*: No debug info.
95

96
  * *auto*: Depending if there is a Typo3 BE session, set internally:
97

98
99
    * *SHOW_DEBUG_INFO = yes*  (BE session exist)
    * *SHOW_DEBUG_INFO = no*   (no BE session)
Carsten  Rose's avatar
Carsten Rose committed
100
101
102
103

Form
----

104
* Forms will be created by using the *Form editor* (HTML form). The Formeditor itself consist of two regular QFQ forms: *form* and *formElement*
105
106
107
108
* Every form consist of a) a *Form* record and b) multiple *FormElement* records.
* A form is assigned to a  *table*. Such a table is called the *primary table* for this form.
* There are three types of forms:

109
  * *Simple* form: the form acts on one record, stored in one table.
110

111
    * The form will create necessary SQL commands for insert, update and delete automatically.
112

113
  * *Advanced* form: the form acts on one record, stored in more than one table.
114

115
    * Fields of the primary table acts like a *simple* form, all other fields have to be specified with *addNupdate* records.
116

117
  * *Multi* form: the form acts simultanously on more than one record. All records use the same *FormElements*.
118

119
120
    * The *FormElements* are defined as a regular *simple* / or *advanced* form, plus a SQL Query, which selects and
      iterates over all records. Those records will be loaded at the same time.
Carsten  Rose's avatar
Carsten Rose committed
121

122
.. _variables:
Carsten  Rose's avatar
Carsten Rose committed
123

124
125
Variable (incl. mixed SQL Statement)
------------------------------------
Carsten  Rose's avatar
Carsten Rose committed
126
127

Most fields of a form specification might contain:
128

Carsten  Rose's avatar
Carsten Rose committed
129
130
131
132
133
* ''constants'' (=strings), this is the standard use case.
* ''variables'' retrieved from the stores (see below),
* ''SQL statements'' (limited set of),
* or any combination of the above.

134
* A variable (or SQL) statement is surrounded by curly braces:
Carsten  Rose's avatar
Carsten Rose committed
135

136
  *{{VarName[:<store / prio>[:<sanitize class>[:<escape>]]]}}*
Carsten  Rose's avatar
Carsten Rose committed
137
138
139

* Example:

140
  *{{r}}*
Carsten  Rose's avatar
Carsten Rose committed
141

142
143
144
145
  *{{index:FS}}*

  *{{name:FS:alnumx:s}}*

146
  *{{SELECT name FROM person WHERE id=1234}}*
Carsten  Rose's avatar
Carsten Rose committed
147

148
  *{{SELECT name FROM person WHERE id={{r}} }}*
Carsten  Rose's avatar
Carsten Rose committed
149

150
  *{{SELECT name FROM person WHERE id={{key1:C:alnumx}} }}*
Carsten  Rose's avatar
Carsten Rose committed
151

152
* Leading and trailing spaces inside curly braces are removed.
Carsten  Rose's avatar
Carsten Rose committed
153

154
155
  * *{{ SELECT "Hello World"   }}* acts as *{{SELECT "Hello World"}}*
  * *{{ varname   }}* acts as *{{varname}}*
Carsten  Rose's avatar
Carsten Rose committed
156

157

158
159
* There are several stores, from where to retrieve the value. If a value is not found in one store, the next store is searched,
  until a value is found or there are no more stores available.
160
* If anywhere along the line an empty string is found, this **is** a value: therefore, the search will stop.
Carsten  Rose's avatar
Carsten Rose committed
161
162
163
164
165
* If no value is found, the value is an <empty string>.

URL Parameter
-------------

166
* URL (=GET) Parameter can be used in *forms* and *reports* as variables.
167
168
169
170
171
172
173
174
175
176
177
178
179
180
* If a value violates a parameter sanitize class, the value becomes an empty string.

Escape
------

* Variables used in SQL Statements might cause trouble, if they contain single or double ticks.
* Escaping of single or double is defined by the parameter <escape> (fourth parameter):

  * 's' - single ticks will be escaped.
  * 'd' - double ticks will be escaped.

* It's not possible to escape single and double ticks at the same time.
* Which of them to escape (single or double) depends on the surrounding SQL query.
* Escaping is only necessary inside of SQL queries.
Carsten  Rose's avatar
Carsten Rose committed
181
182
183
184

Sanitize class
--------------

185
186
187
188
189
190
* All values in Store *C* (Client) and store *F* (Form) will be sanitized:
* All :ref:`predefined-variable-names` have a specific default sanitize class. For these variables, it's not necessary
  to specify a sanitize class.
* All other variables (Store: C, F) get by default the sanitize class defined in the corresponding form. If not defined
  the default class is 'digit'.
* A default sanitize class can be overwritten by individual definition: *{{a:C:all}}*
Carsten  Rose's avatar
Carsten Rose committed
191

192
  * **alnumx**: [A-Za-z][0-9]@-_.,;: /()
Carsten  Rose's avatar
Carsten Rose committed
193
  * **digit**: [0-9].-+
194
195
196
197
  * **email**: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
  * **min|max**: only usable in forms. Compares the value against an lower and upper limit (numeric or string).
  * **min|max date**:  only usable in forms. Compares the value against an lower and upper date or datetime.
  * **pattern**:  only usable in forms. Compares the value against a regexp.
198
  * **allbut**: all characters allowed, but not [ ]  { } % & \ #. The used regexp: '^[^\[\]{}%&\\#]+$',
Carsten  Rose's avatar
Carsten Rose committed
199
200
201
202
203
204
  * **all**: no sanitizing


Store / prio
------------

205
206
207
208
209
210
211
212
213
214
215
216
217
218
Only variables that are known in a specified store can be substituted.

 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 |Name |Description                                                                             | Content                                                                    |
 +=====+========================================================================================+============================================================================+
 | F   | Form: data not saved in database yet.                                                  | All native form elements. Recent values from the Browser.                  |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | S   | SIP: Client parameter 's' will indicate the current SIP, which will be loaded from the | sip, r (record_id), form                                                   |
 |     | SESSION repo to the SIP-Store.                                                         |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | R   | Record - the record that is going to be edited. For new records: empty.                | All columns of the current record from the current table                   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | P   | Parent record. E.g.: on multi forms the current record of the outer query              | All columns of the MultiSQL Statement from the table for the current row   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
219
 | D   | Default values column : The *table.column* specified *default value*.                  |                                                                            |
220
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
221
 | M   | Column type: The *table.column* specified *type*                                       |                                                                            |
222
223
224
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | C   | Client: POST variable, if not found: GET variable                                      | Parameter sent from the Client (=Browser).                                 |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
225
 | T   | Typo3: a) Bodytext (ttcontent record), b) Typo3 internal variables like feUser, ...    | See Typo3 tt_content record configuration                                  |
226
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
227
228
 | V   | Vars - Generic variables                                                               |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
229
230
231
232
233
 | 0   | Zero - allways value: 0, might be helpful if a variable is empty or undefined and will | All possible keys                                                          |
 |     | be used in an SQL statement.                                                           |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | E   | Empty - allways value: 0, might be helpful if a variable is empty or undefined and will| All possible keys                                                          |
 |     | be used in an SQL statement                                                            |                                                                            |
234
235
236
237
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | Y   | System: a) Database credentials, b) helper vars for logging/debugging:                 |                                                                            |
 |     | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN                                          |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
238

239
* Default *<prio>*: *FSRD* - Form / SIP / Record / Table definition.
Carsten  Rose's avatar
Carsten Rose committed
240
241
* Hint: Preferable, parameter should be submitted by SIP, not by Client (=URL).

242
243
244
  * Warning: Data submitted via 'Client' can be easily spoofed and altered.
  * Best: Data submitted via SIP never leaves the server, cannot be spoofed or altered by the user.
  * SIPs can _only_ be defined by using *Report*. Inside of *Report* use columns 'Link' (with attribute 's'), 'page?' or 'Page?'.
Carsten  Rose's avatar
Carsten Rose committed
245
246
247
248
249
250

.. _predefined-variable-names:

Predefined variable names
-------------------------

251
Store: *CLIENT* - C
Carsten  Rose's avatar
Carsten Rose committed
252
253
254
255
256
257
258
259
260
261
262
^^^^^^^^^^^^^^^^^^^

 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | Name          | Explanation                                                                                                                              |
 +===============+==========================================================================================================================================+
 | s             | =SIP                                                                                                                                     |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | r             | record id. Typically stored in SIP, rarely specified on the URL                                                                          |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | keySemId      | always current Semester Id                                                                                                               |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
263
 | keySemIdUser  | *{{keySemIdUser}}*, may be changed by user                                                                                               |
Carsten  Rose's avatar
Carsten Rose committed
264
265
266
267
268
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | HTTP_HOST     | current HTTP HOST                                                                                                                        |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | REMOTE_ADDR   | Client IP address                                                                                                                        |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
269
 | '$_SERVER[*]' | All other variables accessable by *$_SERVER[]*. Only the often used have a pre-defined sanitize class.                                   |
Carsten  Rose's avatar
Carsten Rose committed
270
271
272
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | form          | Unique name of current form                                                                                                              |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
273
 | ANREDE        | *{{sex}}* == male >> Sehr geehrter Herr, *{{sex}}* == female  Sehr geehrte Frau                                                          |
Carsten  Rose's avatar
Carsten Rose committed
274
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
275
 | EANREDE       | *{{sex}}* == male >> Dear Mr., *{{sex}}* == female >> Dear Mrs.                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
276
277
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+

278
Store: *TYPO3* (Bodytext) - T
Carsten  Rose's avatar
Carsten Rose committed
279
280
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Carsten  Rose's avatar
Carsten Rose committed
281
282
283
284
 +---------------+-------------------------------------------------------------------+
 | Name          | Explanation                                                       |
 +===============+===================================================================+
 | form          | Formname defined in ttcontent record bodytext                     |
285
 |               |                                                                   |
286
287
 |               | * Fix. E.g. *form = person*                                       |
 |               | * via SIP. E.g. *form = {{form}}*                                 |
Carsten  Rose's avatar
Carsten Rose committed
288
 +---------------+-------------------------------------------------------------------+
289
 | pageId        | Record id of current Typo3 page                                   |
290
 +---------------+-------------------------------------------------------------------+
291
 | pageType      | Current selected page type (typically URL parameter 'type')       |
Carsten  Rose's avatar
Carsten Rose committed
292
 +---------------+-------------------------------------------------------------------+
293
 | pageLanguage  | Current selected page language (typically URL parameter 'L')      |
Carsten  Rose's avatar
Carsten Rose committed
294
 +---------------+-------------------------------------------------------------------+
295
 | ttcontentUid  | Record id of current Typo3 content element                        |
Carsten  Rose's avatar
Carsten Rose committed
296
 +---------------+-------------------------------------------------------------------+
297
298
299
300
301
 | feUser        | Logged in Typo3 FE User                                           |
 +---------------+-------------------------------------------------------------------+
 | feUserUid     | Logged in Typo3 FE User uid                                       |
 +---------------+-------------------------------------------------------------------+
 | feUserGroup   | FE groups of logged in Typo3 FE User                              |
302
303
 +---------------+-------------------------------------------------------------------+

Carsten  Rose's avatar
Carsten Rose committed
304

305
Store: *FORM* - F
Carsten  Rose's avatar
Carsten Rose committed
306
307
308
309
310
311
^^^^^^^^^^^^^^^^^
* Represents the values in the form, typically before saving them.
* Used for:

  * Formelements who will be rerendered, after a parent element has been changed by the user.
  * Formelement actions, before saving the form.
312
  * Values will be sanatized by the class configured in corresponding the formelement. By default, the sanitize class is `alnumx`.
Carsten  Rose's avatar
Carsten Rose committed
313
314
315
316

 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name               | Explanation                                                                                                                                |
 +====================+============================================================================================================================================+
317
 | FormElement name   | Name of native formelement. To get, exactly and only, the specified form element (for 'p_id'): *{{p_id:F}}*                                |
Carsten  Rose's avatar
Carsten Rose committed
318
319
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+

320
Store: *RECORD* - R
Carsten  Rose's avatar
Carsten Rose committed
321
322
323
324
^^^^^^^^^^^^^^^^^^^
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name               | Explanation                                                                                                                                |
 +====================+============================================================================================================================================+
325
 | record column name | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form element: *{{p_id:R}}* |
Carsten  Rose's avatar
Carsten Rose committed
326
327
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+

328
329
330
331
332
333
334
335
Store: *VARS* - V
^^^^^^^^^^^^^^^^^

 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name               | Explanation                                                                                                                                |
 +====================+============================================================================================================================================+
 | random             | random string with length of 32 chars, alphanum                                                                                            |
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
336
337
 | slaveId            | see FormElement `action`                                                                                                                   |
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
338

Carsten  Rose's avatar
Carsten Rose committed
339
340
341
SQL
---

342
* The detection of an SQL command is case *insensitive*.
343
* Leading  whitespace will be skipped.
344
* The following commands are interpreted as SQL commands:
Carsten  Rose's avatar
Carsten Rose committed
345

346
  * SELECT
347
348
  * INSERT, UPDATE, DELETE, REPLACE, TRUNCATE
  * SHOW, DESCRIBE, EXPLAIN, SET
Carsten  Rose's avatar
Carsten Rose committed
349

350
* A SQL Statement might contain parameters, including additional SQL statements. Inner SQL queries will be executed first.
Carsten  Rose's avatar
Carsten Rose committed
351
* All variables will be substituted one by one from inner to outer.
352
* Maximum recursion depth: 5 (a recursion depth of 2 is sometimes used for mailing with templates, 3 and more probably confuses too much and is therefore not practicable, but supported until depth of 5)
Carsten  Rose's avatar
Carsten Rose committed
353
* The number of variables inside an input field or a SQL statement is not limited.
354
* A resultset of a SQL statement will be imploded over all: concat all columns of a row, concat all rows - there is no glue string.
Carsten  Rose's avatar
Carsten Rose committed
355

356
* Example::
Carsten  Rose's avatar
Carsten Rose committed
357

358
  {{SELECT id, name FROM Person}}
359
360
  {{SELECT id, name, IF({{feUser}}=0,'Yes','No')  FROM Vorlesung WHERE sem_id={{keySemId:Y}} }}
  {{SELECT id, city FROM Address AS adr WHERE adr.p_id={{SELECT id FROM Account AS acc WHERE acc.name={{feUser}} }} }}
361
362
363
364
365

* Special case for SELECT input fields. To deliver a result array specify an '!' before the SELECT:

  *{{!SELECT ...}}*

366
  * This is only possible for the outermost SELECT.
367
368
369

Form: basic setup
-----------------
Carsten  Rose's avatar
Carsten Rose committed
370
371

+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
372
| Name                   | Type                                                     | Description                                                                             |
Carsten  Rose's avatar
Carsten Rose committed
373
374
375
376
377
+========================+==========================================================+=========================================================================================+
|id                      | int, autoincrement                                       | created by by MySQL                                                                     |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|name                    | string                                                   | unique and speaking name of the form. Form will be identified by this name              |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
378
|title                   | string                                                   | Title, shown on/above the form.                                                         |
Carsten  Rose's avatar
Carsten Rose committed
379
380
381
382
383
384
385
386
387
388
389
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|noteInternal            | textarea                                                 | Internal notes: special functionality, used variables, ...                              |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|tableName               | string                                                   | Primay table of the form                                                                |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|permitNew               | enum('sip', 'logged_in', 'logged_out', 'always', 'never')| Default: sip                                                                            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|permitEdit              | enum('sip', 'logged_in', 'logged_out', 'always', 'never')| Default: sip                                                                            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|render                  | enum('plain','table', 'bootstrap')                       | Default bootstrap                                                                       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
390
391
392
393
|requiredParameter       | string                                                   | Name of required SIP parameter, seperated by comma. '#' as comment delimiter            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|showButton              | set('new', 'delete', 'close', 'save')                    | Default 'new,delete,close,save'. Shown buttons in the upper right corner of the form.   |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
394
395
|multiMode               | enum('none','horizontal','vertical')                     | Default 'none'                                                                          |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
396
|multiSql                | text                                                     | Optional. SQL Query which selects all records to edit.                                  |
Carsten  Rose's avatar
Carsten Rose committed
397
398
399
400
401
402
403
404
405
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiDetailForm         | string                                                   | Optional. Form to open, if a record is selected to edit (double click on record line)   |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiDetailFormParameter| string                                                   | Optional. Translated Parameter submitted to detailform (like subrecord parameter)       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|forwardMode             | string: 'auto|no|page'.                                  |                                                                                         |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|forwardPage             | string / query                                           | If $forward=="page": page to jump to                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
406
407
408
|bsLabelColumns          | string                                                   | The bootstrap grid system is based on 12 columns. The sum of *bsLabelColumns*,          |
+------------------------+----------------------------------------------------------+ *bsInputColumns* and *bsNoteColumns* should be 12. These values here are the base values|
|bsInputColumns          | string                                                   | for all formelements. Exceptions per formelement can be specified per formelement.      |
Carsten  Rose's avatar
Carsten Rose committed
409
410
411
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|bsNoteColumns           | string                                                   | note: default number of 'bootstrap 12grid' columns                                      |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
412
|parameter               | text                                                     | Misc additional parameters. See :ref:`form-parameter`                                   |
Carsten  Rose's avatar
Carsten Rose committed
413
414
415
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|deleted                 | string                                                   | 'yes'|'no'.                                                                             |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
416
|modified                | timestamp                                                | updated automatically through stored procedure                                          |
Carsten  Rose's avatar
Carsten Rose committed
417
418
419
420
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|created                 | datetime                                                 | set once through QFQ                                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+

421
422
423
424
425
426
427
428
429
430
Field: Form.showButton
^^^^^^^^^^^^^^^^^^^^^^

Display or hide the button 'new' and / or 'delete'.

* *new*: Creates a new record. If the form needs any special parameter via SIP or Client, hide this 'new' button - the necessary parameter are not provided.
* *delete*: The simple form of deleting a record only deletes the record itself, not any child records.



431
.. _form-parameter:
Carsten  Rose's avatar
Carsten Rose committed
432

433
434
Field: Form.parameter
^^^^^^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
435

436
* The following parameter are optional and can be configured in the *Form.parameter* field.
Carsten  Rose's avatar
Carsten Rose committed
437
438
439
440
441
442
443
444
445

+------------------------+--------+---------------------------------------------------------------------------------------------------+
| Name                   | Type   | Description                                                                                       |
+========================+========+===================================================================================================+
| maxVisiblePill         | int    | Show pills upto <maxVisiblePill> as button, all further in a dropdown menu. Eg.: maxVisiblePill=3 |
+------------------------+--------+---------------------------------------------------------------------------------------------------+
| class                  | string | HTML div with given class, surrounding the whole form. Eg.: class=container-fluid                 |
+------------------------+--------+---------------------------------------------------------------------------------------------------+

446
447
* Example:

448
449
  * maxVisiblePill = 5
  * class = container-fluid
450
451
452
453
454
455

FormElements
------------
* Each *form* contains one or more *FormElement*.
* The *FormElements* are divided in three categories:
  
456
457
458
  * :ref:`class-container`
  * :ref:`class-native`
  * :ref:`class-action`
Carsten  Rose's avatar
Carsten Rose committed
459

460
* Ordering and grouping: Native Form-Elements and Container-Elements (both with feIdContainer=0) will be ordered by 'ord'.
Carsten  Rose's avatar
Carsten Rose committed
461
462
* Inside of a container, all nested elements will be displayed.

463
464
.. _class-container:

Carsten  Rose's avatar
Carsten Rose committed
465
466
467
Class: Container
----------------

468
* Pills are containers for 'fieldset' *and* 'native' Form-Elements.
469
* Fieldsets are containers for 'native' Form-Elements
Carsten  Rose's avatar
Carsten Rose committed
470
471
472
473

Type: fieldset
^^^^^^^^^^^^^^

474
* Native Formelements can be assigned to a fieldset.
Carsten  Rose's avatar
Carsten Rose committed
475
476
477
478
479
480
* name: technical name, used as HTML identifier.
* label: Shown title of the fieldset.

Type: pill
^^^^^^^^^^

481
482
483
484
* Pill is synonymous for a tab. A pill looks like a tab.
* Pills are only available with mode render='bootstrap'.
* If there is at least one pill defined, every native Formelement needs to be assigned to a pill or to a fieldset.
* If there is at least one pill defined, every fieldset needs to be assigned to a pill.
Carsten  Rose's avatar
Carsten Rose committed
485
486
487
488
489

* Parameter:

  * FormElement.'''name''': technical name, used as HTML identifier.
  * FormElement.'''label''': Label shown on the corresponding pill button or inside the dropdown menu.
490
  * FormElement.'''type''': *pill*
Carsten  Rose's avatar
Carsten Rose committed
491
  * FormElement.'''feIdContainer''': 0  # Pill's can't be nested.
492
  * Form.'''Parameter''': *maxVisiblePill=<nr>* Number of Pill-Buttons shown. Undefined means unlimited. Excess Pill buttons will be displayed as a dropdown menu.
Carsten  Rose's avatar
Carsten Rose committed
493

494
495
.. _class-native:

Carsten  Rose's avatar
Carsten Rose committed
496
497
498
Class: Native
-------------

499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| Name          | Type                        | Description                                                                                       |
+===============+=============================+===================================================================================================+
| id            | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| formId        | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feIdContainer  | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|enabled        | enum('yes'|'no')            |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|dynamicUpdate  | enum('yes'|'no')            | In the browser, formelements with "dynamicUpdate='yes'"  will be updated depending on user input. |
|               |                             | :ref:`dynamic-update`                                                                             |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|name           | string                      |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|label          | string                      | Label of formelement. Depending on layout model, left or on top of the formelement                |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
517
518
519
520
|mode           | enum('show', 'readonly',    | *Show*: regular user input field. This is the default.                                            |
|               | 'required',                 | *Required*: User has to specify a value. Typically, an <empty string> represents 'no value'.      |
|               | 'disabled' )                | *Readonly*: user can't change any data. Data not saved.                                           |
|               |                             | *Disabled*: form element is not visible.                                                          |
521
522
523
524
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|class          | enum('native', 'action',    | Details below.                                                                                    |
|               | 'container')                |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
525
|type           | enum('checkbox', 'date', 'time', 'datetime',  'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'note', 'password',         |
526
527
528
|               | 'radio', 'select', 'subrecord', 'textarea', 'timeJQW', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave',                |
|               | 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad', 'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete',          |
|               | 'sendmail')                                                                                                                     |
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkType      | enum('min|max', 'pattern',  |                                                                                                   |
|               | 'number', 'email')          |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkPattern   | 'regexp'                    |if $check_type=='pattern': pattern to match                                                        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|onChange       | string                      |list of 'form element names' of current form, separated by ', ', If one of the named form elements |
|               |                             | change, reload own data / status / mode                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|ord            | string                      |display order of form elements ('order' is a reserved keyword)                                     |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|tabindex       | string                      |HTML tabindex attribute                                                                            |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|size           | string                      |Visible length of input element. Might be ommited, depending on the choosen form layout.           |
|               |                             |Format: <width>,<height> (in characters)                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|bsLabelColumns | string                      | Number of bootstrap grid columns for label. By default empty, value inherits from the form.       |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|bsInputColumns | string                      | Number of bootstrap grid columns for input. By default empty, value inherits from the form.       |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|bsNoteColumns  | string                      | Number of bootstrap grid columns for note. By default empty, value inherits from the form.        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|maxLength      | string                      |Maximum characters for input.                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|note           | string                      |Note of formelement. Depending on layout model, right or below of the formelement                  |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|tooltip        | text                        |Display this text as tooltip on mouse over                                                         |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|placeholder    | string                      |Text, displayed inside the input element in light grey                                             |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|clientJs       | text                        |Javascript called on 'on change' formelements                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|value          | text                        |Default value                                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|sql1           | text                        |SQL query  ('sql' is a reserved keyword)                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|sql2           | text                        |second SQL query                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|parameter      | text                        |might contain misc parameter. Depends on the type of formelement.                                  |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feGroup        | string                      | Comma-separated list of Typo3 FE Group ID. NOT SURE IF THIS WILL BE IMPLEMENTED. Native           |
|               |                             | formElements, fieldsets and pills can be assigned to feGroups. Group status: show, hidden,        |
|               |                             | disabled. Group Access: FE-Groups. User will be assigned to FE-Groups and the form defintion      |
|               |                             | reference such FE-groups. Easy way of granting permission.                                        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|deleted        | string                      |'yes'|'no'.                                                                                        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|modified       | timestamp                   |updated autmatically through stored procedure                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|created        | datetime                    |set once through QFQ                                                                               |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
580
581
582


+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
583
| Attribute        | checkbox | dateJQW | datetimeJQW |  gridJQW | extra  | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
Carsten  Rose's avatar
Carsten Rose committed
584
+==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+==========+=========+========+
585
|id                |Internal id                                                                                                                                |
Carsten  Rose's avatar
Carsten Rose committed
586
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
587
|formId            |Form                                                                                                                                       |
Carsten  Rose's avatar
Carsten Rose committed
588
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
589
|containerId       |Assign the Formelement to user defined fieldSet or pill                                                                                    |
Carsten  Rose's avatar
Carsten Rose committed
590
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
591
|enabled           |Formelement is active or not                                                                                                               |
Carsten  Rose's avatar
Carsten Rose committed
592
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
593
|name              |Name of a column of the primary table. Formelements with a corresponding table will be saved automatically.                                |
Carsten  Rose's avatar
Carsten Rose committed
594
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
595
|label             |Label shown to the user.                                                                                                                   |
Carsten  Rose's avatar
Carsten Rose committed
596
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
597
|mode              |show, readonly, required, lock, disable.                                                                                                   |
Carsten  Rose's avatar
Carsten Rose committed
598
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
599
|class             |native                                                                                                                                     |
Carsten  Rose's avatar
Carsten Rose committed
600
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
601
|type              | checkbox | dateJQW | datetimeJQW |  gridJQW | extra  | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
Carsten  Rose's avatar
Carsten Rose committed
602
603
604
605
606
607
608
609
610
611
612
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|checkType         |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -      |   -     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|checkPattern      |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -      |   -     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|onChange          |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|ord               |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|tabindex          |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
613
|size              |   -      |         |             |          |        |   -   |      |   -      |   -   |   -  2 |           |   -  1   |   -     |   -  ? |
Carsten  Rose's avatar
Carsten Rose committed
614
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
615
|maxLength         |   1      |         |             |          |        |   -   |      |   -      |   - 1 |        |           |          |         |        |
Carsten  Rose's avatar
Carsten Rose committed
616
617
618
619
620
621
622
623
624
625
626
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|note              |   -      |   -     |   -         |          |        |   -   |   -  |   -      |   -   |   -    |   -       |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|tooltip           |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|placeholder       |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|clientJs          |          |   -     |   -         |   -      |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|value             |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
627
|sql1              |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
628
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
629
|sql2              |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
630
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
631
|Additional attributes in Field 'parameter'. Typically in key=value format.                                                                                    |
Carsten  Rose's avatar
Carsten Rose committed
632
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
633
| type             | checkbox | dateJQW | datetimeJQW | gridJQW  | extra  | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
Carsten  Rose's avatar
Carsten Rose committed
634
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
635
| accept           |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
636
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
637
| alt              |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
638
639
640
641
642
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| autocomplete     |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -      |   -     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| autofocus        |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
643
| checkBoxMode     |   -      |   -     |             |          |        |       |      |          |       |        |           |          |         |        |
Carsten  Rose's avatar
Carsten Rose committed
644
645
646
647
648
649
650
651
652
653
654
655
656
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| checked          |   -      |         |             |          |        |   -   |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| unchecked        |   -      |         |             |          |        |   -   |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| label2           |   -      |         |             |          |        |       |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| itemList         |   -      |         |             |          |        |       |      |          |   -   |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| emptyItemAtStart |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| emptyItemAtEnd   |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
657
658
| emptyHide        |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
Carsten  Rose's avatar
Carsten Rose committed
659
660
661
662
663
664
665
666
667
668
669
670
| accept           |          |         |             |          |        |       |      |          |       |        |           |          |         |   -  3 |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+

* 1: A line break created every <size> elements. Easy way to make checkboxes or radio vertical instead of horizontal.
* 2: Any number >1 makes the 'select' input 'multiple' ready.
* See: https://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)

* All 'native' Formelements like 'input', 'checkbox', ...

Type: checkbox
^^^^^^^^^^^^^^

671
Checkboxes can be rendered in mode:
Carsten  Rose's avatar
Carsten Rose committed
672

673
* *single*:
Carsten  Rose's avatar
Carsten Rose committed
674

675
  * One column in a table corresponds to one checkbox.
676
  * The value for statuses *checked* and *unchecked* are free to choose.
677
678
  * This mode is selected, if a) *checkBoxMode* = single, or b) *checkBoxMode* is missing **and** the number of fields of the column definition is <3.
  * *parameter*:
Carsten  Rose's avatar
Carsten Rose committed
679

680
681
    * *checkBoxMode* = single (optional)
    * *checked* = <value> (optional, the value which represents 'checked')
Carsten  Rose's avatar
Carsten Rose committed
682

683
      * If *checked* is empty or missing: If *type* = 'enum' or 'set', get first item of the definition. If *type* = string, get default.
Carsten  Rose's avatar
Carsten Rose committed
684

685
    * *unchecked* = <value> (optional, the value which represents 'unchecked')
Carsten  Rose's avatar
Carsten Rose committed
686

687
      * If *unchecked* is empty or missing: If *type* = 'enum' or 'set', get second item of checked. If *type* = 'string', get ''.
Carsten  Rose's avatar
Carsten Rose committed
688

689
    * *label2* = <value>       (Text right beside checkbox) (optional)
Carsten  Rose's avatar
Carsten Rose committed
690
691


692
693
* *multi*:

694
  * One column in a table represents multiple checkboxes. This is typically useful for the column type *set*.
695
696
697
698
699
700
701
702
703
704
  * The value for status *checked* are free to choose, the value for status *unchecked* is always the empty string.
  * Each field key (or the corresponding value from the key/value pair) will be rendered right beside the checkbox.
  * *parameter*

    * *checkBoxMode*: multi
    * *itemList* - E.g.:

      * ``itemList=red,blue,orange``
      * ``itemList=1:red,2:blue,3:orange``
      * ``itemList={{!SELECT id, value FROM someTable}}``
Carsten  Rose's avatar
Carsten Rose committed
705

706
707
708
709
710
  * FormElement '''Maxlength''' - vertical or horizontal alignment:

     * Value: '', 0, 1 - The radios will be aligned vertical.
     * Value: >1 - The readios will be aligned horizontal, with a linebreak every 'value' elements.

Carsten  Rose's avatar
Carsten Rose committed
711
712
713
Type: date
^^^^^^^^^^

714
715
716
717
 * Range datetime: '1000-01-01' to '9999-12-31' or '0000-00-00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html)
 * Optional:
   * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy

Carsten  Rose's avatar
Carsten Rose committed
718
Type: datetime
719
^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
720

721
722
723
724
725
726
 * Range datetime: '1000-01-01 00:00:00' to '9999-12-31 23:59:59' or '0000-00-00 00:00:00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html)
 * Optional:
   * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy
   * *showSeconds*: 0|1 - shows the seconds. Independent if the user specifies seconds, they are displayed '1' or not '0'.
   * *showZero*: 0|1 - For an empty timestamp, With '0' nothing is displayed. With '1' the string '0000-00-00 00:00:00' is displayed.

727
728
729
730
731
Type: extra
^^^^^^^^^^^
 * Element is not shown in the browser.
 * The element can be used to define / precalculate values for a column, which do not already exist as a native FormElement.
 * The element is build /computed on form load.
Carsten  Rose's avatar
Carsten Rose committed
732
733

Type: input
734
^^^^^^^^^^^
735

736
* General input for text and number.
Carsten  Rose's avatar
Carsten Rose committed
737
738
739
* size:

  * <number>:  width of input element in characters. Lineheight = 1.
740
  * <cols>,<rows>: input element = textarea, width=<cols>, height=<rows>
Carsten  Rose's avatar
Carsten Rose committed
741
742

Type: note
743
^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
744
745

Type: radio
746
^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
747

748
* Radio Buttons will be built from one of three sources:
Carsten  Rose's avatar
Carsten Rose committed
749

750
  * a) 'sql1': E.g. *{{!SELECT type AS label FROM car }}* or *{{!SELECT type AS label, typeNr AS id FROM car}}* or *{{!SHOW tables}}*.
Carsten  Rose's avatar
Carsten Rose committed
751
752
753

    * Resultset format 'named': column 'label' and optional a column 'id'.
    * Resultset format 'index':
754
755
756

      * One column in resultset >> first column represents *label*
      * Two or more columns in resultset >> first column represents *id* and second column represents *label*.
Carsten  Rose's avatar
Carsten Rose committed
757
758
759

  * b) FormElement.'''parameter''':

760
    * '''itemList''' attribute. E.g.: *itemList=red,blue,orange* or *itemList=1:red,2:blue:3:orange*
Carsten  Rose's avatar
Carsten Rose committed
761

762
  * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
Carsten  Rose's avatar
Carsten Rose committed
763

764
* FormElement '''Maxlength''' - *vertical* or *horizontal* alignment:
765

766
767
   * Value: '', 0, 1 - The radios will be aligned vertical.
   * Value: >1 - The readios will be aligned horizontal, with a linebreak every 'value' elements.
768

Carsten  Rose's avatar
Carsten Rose committed
769
770
771
772
* FormElement.'''parameter''':

  * '''emptyItemAtStart''': Existence of this item inserts an empty entry at the beginning of the selectlist.
  * '''emptyItemAtEnd''': Existence of this item inserts an empty entry at the end of the selectlist.
773
774
  * '''emptyHide''': Existence of this item hides the empty entry. This is usefull for e.g. Enums, which have a en empty
    entry and the empty value should not be an option to be selected.
Carsten  Rose's avatar
Carsten Rose committed
775
776

Type: select
777
^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
778

779
* Select lists will be built from one of three sources:
Carsten  Rose's avatar
Carsten Rose committed
780

781
  * a) 'sql1': E.g. *{{!SELECT type AS label FROM car }}* or *{{!SELECT type AS label, typeNr AS id FROM car}}* or *{{!SHOW tables}}*.
Carsten  Rose's avatar
Carsten Rose committed
782
783
784
785

    * Resultset format 'named': column 'label' and optional a column 'id'.
    * Resultset format 'index':

786
787
      * One column in resultset >> first column represents *label*
      * Two or more columns in resultset >> first column represents *id* and second column represents *label*.
Carsten  Rose's avatar
Carsten Rose committed
788
789
790

  * b) FormElement.'''parameter''':

791
    * '''itemList''' attribute. E.g.: *itemList=red,blue,orange* or *itemList=1:red,2:blue:3:orange*
Carsten  Rose's avatar
Carsten Rose committed
792

793
  * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
Carsten  Rose's avatar
Carsten Rose committed
794
795
796
797

* FormElement.'''size''':

  * <empty>|0|1: Dropdown list.
798
  * >1: Select field with 'size' rows height. Multiple selection of items is possible.
Carsten  Rose's avatar
Carsten Rose committed
799
800
801
802
803

* FormElement.'''parameter''':

  * '''emptyItemAtStart''': Existence of this item inserts an empty entry at the beginning of the selectlist.
  * '''emptyItemAtEnd''': Existence of this item inserts an empty entry at the end of the selectlist.
804
805
  * '''emptyHide''': Existence of this item hides the empty entry. This is usefull for e.g. Enums, which have a en empty
    entry and the empty value should not be an option to be selected.
Carsten  Rose's avatar
Carsten Rose committed
806
807
808
809

Type: subrecord
^^^^^^^^^^^^^^^

810
811
'subrecord' present a list of records (called secondary records), typically to edit, delete or add such records. The list
   is defined as a SQL query. The number of records shown is not limited. These formelement will be rendered inside the
812
813
   form as a HTML table. The list is ordered by 1) formelement.class (action, container, native), 2) formelement.container,
   3) formelement.ord
Carsten  Rose's avatar
Carsten Rose committed
814

815
816
* *sql1*: SQL query to select records. E.g.::

817
   {{!SELECT a.id AS id, CONCAT(a.street, a.streetnumber) AS a, a.city AS b, a.zip AS c FROM Address AS a}}
818

819
   # Notice the **exclamation mark** after '{{' - this is necessary to return an array of elements, instead of a single string.
820

821
822
  * Exactly one column 'id' has to exist; it specifies the primary record for the target form.
    In case the id should no be visible to the user, it has to be named *'_id'*.
Carsten  Rose's avatar
Carsten Rose committed
823

824
  * Columnname: *<title>[|<number>][|width=<number>][|nostrip][|icon][|url][|mailto|_rowClass]*
825
826
827

    * *<number>*: any 'digit only' will be treated as '''width'''.
    * *width=<number>*: max. number of chars displayed per cell in the column.
828
829
830
831
    * *nostrip*: by default, html tags will be stripped off the cell content before rendering. This protects the table
      layout. 'nostrip' deactivates the cleaning to make links, images, ... possible.
    * *icon*: the cell value contains the name of an icon in *typo3conf/ext/qfq/Resources/Public/icons*. Empty cell values
      will omit an html image tag (=nothing renderd in the cell).
832
833
834
835
836
837
838
839
840
    * *mailto*: value will be rendered as a mailto link.
    * *url*: value will be rendered as a link.
    * *title=<text>* or '<none of the above>': column '''title'''.
    * The parameters are position independet.
    * Examples::

         SELECT note1 AS 'Comment', note2 AS 'Comment\|50' , note3 AS 'title=Comment\|width=100\|nostrip', note4 AS '50\|Comment',
         'checked.png' AS 'Status\|icon', email AS 'mailto', CONCAT(homepage, '\|Homepage') AS 'url' ...

841
842
843
844
845
846
847
848
849
    * *_rowClass*

      * The value is a CSS class name(s) which will be rendered in the *<tr class="<_rowClass>">* of the subrecord table.
      * The column itself is hidden to the user.
      * By using Bootstrap, the following predefined classes are available:

        * Text color: *text-muted|text-primary|text-success|text-info|text-warning|text-danger* (http://getbootstrap.com/css/#helper-classes)
        * Row background: *active|success|info|warning|danger* (http://getbootstrap.com/css/#tables-contextual-classes)

850
851
852
853
    * *_rowTitle*

      * Defines the title attribute of a subrecod table row (tooltip).

854
855
856
857
858
859
860
861
* *parameter*

  * *form*: Target form, e.g. *form=person*
  * *page*: Target page with detail form. If none specified, use the current page.
  * *title*: Title displayed over the table in the current form.
  * *detail*: Mapping of values from the primary form to the target form (defined via `form=...`).

    * Syntax::
862

863
864
865
866
867
868
869
870
871
872
873
874
        <source table column name 1|&constant 1>:<target column name 1>[,<source table column name 2|&constant 2>:<target column name 2>][...]

    * Example: *detail=id:personId,&12:xId,&{{a}}:personId*
    * By default, the given value will overwrite values on the target record. In most situations, this is the wished behaviour.
    * Exceptions of the default behaviour have to be defined on the target form in the corresponding formelement in the
      field *value*. E.g. `{{<columnname>:RS0}}` - For existing records, the store `R` will provide a value. For new
      records, store `R` is empty and store S will be searched for a value: the value defined in `detail` will be choosen. At
      last the store '0' is defined as a fallback.
    * *source table column name*: E.g. A person form is opened with person.id=5 (r=5). The definition `detail=id:personId` and `form=address`
      maps person.id to address.personId. On the target record, the column personId becomes '5'.
    * *Constant '&'*: Indicate a 'constant' value. E.g. `&12:xId` or `{{...}}` (all possibilities, incl. further SELECT
      statements) might be used.
875

Carsten  Rose's avatar
Carsten Rose committed
876
877
878
879
880
881
882

Type: string
^^^^^^^^^^^^

Type: submit
^^^^^^^^^^^^

883
Typically not used. Useful if user wishes an explicit 'Submit' Button.
Carsten  Rose's avatar
Carsten Rose committed
884
885
886
887

Type: time
^^^^^^^^^^

888
889
890
891
* Range time: '00:00:00' to '23:59:59' or '00:00:00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html)
* Optional:
  * *showSeconds*: 0|1 - shows the seconds. Independent if the user specifies seconds, they are displayed '1' or not '0'.
  * *showZero*: 0|1 - For an empty timestamp, With '0' nothing is displayed. With '1' the string '00:00[:00]' is displayed.
892

Carsten  Rose's avatar
Carsten Rose committed
893
894
895
896
Type: upload
^^^^^^^^^^^^

* See: https://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)
897
* parameter:accept: *image/*,video/*,audio/*,.doc,.docx,.pdf,<mime type>*
Carsten  Rose's avatar
Carsten Rose committed
898

899
900
901
902
903
904
905
906
907
908
909
910
An upload element is based on a file browse button and a delete button. Only one of them is shown at a time.
If there is no file already uploaded, the file browse button is displayed.

The user can than select a file from the local filesystem.
After choosing the file, the upload starts immediately, shown by a turning wheel. When the server received the whole file
and accepts the file, the browse button dissappears and the filename is shown, followed by a delete button.
Now, the user can delete the uploaded file (and maybe upload another one) or leave it as it is.
Until this point, the file is cached on the server but not copied to the final destination. The user have to save the
current record either to finalize the upload or to delete a previous uploaded file.

* FormElement. *parameter*:

911
  * *fileDestination*: Destination where to copy the file. A good practice is to specify a relative `fileDestination` - such an
912
    installation (filesystem and database) are moveable.
913
914

    * If `fileDestination` should contain the original filename, the variable *{{_filename}}* can be used. Example::
915

916
      fileDestination={{SELECT 'fileadmin/user/pictures/', p.name, '-{{_filename}}' FROM Person AS p WHERE p.id={{r}} }}
917

918
919
920
921
922
923
924
    * If a file already exist under `fileDestination`, an error message is shown and 'save' is aborted.
       The user has no possibility to overwrite the already existing file. If the whole workflow is correct, this situation
       should no arise.

    * All necessary subdirectories in `fileDestination` are automatically created.

Deleting a record and the referenced file
925
'''''''''''''''''''''''''''''''''''''''''
926
927
928
929
930
931
932
933

If the user deletes a record which contains reference(s) to files, such files are deleted too.

Only columns where the columname contains `pathFileName` are checked for file references. Therefore, always choose a
columnanem which contains `pathFileName`.

If there are other records, which references the same file, such files are not deleted (but the record is deleted).
It's a very basic check: just the current column of the current table is compared.
934

935
936
.. _class-action:

Carsten  Rose's avatar
Carsten Rose committed
937
938
939
Class: Action
-------------

940
941
Type: before... | after...
^^^^^^^^^^^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
942

943
Types:
Carsten  Rose's avatar
Carsten Rose committed
944

945
946
947
948
949
950
951
952
953
954
  * beforeLoad
  * afterLoad
  * beforeSave
  * afterSave
  * beforeInsert
  * afterInsert
  * beforeUpdate
  * afterUpdate
  * beforeDelete
  * afterDelete
Carsten  Rose's avatar
Carsten Rose committed
955

956
* Check data
Carsten  Rose's avatar
Carsten Rose committed
957

958
959
  Perform checks by fireing s SQL query and expecting a predefined number of selected records. Depending on the
  'action'-type, the check is perform on form load, or form save.
Carsten  Rose's avatar
Carsten Rose committed
960

961
962
963
  * OK: the expected number of records has been selected. Continue processing the next FormElement.
  * Fail: the expected number of records has not been selected (less or more): Display an error message and abort the
    current form load or form save.
Carsten  Rose's avatar
Carsten Rose committed
964

965
  FormElement.’‘’parameter’‘’:
Carsten  Rose's avatar
Carsten Rose committed
966

967
968
  * ‘’‘requiredList‘’‘ - List of `native`-FormElements: only if all of those elements are filled, the current
    `action`-FormElement will be processed.
969
  * ‘’‘sqlValidate’‘’ - query. E.g.: `sqlValidate={{!SELECT id FROM Person AS p WHERE p.name LIKE {{name:F:all}} AND p.firstname LIKE {{firstname:F:all}} }}`
Carsten  Rose's avatar
Carsten Rose committed
970

971
    * Pay attention to '{{!...' after the equal sign.
Carsten  Rose's avatar
Carsten Rose committed
972

973
974
975
  * ‘’‘expectRecords‘’‘ - number of records. E.g.: `expectRecords=0` or `expectRecords=0,1` or `expectRecords={{SELECT COUNT(id) FROM Person}}`
    * Separate multiple valid record numbers by ','. If at least one of those matches, the check will pass successfully.
  * ‘’‘messageFail‘’‘ - Message to show. E.g.: `messageFail=There is already a person called {{firstname:F:all}} {{name:F:all}}`
Carsten  Rose's avatar
Carsten Rose committed
976

977
* Insert / Update / Delete records
Carsten  Rose's avatar
Carsten Rose committed
978

979
  * Save values of a form to different record(s), optionally on different table(s).
980
  * Typically usefull on 'afterSave' - be carefull when using it earlier, e.g. beforeLoad.
981
982
983
984
985
986
987

  FormElement.’‘’parameter’‘’:

  * ‘’‘requiredList‘’‘ - List of `native`-FormElements: only if all of those elements are filled, the current
    `action`-FormElement will be processed.
  * ‘’‘slaveId‘’‘:

988
989
990
991
992
    * If `slaveId` does not exist or is empty (e.g. a defined query has an empty result):

      * If there is a primary table column, with the same name as the current `action`-FormElement: take the value from that column as `slaveId`.
      * If not: treat it as '0'.

993
994
    * A value of `0` means the following `sqlInsert` will be fired.
    * A value > `0` means the following `sqlUpdate` will be fired and the `slaveId` specifies which one.
995
    * Access the `slaveId` by using the variable `{{slaveId:V}}` inside of `sqlUpdate`, `sqlInsert` or `sqlDelete`.
996
997
998
999

  * ‘’‘sqlUpdate‘’‘ - query. E.g.:  `sqlUpdate={{UPDATE Address SET street = '{{street:F:all}}' WHERE id={{slaveId:V}} LIMIT 1}}`
  * ‘’‘sqlInsert‘’‘ - query. E.g.:  `sqlInsert={{INSERT INTO Address (pId, street) VALUES ( {{id:R}}, '{{street:F:all}}' WHERE id={{slaveId:V}} }}`

1000
  * ‘’‘sqlDelete‘’‘ - query: E.g.:  `sqlDelete={{DELETE FROM Address WHERE id={{slaveId:V}} AND ''='{{city:F:allbut:s}}' LIMIT 1}}`