Index.rst 176 KB
Newer Older
Carsten  Rose's avatar
Carsten Rose committed
1
.. ==================================================
2
.. Header hierachy
3
.. ==
4
5
6
7
8
9
..  --
..   ^^
..    ''
..     ;;
..      ,,
..
10
11
12
13
14
15
16
17
18
19
20
.. --------------------------------------------------
.. -*- coding: utf-8 -*- with BOM.

.. include:: ../Includes.txt


.. _users-manual:

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

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


25
Features not implemented yet
26
27
28
----------------------------

* Multi Forms
29
30
31
32

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

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

42

43
44
45
46
47
48
49
50
 +-------------------+---------------------------------------------------------------------------------+
 | 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}} }}** |
 +-------------------+---------------------------------------------------------------------------------+
51
52
53
 | r                 | recordId. The form will load the record with the specified id                   |
 |                   | * Variants: **r = 123**, by SQL: **r = {{SELECT ...}}**                         |
 |                   | * If not specified, the default is '0'                                          |
54
55
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
 +-------------------+---------------------------------------------------------------------------------+
 | <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                           |
 +-------------------+---------------------------------------------------------------------------------+
81
 | debugShowBodyText | If ='1' and config.ini:*showDebugInfo=yes*: shows a tooltip with bodytext       |
82
 +-------------------+---------------------------------------------------------------------------------+
83

84
85
.. _debug:

86
87
88
89
90
Debug
^^^^^

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

91
92
93
94
95
96
  * *yes*:

    * Form:

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

98
    * Report: Will be configured per tt-content record.
99

100
      *debugShowBodyText = 1*
101

102
  * *no*: No debug info.
103

104
  * *auto*: Depending if there is a Typo3 BE session, set internally:
105

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

Form
----

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

118
  * *Simple* form: the form acts on one record, stored in one table.
119

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

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

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

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

128
129
    * 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
130

131
.. _variables:
Carsten  Rose's avatar
Carsten Rose committed
132

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

Most fields of a form specification might contain:
137

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

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

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

* Example:

149
  *{{r}}*
Carsten  Rose's avatar
Carsten Rose committed
150

151
152
153
154
  *{{index:FS}}*

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

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

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

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

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

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

166

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

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

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

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

194
195
196
197
198
199
* 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
200

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| Name             | Form | Query | Pattern                                                                                 |
+==================+======+=======+=========================================================================================+
| **alnumx**       | Form | Query | [A-Za-z][0-9]@-_.,;: /()                                                                |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **digit**        | Form | Query | [0-9].-+                                                                                |
+------------------+------+-------+-----------------------------------------------------------------------------------------+
| **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
221
222
223
224
225


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

226
227
228
229
230
Only variables that are known in a specified store can be substituted.

 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 |Name |Description                                                                             | Content                                                                    |
 +=====+========================================================================================+============================================================================+
231
 | F   | :ref:`STORE_FORM`: data not saved in database yet.                                     | All native *FormElements*. Recent values from the Browser.                 |
232
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
233
234
 | 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.                                         |                                                                            |
235
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
236
 | R   | :ref:`STORE_RECORD`: Record - the current record loaded in the form                    | All columns of the current record from the current table                   |
237
238
239
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | 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   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
240
 | D   | Default values column : The *table.column* specified *default value*.                  |                                                                            |
241
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
242
 | M   | Column type: The *table.column* specified *type*                                       |                                                                            |
243
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
244
 | C   | :ref:`STORE_CLIENT`: POST variable, if not found: GET variable                         | Parameter sent from the Client (=Browser).                                 |
245
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
246
 | T   | :ref:`STORE_TYPO3`: a) Bodytext (ttcontent record), b) Typo3 internal variables        | See Typo3 tt_content record configuration                                  |
247
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
248
 | V   | :ref:`STORE_VARS`: Generic variables                                                   |                                                                            |
249
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
250
251
252
253
254
 | 0   | Zero - allways value: 0, might be helpful if a variable is empty or undefined and will | All possible keys                                                          |
 |     | be used in an SQL statement.                                                           |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | E   | Empty - allways value: 0, might be helpful if a variable is empty or undefined and will| All possible keys                                                          |
 |     | be used in an SQL statement                                                            |                                                                            |
255
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
256
 | Y   | :ref:`STORE_SYSTEM`: a) Database, b) helper vars for logging/debugging:                |                                                                            |
257
258
 |     | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN                                          |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
259

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

263
264
265
  * 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
266
267
268
269
270
271

.. _predefined-variable-names:

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

272
273
274
275
276
277
278
279
.. _STORE_FORM:

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

* Represents the values in the form, typically before saving them.
* Used for:

280
281
282
  * *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`.
283

284
285
286
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                    | Explanation                                                                                                                                |
 +=========================+============================================================================================================================================+
287
 | FormElement name        | Name of native *FormElement*. To get, exactly and only, the specified *FormElement* (for 'p_id'): *{{p_id:F}}*                             |
288
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
289
290
291
292
293
294
295
296
297
298
299

.. _STORE_SIP:

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

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

300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
 +-------------------------+-----------------------------------------------------------+
 | 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                    |
 +-------------------------+-----------------------------------------------------------+
315
316
317
318
319
320

.. _STORE_RECORD:

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

321
322
323
* Current record loaded in Form.
* If r=0, alle values are empty.

324
325
326
327
328
 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                   | Explanation                                                                                                                                      |
 +========================+==================================================================================================================================================+
 | <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}}* |
 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
329
330
331

.. _STORE_CLIENT:

332
Store: *CLIENT* - C
Carsten  Rose's avatar
Carsten Rose committed
333
334
^^^^^^^^^^^^^^^^^^^

335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | 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
358

359
360
.. _STORE_TYPO3:

361
Store: *TYPO3* (Bodytext) - T
Carsten  Rose's avatar
Carsten Rose committed
362
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                                                       | 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                              |          |
 +-------------------------+-------------------------------------------------------------------+----------+
386
387
388

* **note**: not available
  * in 'dynamicUpdate' or
389
  * by *FormElement* class 'action' with type 'beforeSave', 'afterSave', 'beforeDelete', 'afterDelete'.
390
391

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

393
394
395
Store: *VARS* - V
^^^^^^^^^^^^^^^^^

396
397
398
399
400
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                    | Explanation                                                                                                                                |
 +=========================+============================================================================================================================================+
 | random                  | random string with length of 32 chars, alphanum                                                                                            |
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
401
 | slaveId                 | see *FormElement* `action`                                                                                                                 |
402
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
403

404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447

.. _STORE_SYSTEM:

Store: *SYSTEM* - S
^^^^^^^^^^^^^^^^^^^

 +-------------------------+------------------------------------------------------------+
 | 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                                      |
 +-------------------------+------------------------------------------------------------+
 | sqlFinal                | computed during runtime, used for error reporting          |
 +-------------------------+------------------------------------------------------------+
 | sqlParamArray           | computed during runtime, used for error reporting          |
 +-------------------------+------------------------------------------------------------+
 | sqlCount                | computed during runtime, used for error reporting          |
 +-------------------------+------------------------------------------------------------+

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

449
* The detection of an SQL command is case *insensitive*.
450
* Leading  whitespace will be skipped.
451
* The following commands are interpreted as SQL commands:
Carsten  Rose's avatar
Carsten Rose committed
452

453
  * SELECT
454
455
  * INSERT, UPDATE, DELETE, REPLACE, TRUNCATE
  * SHOW, DESCRIBE, EXPLAIN, SET
Carsten  Rose's avatar
Carsten Rose committed
456

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

463
* Example::
Carsten  Rose's avatar
Carsten Rose committed
464

465
  {{SELECT id, name FROM Person}}
466
467
  {{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}} }} }}
468

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

471
   {{!SELECT ...}}
472

473
  * This is only possible for the outermost SELECT.
474

475
476
Form: main
----------
Carsten  Rose's avatar
Carsten Rose committed
477
478

+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
479
| Name                   | Type                                                     | Description                                                                             |
Carsten  Rose's avatar
Carsten Rose committed
480
481
482
483
484
+========================+==========================================================+=========================================================================================+
|id                      | int, autoincrement                                       | created by by MySQL                                                                     |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|name                    | string                                                   | unique and speaking name of the form. Form will be identified by this name              |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
485
|title                   | string                                                   | Title, shown on/above the form.                                                         |
Carsten  Rose's avatar
Carsten Rose committed
486
487
488
489
490
491
492
493
494
495
496
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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                                                                       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
497
498
499
500
|requiredParameter       | string                                                   | Name of required SIP parameter, seperated by comma. '#' as comment delimiter            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|showButton              | set('new', 'delete', 'close', 'save')                    | Default 'new,delete,close,save'. Shown buttons in the upper right corner of the form.   |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
501
502
|multiMode               | enum('none','horizontal','vertical')                     | Default 'none'                                                                          |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
503
|multiSql                | text                                                     | Optional. SQL Query which selects all records to edit.                                  |
Carsten  Rose's avatar
Carsten Rose committed
504
505
506
507
508
509
510
511
512
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
513
514
|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|
515
|bsInputColumns          | string                                                   | for all *FormElements*. Exceptions per *FormElement* can be specified per *FormElement*.|
516
517
+------------------------+----------------------------------------------------------+ Default: label=3, input=6, note=3                                                       |
|bsNoteColumns           | string                                                   |                                                                                         |
Carsten  Rose's avatar
Carsten Rose committed
518
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
519
|parameter               | text                                                     | Misc additional parameters. See :ref:`form-parameter`                                   |
Carsten  Rose's avatar
Carsten Rose committed
520
521
522
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|deleted                 | string                                                   | 'yes'|'no'.                                                                             |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
523
|modified                | timestamp                                                | updated automatically through stored procedure                                          |
Carsten  Rose's avatar
Carsten Rose committed
524
525
526
527
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|created                 | datetime                                                 | set once through QFQ                                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+

528
529
showButton
^^^^^^^^^^
530

531
Display or hide the button `new`, `delete`, `close`, `save`.
532
533

* *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.
534
* *delete*: This either deletes the current record only, or (if defined via action *FormElement* 'before Delete' ) any specified subrecords.
535
536
* *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.
537

538
* Default: show all buttons.
539

540
.. _form-parameter:
Carsten  Rose's avatar
Carsten Rose committed
541

542
543
parameter
^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
544

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

547
548
549
550
551
552
553
554
555
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| 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.                                            |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
556
| classBody              | string | HTML div with given class, surrounding all *FormElement*.                                                |
557
558
559
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| submitButtonText       | string | Show save button, with the <submitButtonText> at the bottom of the form                                  |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
560
561
| extraDeleteForm        | string | Name of a form which specifies how to delete the primary record and optional slave records               |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
562

563
564
* Example:

565
566
  * maxVisiblePill = 5
  * class = container-fluid
567
  * classBody = qfq-form-right
568

569
570
submitButtonText
''''''''''''''''
571
572
573
574
575
576
577

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

578
579
class
'''''
580
581
582
583
584
585
586
587
588

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

589
590
classPill
'''''''''
591
592
593
594
595
596
597
598
599
600

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

601
602
classBody
'''''''''
603
604
605
606
607
608
609

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

610
  1) adjust the background color of the *FormElement* area.
611
612
613
614
  1) make all form labels right align: `qfq-form-right`.

* 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)
615

616
617
618
619
620
621
622
623
624
625
626
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.
627
To not repeat such 'slave record delete definition', an 'extraDeleteForm' can be specified. If the user opens a record
628
629
630
631
632
633
634
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'

635
636
637
638
639
FormElements
------------
* Each *form* contains one or more *FormElement*.
* The *FormElements* are divided in three categories:
  
640
641
642
  * :ref:`class-container`
  * :ref:`class-native`
  * :ref:`class-action`
Carsten  Rose's avatar
Carsten Rose committed
643

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

647
648
.. _class-container:

Carsten  Rose's avatar
Carsten Rose committed
649
650
651
Class: Container
----------------

652
653
* Pills are containers for 'fieldset' *and* / *or* 'native' *FormElements*.
* Fieldsets are containers for 'native' *FormElements*.
Carsten  Rose's avatar
Carsten Rose committed
654
655
656
657

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

658
* Native *FormElements* can be assigned to a fieldset.
Carsten  Rose's avatar
Carsten Rose committed
659
660
661
662
663
664
* name: technical name, used as HTML identifier.
* label: Shown title of the fieldset.

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

665
666
* Pill is synonymous for a tab. A pill looks like a tab.
* Pills are only available with mode render='bootstrap'.
667
* If there is at least one pill defined, every native *FormElement* needs to be assigned to a pill or to a fieldset.
668
* If there is at least one pill defined, every fieldset needs to be assigned to a pill.
Carsten  Rose's avatar
Carsten Rose committed
669
670
671

* Parameter:

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

678
679
.. _class-native:

Carsten  Rose's avatar
Carsten Rose committed
680
681
682
Class: Native
-------------

683
684
Fields:

685
686
687
688
689
690
691
692
693
694
695
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| Name          | Type                        | Description                                                                                       |
+===============+=============================+===================================================================================================+
| id            | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| formId        | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feIdContainer  | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|enabled        | enum('yes'|'no')            |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
696
697
|dynamicUpdate  | enum('yes'|'no')            | In the browser, *FormElements* with "dynamicUpdate='yes'"  will be updated depending on user      |
|               |                             | input. :ref:`dynamic-update`                                                                      |
698
699
700
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|name           | string                      |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
701
|label          | string                      | Label of *FormElement*. Depending on layout model, left or on top of the *FormElement*            |
702
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
703
704
705
|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.                                           |
706
|               |                             | *Disabled*: *FormElement* is not visible.                                                         |
707
708
709
710
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|class          | enum('native', 'action',    | Details below.                                                                                    |
|               | 'container')                |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
711
|type           | enum('checkbox', 'date', 'time', 'datetime',  'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'note',           |
712
|               | 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave',                           |
713
|               | 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad', 'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete',          |
714
|               | 'sendMail')                                                                                                                     |
715
716
717
718
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkType      | enum('min|max', 'pattern',  |                                                                                                   |
|               | 'number', 'email')          |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
719
|checkPattern   | 'regexp'                    |If $check_type=='pattern': pattern to match                                                        |
720
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
721
|onChange       | string                      |List of *FormElement*-names of current form, separated by ', ', If one of the named *FormElements* |
722
723
|               |                             | change, reload own data / status / mode                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
724
|ord            | string                      | Display order of *FormElements* ('order' is a reserved keyword)                                   |
725
726
727
728
729
730
731
732
733
734
735
736
737
738
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|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.                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
739
|note           | string                      |Note of *FormElement*. Depending on layout model, right or below of the *FormElement*.             |
740
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
741
|tooltip        | text                        |Display this text as tooltip on mouse over.                                                        |
742
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
743
|placeholder    | string                      |Text, displayed inside the input element in light grey.                                            |
744
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
745
|clientJs       | text                        |Javascript called on 'on change' *FormElement*                                                     |
746
747
748
749
750
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|value          | text                        |Default value                                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|sql1           | text                        |SQL query  ('sql' is a reserved keyword)                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
751
|sql2           | text                        |Second SQL query                                                                                   |
752
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
753
|parameter      | text                        |Might contain misc parameter. Depends on the type of *FormElement*.                                |
754
755
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feGroup        | string                      | Comma-separated list of Typo3 FE Group ID. NOT SURE IF THIS WILL BE IMPLEMENTED. Native           |
756
757
|               |                             | *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     |
758
759
|               |                             | reference such FE-groups. Easy way of granting permission.                                        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
760
|deleted        | string                      | 'yes'|'no'.                                                                                       |
761
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
762
|modified       | timestamp                   |updated automatically through stored procedure                                                     |
763
764
765
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|created        | datetime                    |set once through QFQ                                                                               |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
766

767
Implications
Carsten  Rose's avatar
Carsten Rose committed
768

769
770
771
772
773
774
775
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| Attribute        | checkbox | dateJQW | datetimeJQW |  gridJQW | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload | editor |
+==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+=========+========+========+
|id                |Internal id                                                                                                                              |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|formId            |Form                                                                                                                            |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
776
|containerId       |Assign the *FormElement* to user defined fieldSet or pill                                                                       |        |
777
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
778
|enabled           |*FormElement* is active or not                                                                                                  |        |
779
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
780
|name              |Name of a column of the primary table. *FormElements* with a corresponding table will be saved automatically.                   |        |
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|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              |?                                                                                                                                        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|Additional attributes in Field 'parameter'. Typically in key=value format.                                                                         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| type             | checkbox | dateJQW | datetimeJQW | gridJQW  | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload | editor |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| accept           |?                                                                                                                                        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| alt              |?                                                                                                                               |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| autocomplete     |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -     |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
826
| autofocus        |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   -    |
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| checkBoxMode     |   -      |   -     |             |          |        |       |      |          |       |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| checked          |   -      |         |             |          |        |   -   |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| unchecked        |   -      |         |             |          |        |   -   |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| label2           |   -      |         |             |          |        |       |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| itemList         |   -      |         |             |          |        |       |      |          |   -   |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyItemAtStart |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyItemAtEnd   |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyHide        |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| accept           |          |         |             |          |        |       |      |          |       |        |           |         |   -  3 |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
Carsten  Rose's avatar
Carsten Rose committed
846
847
848
849
850

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

851
* All 'native' *FormElements* like 'input', 'checkbox', ...
Carsten  Rose's avatar
Carsten Rose committed
852

853
854
855
856
857
858
'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'.
859

Carsten  Rose's avatar
Carsten Rose committed
860
861
862
Type: checkbox
^^^^^^^^^^^^^^

863
Checkboxes can be rendered in mode:
Carsten  Rose's avatar
Carsten Rose committed
864

865
* *single*:
Carsten  Rose's avatar
Carsten Rose committed
866

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

872
873
    * *checkBoxMode* = single (optional)
    * *checked* = <value> (optional, the value which represents 'checked')
Carsten  Rose's avatar
Carsten Rose committed
874

875
      * 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
876

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

879
      * 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
880

881
    * *label2* = <value>       (Text right beside checkbox) (optional)
Carsten  Rose's avatar
Carsten Rose committed
882
883


884
885
* *multi*:

886
  * One column in a table represents multiple checkboxes. This is typically useful for the column type *set*.
887
888
889
890
891
892
893
894
895
896
  * The value for status *checked* are free to choose, the value for status *unchecked* is always the empty string.
  * Each field key (or the corresponding value from the key/value pair) will be rendered right beside the checkbox.
  * *parameter*

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

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

898
  * *FormElement* Maxlength - vertical or horizontal alignment:
899
900
901
902

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

Carsten  Rose's avatar
Carsten Rose committed
903
904
905
Type: date
^^^^^^^^^^

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

Carsten  Rose's avatar
Carsten Rose committed
910
Type: datetime
911
^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
912

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

919
920
Type: extra
^^^^^^^^^^^
921
* Element is not shown in the browser.
922
* The element can be used to define / precalculate values for a column, which do not already exist as a native *FormElement*.
923
* The element is build /computed on form load.
Carsten  Rose's avatar
Carsten Rose committed
924

925
926
Type: text
^^^^^^^^^^
927

928
* General input for text and number.
Carsten  Rose's avatar
Carsten Rose committed
929
930
931
* size:

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

934
935
936
Type: editor
^^^^^^^^^^^^

937
* TinyMCE (https://www.tinymce.com, community edition) is used as the QFQ Rich Text Editor.
938
939
* 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
940
  of each TinyMCE keyword. Check possible options under https://www.tinymce.com/docs/configure/,
941
942
943
944
945
  https://www.tinymce.com/docs/plugins/, https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
* Bars:

  * Top: *menubar* - by default hidden.
  * Top: *toolbar* - by default visible.
946
947
  * Bottom: *statusbar* - by default hidden, exception: *min_height* and *max_height* are given via size parameter.

948
949
950

* The default setting is::

951
952
    editor-plugins=code link searchreplace table textcolor textpattern visualchars
    editor-toolbar=code searchreplace undo redo | styleselect link table | fontselect fontsizeselect | bullist numlist outdent indent | forecolor backcolor bold italic editor-menubar=false
953
954
955
956
    editor-statusbar=false

* size:

957
  * <min_height>,<max_height>: in pixels, including top and bottom bars. E.g.: 300,600
958
959


Carsten  Rose's avatar
Carsten Rose committed
960
Type: note
961
^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
962

963
964
965
966
967
Type: password
^^^^^^^^^^^^^^

* Like a `text` element, but every character is shown as a asterisk.

Carsten  Rose's avatar
Carsten Rose committed
968
Type: radio
969
^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
970

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

973
  * a) 'sql1': E.g. *{{!SELECT type AS label FROM car }}* or *{{!SELECT type AS label, typeNr AS id FROM car}}* or *{{!SHOW tables}}*.
Carsten  Rose's avatar
Carsten Rose committed
974
975
976

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

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

981
  * b) *FormElement*.'''parameter''':
Carsten  Rose's avatar
Carsten Rose committed
982

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

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

987
* *FormElement* '''Maxlength''' - *vertical* or *horizontal* alignment:
988

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

992
* *FormElement*.'''parameter''':
Carsten  Rose's avatar
Carsten Rose committed
993
994
995

  * '''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.
Elias Villiger's avatar
Elias Villiger committed
996
  * '''emptyHide''': Existence of this item hides the empty entry. This is useful for e.g. Enums, which have a en empty
997
    entry and the empty value should not be an option to be selected.
Carsten  Rose's avatar
Carsten Rose committed
998
999

Type: select
1000
^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
1001

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

1004
  * a) 'sql1': E.g. *{{!SELECT type AS label FROM car }}* or *{{!SELECT type AS label, typeNr AS id FROM car}}* or *{{!SHOW tables}}*.
Carsten  Rose's avatar
Carsten Rose committed
1005
1006
1007
1008

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

1009
1010
      * One column in resultset >> first column represents *label*
      * Two or more columns in resultset >> first column represents *id* and second column represents *label*.
Carsten  Rose's avatar
Carsten Rose committed
1011

1012
  * b) *FormElement*.'''parameter''':
Carsten  Rose's avatar
Carsten Rose committed
1013

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

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

1018
* *FormElement*.'''size''':
Carsten  Rose's avatar
Carsten Rose committed
1019
1020

  * <empty>|0|1: Dropdown list.
1021
  * >1: Select field with 'size' rows height. Multiple selection of items is possible.
Carsten  Rose's avatar
Carsten Rose committed
1022

1023
* *FormElement*.'''parameter''':
Carsten  Rose's avatar
Carsten Rose committed
1024
1025
1026

  * '''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.
Elias Villiger's avatar
Elias Villiger committed
1027
  * '''emptyHide''': Existence of this item hides the empty entry. This is useful for e.g. Enums, which have an empty
1028
    entry and the empty value should not be an option to be selected.
Carsten  Rose's avatar
Carsten Rose committed
1029
1030
1031
1032

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

1033
1034
The *FormElement* type 'subrecord' renders a list of records (so called secondary records), typically to show, edit, delete
or add new records. The list is defined as a SQL query. The number of records shown is not limited. These *FormElement*
1035
will be rendered inside the form as a HTML table.
Carsten  Rose's avatar
Carsten Rose committed
1036

1037
1038
* *sql1*: SQL query to select records. E.g.::

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

1041
1042
  * Notice the **exclamation mark** after '{{' - this is necessary to return an array of elements, instead of a single string.
  * Exactly one column **'id'** has to exist; it specifies the primary record for the target form.
1043
    In case the id should not be visible to the user, it has to be named **'_id'**.
1044
  * Columnname: *[title=]<title>[|[width=]<number>][|nostrip][|icon][|link][|url][|mailto][|_rowClass][|_rowTitle]*
1045
1046
1047
1048
1049
1050

    * All parameter are position independet.
    * Separate parameter by '|'.
    * *[title=]<text>*: Title of the column. The keyword 'title=' is optional. Columns with a title starting with '_' won't be rendered.
    * *[width=]<number>*: Max. width of chars displayed per cell. The keyword 'width=' is optional. Default max width: 20.
      This setting also affects the title of the column.
1051
    * *nostrip*: by default, html tags will be stripped off the cell content before rendering. This protects the table
1052
      layout. 'nostrip' deactivates the cleaning to make pure html possible.
1053
    * *icon*: the cell value contains the name of an icon in *typo3conf/ext/qfq/Resources/Public/icons*. Empty cell values
1054
      will omit an html image tag (=nothing rendered in the cell).
1055
1056
1057
    * *link*: value will be rendered as described under :ref:`column-link`
    * *url*: value will be rendered as a href url.
    * *mailto*: value will be rendered as a href mailto.
1058
1059
1060
1061
1062
1063
1064
1065
1066
    * *_rowClass*

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

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

1067
1068
1069
1070
    * *_rowTitle*

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

1071
1072
1073
1074
1075
1076
    * Examples::

         SELECT note1 AS 'Comment', note2 AS 'Comment|50' , note3 AS 'title=Comment|width=100|nostrip', note4 AS '50|Comment',
         'checked.png' AS 'Status|icon', email AS 'mailto', CONCAT(homepage, '|Homepage') AS 'url',
         ELT(status,'info','warning','danger') AS '_rowClass', help AS '_rowTitle' ...

1077
1078
1079
1080
1081
* *parameter*

  * *form*: Target form, e.g. *form=person*
  * *page*: Target page with detail form. If none specified, use the current page.
  * *title*: Title displayed over the table in the current form.
1082
  * *extraDeleteForm*: Optional. The per row delete Button will reference the form specified here (for deleting) instead of the default (*form*).
1083
1084
1085
  * *detail*: Mapping of values from the primary form to the target form (defined via `form=...`).

    * Syntax::
1086

1087
1088
1089
1090
        <source table column name 1|&constant 1>:<target column name 1>[,<source table column name 2|&constant 2>:<target column name 2>][...]

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

Carsten  Rose's avatar
Carsten Rose committed
1100
1101
1102
Type: time
^^^^^^^^^^

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

Carsten  Rose's avatar
Carsten Rose committed
1108
1109
1110
1111
Type: upload
^^^^^^^^^^^^

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

1114
An upload element is based on a file browse button and a delete button. Only one of them is shown at a time.
Carsten  Rose's avatar
Upload:    
Carsten Rose committed
1115
1116
The file browse button is displayed, if there is no file uploaded already.
The trash button is displayed, if there is file uploaded already.