Index.rst 205 KB
Newer Older
Carsten  Rose's avatar
Carsten Rose committed
1
.. ==================================================
2
.. Header hierachy
3
.. ==
4
5
6
7
8
9
..  --
..   ^^
..    ''
..     ;;
..      ,,
..
10
.. --------------------------------------------------
11
.. External Links: `Bootstrap <http://getbootstrap.com/>`_:
Carsten  Rose's avatar
Carsten Rose committed
12
.. Add Images: https://wiki.typo3.org/ReST_Syntax#Images
13
..
14
15
16
17
18
19
20
21
22
23
.. -*- coding: utf-8 -*- with BOM.

.. include:: ../Includes.txt


.. _users-manual:

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

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

27
Features not implemented yet
28
29
30
----------------------------

* Multi Forms
31
32
33
34

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

35
QFQ is used by configuring Typo3 content elements. Insert one or more QFQ content elements on a Typo3 page.
36
37
38
39
40
41
42
43
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)
^^^^^^^^^^^^^^^^^^^^^^^

44

45
46
47
48
49
50
51
52
 +-------------------+---------------------------------------------------------------------------------+
 | 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}} }}** |
 +-------------------+---------------------------------------------------------------------------------+
53
 | r                 | <record id> The form will load the record with the specified id                 |
54
55
 |                   | * Variants: **r = 123**, by SQL: **r = {{SELECT ...}}**                         |
 |                   | * If not specified, the default is '0'                                          |
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 +-------------------+---------------------------------------------------------------------------------+
 | <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                           |
 +-------------------+---------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
83
 | debugShowBodyText | If ='1' and config.qfq.ini:*showDebugInfo=yes* - shows a tooltip with bodytext  |
84
 +-------------------+---------------------------------------------------------------------------------+
85

86
87
.. _debug:

88
89
90
91
92
Debug
^^^^^

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

93
94
95
96
97
98
  * *yes*:

    * Form:

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

100
    * Report: Will be configured per tt-content record.
101

102
      *debugShowBodyText = 1*
103

104
  * *no*: No debug info.
105

106
  * *auto*: Depending if there is a Typo3 BE session, set internally:
107

108
109
    * *SHOW_DEBUG_INFO = yes*  (BE session exist)
    * *SHOW_DEBUG_INFO = no*   (no BE session)
Carsten  Rose's avatar
Carsten Rose committed
110
111
112
113

Form
----

114
* Forms will be created by using the *QFQ Form Editor* on the Typo3 frontend (HTML form).
115
* The Formeditor itself consist of two predefined QFQ forms: *form* and *formElement*
116
117
* 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.
118
* There are three types of forms which can roughly categorized into:
119

120
  * *Simple* form: the form acts on one record, stored in one table.
121

Carsten  Rose's avatar
Carsten Rose committed
122
    * The form will create necessary SQL commands for insert, update and delete (only primary record) automatically.
123

124
  * *Advanced* form: the form acts on multiple records, stored in more than one table.
125

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

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

130
131
    * 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
132

133
.. _variables:
Carsten  Rose's avatar
Carsten Rose committed
134

135
136
Variable (incl. mixed SQL Statement)
------------------------------------
Carsten  Rose's avatar
Carsten Rose committed
137
138

Most fields of a form specification might contain:
139

Carsten  Rose's avatar
Carsten Rose committed
140
141
142
143
144
* ''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.

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

147
  *{{VarName[:<store / prio>[:<sanitize class>[:<escape>]]]}}*
Carsten  Rose's avatar
Carsten Rose committed
148
149
150

* Example:

151
  *{{r}}*
Carsten  Rose's avatar
Carsten Rose committed
152

153
154
155
156
  *{{index:FS}}*

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

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

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

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

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

165
166
  * *{{ SELECT "Hello World"   }}* acts as *{{SELECT "Hello World"}}*
  * *{{ varname   }}* acts as *{{varname}}*
Carsten  Rose's avatar
Carsten Rose committed
167

168

169
170
* 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.
171
* 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
172
173
174
175
176
* If no value is found, the value is an <empty string>.

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

177
* URL (=GET) Parameter can be used in *forms* and *reports* as variables.
178
179
180
181
182
183
184
185
186
187
188
189
190
191
* 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
192
193
194
195

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

196
197
198
199
200
201
* 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
202

203
204
205
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| Name             | Form | Query | Pattern                                                                                 |
+==================+======+=======+=========================================================================================+
206
| **alnumx**       | Form | Query | [A-Za-z][0-9]@-_.,;: /() ÀÈÌÒÙàèìòùÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÃÑÕãñõÄËÏÖÜŸäëïöüÿ             |
207
+------------------+------+-------+-----------------------------------------------------------------------------------------+
208
209
210
| **digit**        | Form | Query | [0-9]                                                                                   |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **numerical**    | Form | Query | [0-9.-+]                                                                                |
211
212
213
214
215
216
217
218
219
220
221
222
223
224
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **email**        | Form | Query | [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}                                          |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **min|max**      | Form |       | Compares the value against an lower and upper limit (numeric or string).                |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **min|max date** | Form |       | Compares the value against an lower and upper date or datetime.                         |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **pattern**      | Form |       | Compares the value against a regexp.                                                    |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **allbut**       | Form | Query | All characters allowed, but not [ ]  { } % & \ #. The used regexp: '^[^\[\]{}%&\\#]+$', |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **all**          | Form | Query | no sanitizing                                                                           |
+------------------+------+-------+-----------------------------------------------------------------------------------------+

Carsten  Rose's avatar
Carsten Rose committed
225
226
227
228
229


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

230
231
232
233
234
Only variables that are known in a specified store can be substituted.

 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 |Name |Description                                                                             | Content                                                                    |
 +=====+========================================================================================+============================================================================+
235
 | F   | :ref:`STORE_FORM`: data not saved in database yet.                                     | All native *FormElements*. Recent values from the Browser.                 |
236
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
237
238
 | S   | :ref:`STORE_SIP`: Client parameter 's' will indicate the current SIP, which will be    | sip, r (record_id), form                                                   |
 |     | loaded from the SESSION repo to the SIP-Store.                                         |                                                                            |
239
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
240
 | R   | :ref:`STORE_RECORD`: Record - the current record loaded in the form                    | All columns of the current record from the current table                   |
241
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
242
243
 | B   | :ref:`STORE_BEFORE`: Record - the current record loaded in the form before any update  | All columns of the current record from the current table                   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
244
245
 | 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   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
246
 | D   | Default values column : The *table.column* specified *default value*.                  |                                                                            |
247
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
248
 | M   | Column type: The *table.column* specified *type*                                       |                                                                            |
249
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
250
 | C   | :ref:`STORE_CLIENT`: POST variable, if not found: GET variable                         | Parameter sent from the Client (=Browser).                                 |
251
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
252
 | T   | :ref:`STORE_TYPO3`: a) Bodytext (ttcontent record), b) Typo3 internal variables        | See Typo3 tt_content record configuration                                  |
253
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
254
 | V   | :ref:`STORE_VARS`: Generic variables                                                   |                                                                            |
255
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
256
257
 | 0   | *Zero* - allways value: 0, might be helpful if a variable is empty or undefined and    | Any key                                                                    |
 |     | will be used in an SQL statement.                                                      |                                                                            |
258
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
259
260
 | E   | *Empty* - allways an empty string, might be helpful if a variable is empty or undefined| Any key                                                                    |
 |     | and will be used in an SQL statement                                                   |                                                                            |
261
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
262
 | Y   | :ref:`STORE_SYSTEM`: a) Database, b) helper vars for logging/debugging:                |                                                                            |
263
 |     | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN, c) Any custom fields: CONTACT, HELP, .. |                                                                            |
264
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
265

266
* Default *<prio>*: *FSRVD* - Form / SIP / Record / Vars / Table definition.
Carsten  Rose's avatar
Carsten Rose committed
267
268
* Hint: Preferable, parameter should be submitted by SIP, not by Client (=URL).

269
270
271
  * 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
272
273
274
275
276
277

.. _predefined-variable-names:

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

278
279
280
281
282
.. _STORE_FORM:

Store: *FORM* - F
^^^^^^^^^^^^^^^^^

283
* Sanatized: *yes*
284
285
286
* Represents the values in the form, typically before saving them.
* Used for:

287
288
289
  * *FormElements* who will be rerendered, after a parent *FormElement* has been changed by the user.
  * *FormElement* actions, before saving the form.
  * Values will be sanitized by the class configured in corresponding the *FormElement*. By default, the sanitize class is `alnumx`.
290

Carsten  Rose's avatar
Carsten Rose committed
291
292
293
294
295
 +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                            | Explanation                                                                                                                                |
 +=================================+============================================================================================================================================+
 | <FormElement name>              | Name of native *FormElement*. To get, exactly and only, the specified *FormElement* (for 'p_id'): *{{p_id:F}}*                             |
 +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
296
297
298
299
300
301

.. _STORE_SIP:

Store: *SIP* - S
^^^^^^^^^^^^^^^^

302
* Sanatized: *no*
303
304
305
306
307
* Filled automatically by creating links. E.g.:

  * in `Report` by using `_page?` or `_link` (with active 's')
  * in `Form` by using subrecords: 'new', 'edit', 'delete' links (system) or by column type `_page?`, `_link`.

308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
 +-------------------------+-----------------------------------------------------------+
 | Name                    | Explanation                                               |
 +=========================+===========================================================+
 | sip                     | 13 char uniqid                                            |
 +-------------------------+-----------------------------------------------------------+
 | r                       | current record id                                         |
 +-------------------------+-----------------------------------------------------------+
 | form                    | current form name                                         |
 +-------------------------+-----------------------------------------------------------+
 | table                   | current table name                                        |
 +-------------------------+-----------------------------------------------------------+
 | urlparam                | all non Typo3 paramter in one string                      |
 +-------------------------+-----------------------------------------------------------+
 | <user defined>          | additional user defined link parameter                    |
 +-------------------------+-----------------------------------------------------------+
323
324
325
326
327
328

.. _STORE_RECORD:

Store: *RECORD* - R
^^^^^^^^^^^^^^^^^^^

329
* Sanatized: *no*
330
331
332
* Current record loaded in Form.
* If r=0, alle values are empty.

333
334
 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                   | Explanation                                                                                                                                      |
335
336
337
338
339
340
341
342
343
 +========================+==================================================================================================================================================+
 | <column name>          | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form *FormElement*: *{{p_id:R}}* |
 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+

.. _STORE_BEFORE:

Store: *BEFORE* - B
^^^^^^^^^^^^^^^^^^^

344
* Sanatized: *no*
345
* Current record loaded in Form without any modification.
346
347
* If r=0, alle values are empty.

348
349
This store is handy to compare new and old values of a form.

350
351
 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                   | Explanation                                                                                                                                      |
352
353
354
 +========================+==================================================================================================================================================+
 | <column name>          | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form *FormElement*: *{{p_id:R}}* |
 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
355
356
357

.. _STORE_CLIENT:

358
Store: *CLIENT* - C
Carsten  Rose's avatar
Carsten Rose committed
359
360
^^^^^^^^^^^^^^^^^^^

361
362
* Sanatized: *yes*

363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                    | Explanation                                                                                                                              |
 +=========================+==========================================================================================================================================+
 | s                       | =SIP                                                                                                                                     |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | r                       | record id. Typically stored in SIP, rarely specified on the URL                                                                          |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | keySemId                | always current Semester Id                                                                                                               |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | keySemIdUser            | *{{keySemIdUser}}*, may be changed by user                                                                                               |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | HTTP_HOST               | current HTTP HOST                                                                                                                        |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | REMOTE_ADDR             | Client IP address                                                                                                                        |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | '$_SERVER[*]'           | All other variables accessable by *$_SERVER[]*. Only the often used have a pre-defined sanitize class.                                   |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | form                    | Unique name of current form                                                                                                              |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | ANREDE                  | *{{sex}}* == male >> Sehr geehrter Herr, *{{sex}}* == female  Sehr geehrte Frau                                                          |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | EANREDE                 | *{{sex}}* == male >> Dear Mr., *{{sex}}* == female >> Dear Mrs.                                                                          |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
386

387
388
.. _STORE_TYPO3:

389
Store: *TYPO3* (Bodytext) - T
Carsten  Rose's avatar
Carsten Rose committed
390
391
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

392
393
* Sanatized: *no*

394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
 +-------------------------+-------------------------------------------------------------------+----------+
 | Name                    | Explanation                                                       | Note     |
 +=========================+===================================================================+==========+
 | form                    | Formname defined in ttcontent record bodytext                     | see note |
 |                         |                                                                   |          |
 |                         | * Fix. E.g. *form = person*                                       |          |
 |                         | * via SIP. E.g. *form = {{form}}*                                 |          |
 +-------------------------+-------------------------------------------------------------------+----------+
 | pageId                  | Record id of current Typo3 page                                   | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | pageType                | Current selected page type (typically URL parameter 'type')       | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | pageLanguage            | Current selected page language (typically URL parameter 'L')      | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | ttcontentUid            | Record id of current Typo3 content element                        | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | feUser                  | Logged in Typo3 FE User                                           |          |
 +-------------------------+-------------------------------------------------------------------+----------+
 | feUserUid               | Logged in Typo3 FE User uid                                       |          |
 +-------------------------+-------------------------------------------------------------------+----------+
 | feUserGroup             | FE groups of logged in Typo3 FE User                              |          |
 +-------------------------+-------------------------------------------------------------------+----------+
416
417
418

* **note**: not available
  * in 'dynamicUpdate' or
419
  * by *FormElement* class 'action' with type 'beforeSave', 'afterSave', 'beforeDelete', 'afterDelete'.
420
421

.. _STORE_VARS:
Carsten  Rose's avatar
Carsten Rose committed
422

423
424
425
Store: *VARS* - V
^^^^^^^^^^^^^^^^^

426
427
* Sanatized: *no*

428
429
430
431
432
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                    | Explanation                                                                                                                                |
 +=========================+============================================================================================================================================+
 | random                  | random string with length of 32 chars, alphanum                                                                                            |
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
433
 | slaveId                 | see *FormElement* `action`                                                                                                                 |
434
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
435
 | filename                | Original filename of an uploaded file via an 'upload'-FormElement. Valid only during processing of the current 'upload'-formElement.       |
436
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
437
 | fileDestinaton          | Destination (path & filename) for an uploaded file. Defined in an 'upload'-FormElement.parameter. Valid: same as 'filename'.               |
438
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
439

440
441
442

.. _STORE_SYSTEM:

443
Store: *SYSTEM* - Y
444
445
^^^^^^^^^^^^^^^^^^^

446
447
* Sanatized: *no*

448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
 +-------------------------+--------------------------------------------------------------------------+
 | Name                    | Explanation                                                              |
 +=========================+==========================================================================+
 | DB_USER                 | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | DB_SERVER               | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | DB_NAME                 | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | DB_INIT                 | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | SQL_LOG                 | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | SQL_LOG_MODE            | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | SHOW_DEBUG_INFO         | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | CSS_LINK_CLASS_INTERNAL | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | CSS_LINK_CLASS_EXTERNAL | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | CSS_CLASS_QFQ_CONTAINER | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | EXT_PATH                | computed during runtime                                                  |
 +-------------------------+--------------------------------------------------------------------------+
 | SITE_PATH               | computed during runtime                                                  |
 +-------------------------+--------------------------------------------------------------------------+
 | DATE_FORMAT             | defined in config.ini                                                    |
 +-------------------------+--------------------------------------------------------------------------+
 | class                   | defined in config.ini (CSS_CLASS_QFQ_FORM) or form definition            |
 +-------------------------+--------------------------------------------------------------------------+
 | classPill               | defined in config.ini (CSS_CLASS_QFQ_FORM_PILL) or form definition       |
 +-------------------------+--------------------------------------------------------------------------+
 | classBody               | defined in config.ini (CSS_CLASS_QFQ_FORM_BODY) or form definition       |
 +-------------------------+--------------------------------------------------------------------------+
 | data-pattern-error      | defined in config.ini or form definition                                 |
 +-------------------------+--------------------------------------------------------------------------+
 | data-require-error      | defined in config.ini or form definition                                 |
 +-------------------------+--------------------------------------------------------------------------+
 | data-match-error        | defined in config.ini or form definition                                 |
 +-------------------------+--------------------------------------------------------------------------+
 | data-error              | defined in config.ini or form definition                                 |
 +-------------------------+--------------------------------------------------------------------------+
 | bsLabelColumns          | defined in config.ini (FORM_BS_LABEL_COLUMNS) or form definition         |
 +-------------------------+--------------------------------------------------------------------------+
 | bsInputColumns          | defined in config.ini (FORM_BS_INPUT_COLUMNS) or form definition         |
 +-------------------------+--------------------------------------------------------------------------+
 | bsNoteColumns           | defined in config.ini (FORM_BS_NOTE_COLUMNS) or form definition          |
 +-------------------------+--------------------------------------------------------------------------+
 | sqlFinal                | computed during runtime, used for error reporting                        |
 +-------------------------+--------------------------------------------------------------------------+
 | sqlParamArray           | computed during runtime, used for error reporting                        |
 +-------------------------+--------------------------------------------------------------------------+
 | sqlCount                | computed during runtime, used for error reporting                        |
 +-------------------------+--------------------------------------------------------------------------+
503
504
505

SQL Statement
-------------
Carsten  Rose's avatar
Carsten Rose committed
506

507
* The detection of an SQL command is case *insensitive*.
508
* Leading  whitespace will be skipped.
509
* The following commands are interpreted as SQL commands:
Carsten  Rose's avatar
Carsten Rose committed
510

511
  * SELECT
512
513
  * INSERT, UPDATE, DELETE, REPLACE, TRUNCATE
  * SHOW, DESCRIBE, EXPLAIN, SET
Carsten  Rose's avatar
Carsten Rose committed
514

515
* A SQL Statement might contain parameters, including additional SQL statements. Inner SQL queries will be executed first.
Carsten  Rose's avatar
Carsten Rose committed
516
* All variables will be substituted one by one from inner to outer.
517
* 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
518
* The number of variables inside an input field or a SQL statement is not limited.
519
* 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
520

521
* Example::
Carsten  Rose's avatar
Carsten Rose committed
522

523
  {{SELECT id, name FROM Person}}
524
525
  {{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}} }} }}
526

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

529
   {{!SELECT ...}}
530

531
  * This is only possible for the outermost SELECT.
532

533
534
.. _form-main:

535
536
Form: main
----------
Carsten  Rose's avatar
Carsten Rose committed
537

Carsten  Rose's avatar
Carsten Rose committed
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
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
| Name                    | Type                                                     | Description                                                                             |
+=========================+==========================================================+=========================================================================================+
|id                       | int, autoincrement                                       | created by by MySQL                                                                     |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|name                     | string                                                   | unique and speaking name of the form. Form will be identified by this name              |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|title                    | string                                                   | Title, shown on/above the form.                                                         |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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                                                                       |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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.   |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiMode                | enum('none','horizontal','vertical')                     | Default 'none'                                                                          |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiSql                 | text                                                     | Optional. SQL Query which selects all records to edit.                                  |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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                                                    |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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*.|
576
+-------------------------+----------------------------------------------------------+ Default: label=3, input=6, note=3. See :ref:`form-layout`.                              |
Carsten  Rose's avatar
Carsten Rose committed
577
578
|bsNoteColumns            | string                                                   |                                                                                         |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
579
|parameter                | text                                                     | Misc additional parameters. See :ref:`form-parameter`.                                  |
Carsten  Rose's avatar
Carsten Rose committed
580
581
582
583
584
585
586
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|deleted                  | string                                                   | 'yes'|'no'.                                                                             |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|modified                 | timestamp                                                | updated automatically through stored procedure                                          |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|created                  | datetime                                                 | set once through QFQ                                                                    |
+-------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
587

588
589
showButton
^^^^^^^^^^
590

591
Display or hide the button `new`, `delete`, `close`, `save`.
592
593

* *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.
594
* *delete*: This either deletes the current record only, or (if defined via action *FormElement* 'before Delete' ) any specified subrecords.
595
596
* *close*: Close the current form. If there are changes, a popup opens and ask to save / close / cancel. The last page from the history will be shown.
* *save*: Save the form.
597

598
* Default: show all buttons.
599

600
.. _form-parameter:
Carsten  Rose's avatar
Carsten Rose committed
601

602
603
parameter
^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
604

605
* The following parameter are optional and can be configured in the *Form.parameter* field.
Carsten  Rose's avatar
Carsten Rose committed
606

607
608
  * Comments: lines starting with a '#' are treated as a comment and will not be parsed.

609
610
611
612
613
614
615
616
617
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| 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                        |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| classPill              | string | HTML div with given class, surrounding the `pill` title line.                                            |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
618
| classBody              | string | HTML div with given class, surrounding all *FormElement*.                                                |
619
620
621
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| submitButtonText       | string | Show save button, with the <submitButtonText> at the bottom of the form                                  |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
622
623
| extraDeleteForm        | string | Name of a form which specifies how to delete the primary record and optional slave records               |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
624
625
626
627
628
629
630
631
| data-pattern-error     | string | Pattern violation: Text for error message used for all FormElements of current form                      |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-required-error    | string | Required violation: Text for error message used for all FormElements of current form                     |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-match-error       | string | Match violation: Text for error message used for all FormElements of current form                        |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-error             | string | If none specific is defined: Text for error message used for all FormElements of current form            |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
632
633
| buttonOnChangeClass    | string | Color for save button after user modified some content or current form. E.g.: 'btn-info alert-info'      +
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
634

635
636
* Example:

637
638
  * maxVisiblePill = 5
  * class = container-fluid
639
  * classBody = qfq-form-right
640

641
642
submitButtonText
''''''''''''''''
643
644
645
646
647
648
649

* Optional.
* Default: Empty
* Empty: a 'submit' button with a Bootstrap glyph 'check' symbol is rendered at the *top right corner* of the form.
* Non Empty: a 'submit' button, with <submitButtonText>, is rendered at the bottom of the form (without a 'check' glyph
  symbol). Typically 'ShowButton: Save' will be unchecked to hide the regular save glyph symbol.

650
651
class
'''''
652
653
654
655
656
657
658
659
660

* Optional.
* Default: `container`
* Any CSS class name(s) can be specified.
* Check `typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css` for predefined classes.
* Typical use: adjust the floating rules of the form.
  * See: http://getbootstrap.com/css/#overview-container
  * Expand the form over the whole area: `container-fluid`

661
662
classPill
'''''''''
663
664
665
666
667
668
669
670
671
672

* Optional.
* Default: `qfq-color-grey-1`
* Any CSS class name(s) can be specified.
* Check `typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css` for predefined classes.
* Typical use: adjust the background color of the `pill title` area.
* Predefined background colors: `qfq-color-white`, `qfq-color-grey-1` (dark), `qfq-color-grey-2` (light),
  `qfq-color-blue-1` (dark), `qfq-color-blue-2`. (light)
* `classPill` is only visible on forms with container elemants of type 'Pill'.

673
674
classBody
'''''''''
675
676
677
678
679
680
681

* Optional.
* Default: `qfq-color-grey-2`
* Any CSS class name(s) can be specified.
* Check `typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css` for predefined classes.
* Typical use:

682
683
  * adjust the background color of the *FormElement* area.
  * make all form labels right align: `qfq-form-right`.
684
685
686

* Predefined background colors: `qfq-color-white`, `qfq-color-grey-1` (dark), `qfq-color-grey-2` (light),
  `qfq-color-blue-1` (dark), `qfq-color-blue-2`. (light)
687

688
689
690
691
692
693
694
695
696
697
698
submitButtonText
''''''''''''''''

If specified and non empty, display a regular submit button at the bottom of the page with the given text.
This gives the form a ordinary HTML-form look'n' feel. With this option, the standard buttons on the top right border
should be hided to not confuse the user.

extraDeleteForm
'''''''''''''''

Depending on the database definition, it might be necessary to delete the primary record *and* corresponding slave records.
699
To not repeat such 'slave record delete definition', an 'extraDeleteForm' can be specified. If the user opens a record
700
701
702
703
704
705
706
in a form and clicks on the 'delete' button, a defined 'extraDeleteForm'-form will be used to delete primary and slave
records instead of using the current form.
E.g. if there are multiple different forms to work on the same table, all of theses forms might reference to the same
'extraDeleteForm'-form. This simplifies the maintenance.

The 'extraDeleteForm' parameter might be specified for a 'form' and/or for 'subrecords'

707
708
FormElements
------------
709

710
711
712
* Each *form* contains one or more *FormElement*.
* The *FormElements* are divided in three categories:
  
713
714
715
  * :ref:`class-container`
  * :ref:`class-native`
  * :ref:`class-action`
Carsten  Rose's avatar
Carsten Rose committed
716

717
* Ordering and grouping: Native *FormElements* and Container-Elements (both with feIdContainer=0) will be ordered by 'ord'.
Carsten  Rose's avatar
Carsten Rose committed
718
* Inside of a container, all nested elements will be displayed.
719
* Technical, it's *not* necessary to configure a FormElement for the primary index column `id`.
720
721
722
723
* Additional options to a *FormElement* will be configured via the *FormElement.parameter* field (analog to *Form.parameter*
  for *Forms* ).

  * Comments: lines starting with a '#' are treated as a comment and will not be parsed.
Carsten  Rose's avatar
Carsten Rose committed
724

725
726
.. _class-container:

Carsten  Rose's avatar
Carsten Rose committed
727
728
729
Class: Container
----------------

730
731
* Pills are containers for 'fieldset' *and* / *or* 'native' *FormElements*.
* Fieldsets are containers for 'native' *FormElements*.
732
* TemplateGroups are containers for 'fieldset' *and* / *or* 'native' *FormElements*.
Carsten  Rose's avatar
Carsten Rose committed
733
734
735
736

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

737
* Native *FormElements* can be assigned to a fieldset.
738
739
740
741
* FormElement settings:

  * *name*: technical name, used as HTML identifier.
  * *label*: Shown title of the fieldset.
Carsten  Rose's avatar
Carsten Rose committed
742
743
744
745

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

746
747
* Pill is synonymous for a tab. A pill looks like a tab.
* Pills are only available with mode render='bootstrap'.
748
* If there is at least one pill defined, every native *FormElement* needs to be assigned to a pill or to a fieldset.
749
* If there is at least one pill defined, every fieldset needs to be assigned to a pill.
Carsten  Rose's avatar
Carsten Rose committed
750

751
752
753
754
755
* FormElement settings:

  * *name*: technical name, used as HTML identifier.
  * *label*: Label shown on the corresponding pill button or inside the dropdown menu.
  * *type*: *pill*
756
  * *feIdContainer*: `0`  - Pill's can't be nested.
757
  * *parameter*:
Carsten  Rose's avatar
Carsten Rose committed
758

759
    * *maxVisiblePill*: `<nr>` - Number of Pill-Buttons shown. Undefined means unlimited. Excess Pill buttons will be
760
      displayed as a dropdown menu.
Carsten  Rose's avatar
Carsten Rose committed
761

762
763
.. _class-native:

Carsten  Rose's avatar
Carsten Rose committed
764
765
766
767
768
769
770
771
772
Type: templateGroup
^^^^^^^^^^^^^^^^^^^

*TemplateGroups* will be used to create a series of grouped (by the given *templateGroup*) *FormElements*.

FormElements can be assigned to a *templateGroup*. These *templateGroup* will be rendered upto *n*-times. On 'form load'
only a single (=first) copy of the *templateGroup* will be shown. Below the last copy of the *templateGroup* an 'add'-button is
shown. If the user click on it, an additional copy of the *templateGroup* is displayed. This can be repeated up to
*templateGroup.maxLength* times. Also, the user can 'remove' previously created copies by clicking on a remove button near
773
beside every *templateGroup*. The first copy of a templateGroup can't be removed.
Carsten  Rose's avatar
Carsten Rose committed
774

775
* FormElement settings:
Carsten  Rose's avatar
Carsten Rose committed
776

777
778
  * *label*: Shown in the FormElement-editor *container* field.
  * *maxLength*: Maximum number of copies of the current *templateGroup*. Default: 5.
779
  * *bsLabelColumn*, *bsInputColumn*, *bsNoteColumn*: column widths for row with the 'Add' button.
780
781
782
783
784
785
786
787
  * *parameter*:

    * *tgAddClass*: Class of the 'add' button. Default: `btn btn-default`.
    * *tgAddText*: Text shown on the button. Default: `Add`.
    * *tgRemoveClass*: Class of the 'remove' button. Default: `btn btn-default`.
    * *tgRemoveText*: Text shown on the button. Default: `Remove`.
    * *tgClass*: Class wrapped around every copy of the *templateGroup*. E.g. the class `qfq-child-margin-top` adds a
      margin between two copies of the *templateGroup*. Default: empty
Carsten  Rose's avatar
Carsten Rose committed
788

789
Multiple *templateGroups* per form are allowed.
Carsten  Rose's avatar
Carsten Rose committed
790
791

The name of the native FormElements, inside the templateGroup, which represents the effective table columns, uses the placeholder
792
`%d`. E.g. the columns `grade1`, `grade2`, `grade3` needs a *FormElement.name* = `grade%d`. The counting will always start with 1.
793
The placeholder `%d` can also be used in the *FormElement.label*
Carsten  Rose's avatar
Carsten Rose committed
794

Carsten  Rose's avatar
Carsten Rose committed
795
796
797
Class: Native
-------------

798
799
Fields:

800
801
802
803
804
805
806
807
808
809
810
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| Name          | Type                        | Description                                                                                       |
+===============+=============================+===================================================================================================+
| id            | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| formId        | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feIdContainer  | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|enabled        | enum('yes'|'no')            |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
811
812
|dynamicUpdate  | enum('yes'|'no')            | In the browser, *FormElements* with "dynamicUpdate='yes'"  will be updated depending on user      |
|               |                             | input. :ref:`dynamic-update`                                                                      |
813
814
815
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|name           | string                      |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
816
|label          | string                      | Label of *FormElement*. Depending on layout model, left or on top of the *FormElement*            |
817
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
818
819
820
|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.                                           |
821
|               |                             | *Disabled*: *FormElement* is not visible.                                                         |
822
823
824
825
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|class          | enum('native', 'action',    | Details below.                                                                                    |
|               | 'container')                |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
826
|type           | enum('checkbox', 'date', 'time', 'datetime',  'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'note',           |
827
|               | 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave',                           |
828
|               | 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad', 'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete',          |
829
|               | 'sendMail')                                                                                                                     |
830
831
832
833
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkType      | enum('min|max', 'pattern',  |                                                                                                   |
|               | 'number', 'email')          |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
834
|checkPattern   | 'regexp'                    |If $check_type=='pattern': pattern to match                                                        |
835
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
836
|onChange       | string                      |List of *FormElement*-names of current form, separated by ', ', If one of the named *FormElements* |
837
838
|               |                             | change, reload own data / status / mode                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
839
|ord            | string                      | Display order of *FormElements* ('order' is a reserved keyword)                                   |
840
841
842
843
844
845
846
847
848
849
850
851
852
853
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|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.                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
854
|note           | string                      |Note of *FormElement*. Depending on layout model, right or below of the *FormElement*.             |
855
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
856
|tooltip        | text                        |Display this text as tooltip on mouse over.                                                        |
857
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
858
|placeholder    | string                      |Text, displayed inside the input element in light grey.                                            |
859
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
860
|clientJs       | text                        |Javascript called on 'on change' *FormElement*                                                     |
861
862
863
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|value          | text                        |Default value                                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
864
|sql1           | text                        |SQL query                                                                                          |
865
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
866
|parameter      | text                        |Might contain misc parameter. Depends on the type of *FormElement*.                                |
867
868
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feGroup        | string                      | Comma-separated list of Typo3 FE Group ID. NOT SURE IF THIS WILL BE IMPLEMENTED. Native           |
869
870
|               |                             | *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 definition     |
871
872
|               |                             | reference such FE-groups. Easy way of granting permission.                                        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
873
|deleted        | string                      | 'yes'|'no'.                                                                                       |
874
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
875
|modified       | timestamp                   |updated automatically through stored procedure                                                     |
876
877
878
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|created        | datetime                    |set once through QFQ                                                                               |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
879

880
881
882
883
884
885
.. _fe-parameter-attributes:

Attributes defined in the parameter field
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

See also at specific *FormElement* definitions.
886
887
888
889
890
891
892
893
894
895

+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-pattern-error     | string | Pattern violation: Text for error message used for all FormElements of current form                      |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-required-error    | string | Required violation: Text for error message used for all FormElements of current form                     |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-match-error       | string | Match violation: Text for error message used for all FormElements of current form                        |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| data-error             | string | If none specific is defined: Text for error message used for all FormElements of current form            |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
896
897
898
899
| htmlBefore             | string | HTML Code wrapped before the complete *FormElement*                                                      |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| htmlAfter              | string | HTML Code wrapped after the complete *FormElement*                                                       |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
900
901
902
903
904
905
906
907
| wrapRow                | string | If specified, skip default wrapping (`<div class='col-md-?>`). Instead the given string is used.         |
+------------------------+--------+                                                                                                          |
| wrapInput              | string |                                                                                                          |
+------------------------+--------+                                                                                                          |
| wrapInput              | string |                                                                                                          |
+------------------------+--------+                                                                                                          |
| wrapNote               | string |                                                                                                          |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
908

909
910
Effect matrix
^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
911

912
913
914
915
916
917
918
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| Attribute        | checkbox | dateJQW | datetimeJQW |  gridJQW | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload | editor |
+==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+=========+========+========+
|id                |Internal id                                                                                                                              |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|formId            |Form                                                                                                                            |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
919
|containerId       |Assign the *FormElement* to user defined fieldSet or pill                                                                       |        |
920
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
921
|enabled           |*FormElement* is active or not                                                                                                  |        |
922
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
923
|name              |Name of a column of the primary table. *FormElements* with a corresponding table will be saved automatically.                   |        |
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|label             |Label shown to the user.                                                                                                        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|mode              |show, readonly, required, lock, disable.                                                                                        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|class             |native                                                                                                                          |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|type              | checkbox | dateJQW | datetimeJQW |  gridJQW | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|checkType         |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -     |        |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|checkPattern      |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -     |        |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|onChange          |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|ord               |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|tabindex          |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|size              |   -      |         |             |          |        |   -   |      |   -      |   -   |   -  2 |           |   -     |   -  ? |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|maxLength         |   1      |         |             |          |        |   -   |      |   -      |   - 1 |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|note              |   -      |   -     |   -         |          |        |   -   |   -  |   -      |   -   |   -    |   -       |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|tooltip           |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   ?    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|placeholder       |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|clientJs          |          |   -     |   -         |   -      |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|value             |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|sql1              |?                                                                                                                                        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
959
|*Additional attributes in Field 'parameter'. Typically in key=value format.*                                                                                |
960
961
962
963
964
965
966
967
968
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| type             | checkbox | dateJQW | datetimeJQW | gridJQW  | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload | editor |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| accept           |?                                                                                                                                        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| alt              |?                                                                                                                               |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| autocomplete     |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -     |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
969
| autofocus        |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   -    |
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| checkBoxMode     |   -      |   -     |             |          |        |       |      |          |       |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| checked          |   -      |         |             |          |        |   -   |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| unchecked        |   -      |         |             |          |        |   -   |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| label2           |   -      |         |             |          |        |       |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| itemList         |   -      |         |             |          |        |       |      |          |   -   |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyItemAtStart |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyItemAtEnd   |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyHide        |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
987
988
| retype           |          | -       | -           |          |        | -     |      | -        |       |        |           | -       |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
989
990
| accept           |          |         |             |          |        |       |      |          |       |        |           |         |   -  3 |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
991
992
993
994
995
996
997
998
999
1000
1001
1002
| slaveId          |          |         |             |          |        |       |      |          |       |        |           |         |   -    |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| fileDestination  |          |         |             |          |        |       |      |          |       |        |           |         |   -    |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| sqlBefore        |          |         |             |          |        |       |      |          |       |        |           |         |   -    |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| sqlInsert        |          |         |             |          |        |       |      |          |       |        |           |         |   -    |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| sqlDelete        |          |         |             |          |        |       |      |          |       |        |           |         |   -    |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| sqlAfter         |          |         |             |          |        |       |      |          |       |        |           |         |   -    |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
1003

Carsten  Rose's avatar
Carsten Rose committed
1004
1005
1006
1007
* 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)

1008
* All 'native' *FormElements* like 'input', 'checkbox', ...
Carsten  Rose's avatar
Carsten Rose committed
1009

1010
1011
1012
1013
1014
1015
'autofocus': The first *FormElement* with this attribute will get the focus after form load. If there is no such attribute
 given to any *FormElement*, the attribute will be automatically assigned to the first editable *FormElement*.

To disable 'autofocus' on a form, set 'autofocus=0' on the first editable *FormElement*.

Note: If there are multiple pills defined on a form, only the first pill will be set with 'autofocus'.
1016

Carsten  Rose's avatar
Carsten Rose committed
1017
1018
1019
Type: checkbox
^^^^^^^^^^^^^^

1020
Checkboxes can be rendered in mode:
Carsten  Rose's avatar
Carsten Rose committed
1021

1022
* *single*:
Carsten  Rose's avatar
Carsten Rose committed
1023

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

1029
1030
    * *checkBoxMode* = single (optional)
    * *checked* = <value> (optional, the value which represents 'checked')
Carsten  Rose's avatar
Carsten Rose committed
1031

1032
      * 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
1033

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

1036
      * 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
1037

1038
    * *label2* = <value>       (Text right beside checkbox) (optional)
Carsten  Rose's avatar
Carsten Rose committed
1039
1040


1041
1042
* *multi*:

1043
  * One column in a table represents multiple checkboxes. This is typically useful for the column type *set*.
1044
1045
  * 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.
1046
  * *FormElement.parameter*
1047
1048
1049
1050
1051
1052
1053

    * *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
1054

1055
  * *FormElement.maxlength* - vertical or horizontal alignment:
1056

Carsten  Rose's avatar
Carsten Rose committed
1057
1058
     * Value: '', 0, 1 - The check boxes will be aligned vertical.
     * Value: >1 - The  check boxes will be aligned horizontal, with a linebreak every 'value' elements.
1059

1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
* *FormElement.parameter*:

  * *emptyHide*: Existence of this item hides an entry with an empty string. This is useful for e.g. Enums, which have an empty
    entry, but the empty value should not be selectable.
  * *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.
  * *buttonClass*: Instead of the plain HTML  checkbox fields, Bootstrap
    `buttons <http://getbootstrap.com/javascript/#buttons-checkbox-radio>`_. are rendered as `checkbox` elements. Use
    one of the following `classes <http://getbootstrap.com/css/#buttons-options>`_:
    * `btn-default` (default, grey),
    * `btn-primary` (blue),
    * `btn-success` (green),
    * `btn-info` (light blue),
    * `btn-warning` (orange),
    * `btn-danger` (red).
    With a given *buttonClass*, all buttons (=radios) are rendered horizontal. A value in *FormElement.maxlength* has no effect.

* *No preselection*:

Carsten  Rose's avatar
Carsten Rose committed
1079
1080
1081
  * If a form is in 'new' mode and if there is a default value configured on a table column, such a value is shown by default.
    There might be situations, where the user should be forced to select a value (e.g. specifying the gender). An unwanted
    default value can be suppressed by specifying an explicit definition on the FormElement field `value`::
1082
1083
1084
1085
1086
1087
1088

      {{<columnname>:RZ}}

    For existing records the shown value is as expected the value of the record. For new records, it's the value `0`,
    which is typically not one of the ENUM / SET values and therefore nothing is selected.


Carsten  Rose's avatar
Carsten Rose committed
1089
1090
1091
Type: date
^^^^^^^^^^

1092
1093
* 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:
1094
1095

  * *FormElement.parameter.dateFormat*: yyyy-mm-dd | dd.mm.yyyy
1096

Carsten  Rose's avatar
Carsten Rose committed
1097
Type: datetime
1098
^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
1099

1100
1101
* 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:
1102
1103
1104
1105
1106
1107

  * *FormElement.parameter*:

    * *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.
1108

1109
1110
Type: extra
^^^^^^^^^^^
1111

1112
* Element is not shown in the browser.
1113
* The element can be used to define / precalculate values for a column, which do not already exist as a native *FormElement*.
1114
1115
* The element is build / computed on form load and saved alongside with the SIP parameter of the current form.
* Access the value without specifying any store (default store priority is sufficient).
Carsten  Rose's avatar
Carsten Rose committed
1116

1117
1118
Type: text
^^^^^^^^^^
1119

1120
* General input for text and number.
1121
* *FormElement.size*:
Carsten  Rose's avatar
Carsten Rose committed
1122
1123

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

1126
* *FormElement.parameter*:
1127

1128
1129
1130
  * *retype* = 1 (optional): Current input element will be rendered twice. The form can only submitted if both elements are equal.
  * *retypeLabel* =<text> (optional): The label of the second element.
  * *retypeNote* =<text> (optional): The note of the second element.
1131
  * Also check the  :ref:`fe-parameter-attributes` *data-...-error* to customize error messages shown by the validator.
1132

1133
1134
1135
Type: editor
^^^^^^^^^^^^

1136
* TinyMCE (https://www.tinymce.com, community edition) is used as the QFQ Rich Text Editor.
1137
1138
* The content will be saved as HTML inside the database.
* All configuration and plugins will be configured via the 'parameter' field. Just prepend the word 'editor-' in front
1139
  of each TinyMCE keyword. Check possible options under https://www.tinymce.com/docs/configure/,