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

.. include:: ../Includes.txt


.. _users-manual:

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

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


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

* Multi Forms
22
* FormElement:
23

24
  * type=action (especially not *addNupdate*)
25
  * Checkbox: some combinations not tested.
26
27
28
29

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

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

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

79
80
.. _debug:

81
82
83
84
85
Debug
^^^^^

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

86
87
88
89
90
91
  * *yes*:

    * Form:

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

93
    * Report: Will be configured per tt-content record.
94

95
      *debugShowBodyText = 1*
96

97
  * *no*: No debug info.
98

99
  * *auto*: Depending if there is a Typo3 BE session, set internally:
100

101
102
    * *SHOW_DEBUG_INFO = yes*  (BE session exist)
    * *SHOW_DEBUG_INFO = no*   (no BE session)
Carsten  Rose's avatar
Carsten Rose committed
103
104
105
106

Form
----

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

112
  * *Simple* form: the form acts on one record, stored in one table.
113

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

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

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

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

122
123
    * 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
124

125
.. _variables:
Carsten  Rose's avatar
Carsten Rose committed
126

127
128
Variable (incl. mixed SQL Statement)
------------------------------------
Carsten  Rose's avatar
Carsten Rose committed
129
130

Most fields of a form specification might contain:
131

Carsten  Rose's avatar
Carsten Rose committed
132
133
134
135
136
* ''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.

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

139
  *{{VarName[:<store / prio>[:<sanitize class>]]}}*
Carsten  Rose's avatar
Carsten Rose committed
140
141
142

* Example:

143
  *{{recordid}}*
Carsten  Rose's avatar
Carsten Rose committed
144

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

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

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

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

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

156
157
158
* 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.
*   sdkf
159
* 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
160
161
162
163
164
* If no value is found, the value is an <empty string>.

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

165
* URL (=GET) Parameter can be used in *forms* and *reports* as variables.
166
* If a value violates a parameter sanitize class, an exception is thrown.
Carsten  Rose's avatar
Carsten Rose committed
167
168
169
170

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

171
172
173
174
175
176
* 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
177

178
  * **alnumx**: [A-Za-z][0-9]@-_.,;: /()
Carsten  Rose's avatar
Carsten Rose committed
179
  * **digit**: [0-9].-+
180
181
182
183
  * **email**: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
  * **min|max**: only usable in forms. Compares the value against an lower and upper limit (numeric or string).
  * **min|max date**:  only usable in forms. Compares the value against an lower and upper date or datetime.
  * **pattern**:  only usable in forms. Compares the value against a regexp.
184
  * **allbut**: all characters allowed, but not [ ]  { } % & \ #. The used regexp: '^[^\[\]{}%&\\#]+$',
Carsten  Rose's avatar
Carsten Rose committed
185
186
187
188
189
190
  * **all**: no sanitizing


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

191
192
193
194
195
196
197
198
199
200
201
202
203
204
Only variables that are known in a specified store can be substituted.

 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 |Name |Description                                                                             | Content                                                                    |
 +=====+========================================================================================+============================================================================+
 | F   | Form: data not saved in database yet.                                                  | All native form elements. Recent values from the Browser.                  |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | S   | SIP: Client parameter 's' will indicate the current SIP, which will be loaded from the | sip, r (record_id), form                                                   |
 |     | SESSION repo to the SIP-Store.                                                         |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | R   | Record - the record that is going to be edited. For new records: empty.                | All columns of the current record from the current table                   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | P   | Parent record. E.g.: on multi forms the current record of the outer query              | All columns of the MultiSQL Statement from the table for the current row   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
205
 | D   | Default values column : The *table.column* specified *default value*.                  |                                                                            |
206
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
207
 | M   | Column type: The *table.column* specified *type*                                       |                                                                            |
208
209
210
211
212
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | C   | Client: POST variable, if not found: GET variable                                      | Parameter sent from the Client (=Browser).                                 |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | T   | Typo3: a) Bodytext (ttcontent record), b) Typo3 internal varibles like fe_user_uid, ...| See Typo3 tt_content record configuration                                  |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
213
214
 | V   | Vars - Generic variables                                                               |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
215
216
217
218
219
 | 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                                                            |                                                                            |
220
221
222
223
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | Y   | System: a) Database credentials, b) helper vars for logging/debugging:                 |                                                                            |
 |     | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN                                          |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
224

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

228
229
230
  * 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
231
232
233
234
235
236

.. _predefined-variable-names:

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

237
Store: *CLIENT* - C
Carsten  Rose's avatar
Carsten Rose committed
238
239
240
241
242
243
244
245
246
247
248
^^^^^^^^^^^^^^^^^^^

 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | Name          | Explanation                                                                                                                              |
 +===============+==========================================================================================================================================+
 | s             | =SIP                                                                                                                                     |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | r             | record id. Typically stored in SIP, rarely specified on the URL                                                                          |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | keySemId      | always current Semester Id                                                                                                               |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
249
 | keySemIdUser  | *{{keySemIdUser}}*, may be changed by user                                                                                               |
Carsten  Rose's avatar
Carsten Rose committed
250
251
252
253
254
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | HTTP_HOST     | current HTTP HOST                                                                                                                        |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | REMOTE_ADDR   | Client IP address                                                                                                                        |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
255
 | '$_SERVER[*]' | All other variables accessable by *$_SERVER[]*. Only the often used have a pre-defined sanitize class.                                   |
Carsten  Rose's avatar
Carsten Rose committed
256
257
258
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | form          | Unique name of current form                                                                                                              |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
259
 | ANREDE        | *{{sex}}* == male >> Sehr geehrter Herr, *{{sex}}* == female  Sehr geehrte Frau                                                          |
Carsten  Rose's avatar
Carsten Rose committed
260
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
261
 | EANREDE       | *{{sex}}* == male >> Dear Mr., *{{sex}}* == female >> Dear Mrs.                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
262
263
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+

264
Store: *TYPO3* (Bodytext) - T
Carsten  Rose's avatar
Carsten Rose committed
265
266
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Carsten  Rose's avatar
Carsten Rose committed
267
268
269
270
 +---------------+-------------------------------------------------------------------+
 | Name          | Explanation                                                       |
 +===============+===================================================================+
 | form          | Formname defined in ttcontent record bodytext                     |
271
 |               |                                                                   |
272
273
 |               | * Fix. E.g. *form = person*                                       |
 |               | * via SIP. E.g. *form = {{form}}*                                 |
Carsten  Rose's avatar
Carsten Rose committed
274
 +---------------+-------------------------------------------------------------------+
275
 | pageId        | Record id of current Typo3 page                                   |
276
 +---------------+-------------------------------------------------------------------+
277
 | pageType      | Current selected page type (typically URL parameter 'type')       |
Carsten  Rose's avatar
Carsten Rose committed
278
 +---------------+-------------------------------------------------------------------+
279
 | pageLanguage  | Current selected page language (typically URL parameter 'L')      |
Carsten  Rose's avatar
Carsten Rose committed
280
 +---------------+-------------------------------------------------------------------+
281
 | ttcontentUid  | Record id of current Typo3 content element                        |
Carsten  Rose's avatar
Carsten Rose committed
282
 +---------------+-------------------------------------------------------------------+
283
284
285
286
287
 | feUser        | Logged in Typo3 FE User                                           |
 +---------------+-------------------------------------------------------------------+
 | feUserUid     | Logged in Typo3 FE User uid                                       |
 +---------------+-------------------------------------------------------------------+
 | feUserGroup   | FE groups of logged in Typo3 FE User                              |
288
289
 +---------------+-------------------------------------------------------------------+

Carsten  Rose's avatar
Carsten Rose committed
290

291
Store: *FORM* - F
Carsten  Rose's avatar
Carsten Rose committed
292
293
294
295
296
297
^^^^^^^^^^^^^^^^^
* Represents the values in the form, typically before saving them.
* Used for:

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

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

306
Store: *RECORD* - R
Carsten  Rose's avatar
Carsten Rose committed
307
308
309
310
^^^^^^^^^^^^^^^^^^^
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name               | Explanation                                                                                                                                |
 +====================+============================================================================================================================================+
311
 | record column name | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form element: *{{p_id:R}}* |
Carsten  Rose's avatar
Carsten Rose committed
312
313
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+

314
315
316
317
318
319
320
321
Store: *VARS* - V
^^^^^^^^^^^^^^^^^

 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name               | Explanation                                                                                                                                |
 +====================+============================================================================================================================================+
 | random             | random string with length of 32 chars, alphanum                                                                                            |
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
322

Carsten  Rose's avatar
Carsten Rose committed
323
324
325
SQL
---

326
* The detection of an SQL command is case *insensitive*.
327
* Leading  whitespace will be skipped.
328
* The following commands are interpreted as SQL commands:
Carsten  Rose's avatar
Carsten Rose committed
329

330
331
332
333
334
  * SELECT
  * INSERT
  * UPDATE
  * DELETE
  * SHOW
Carsten  Rose's avatar
Carsten Rose committed
335

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

342
* Example::
Carsten  Rose's avatar
Carsten Rose committed
343

344
345
346
347
348
349
350
351
  {{SELECT id, name FROM Person}}
  {{SELECT id, name, IF({{fe_user}}=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={{fe_user}} }} }}

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

  *{{!SELECT ...}}*

352
  * This is only possible for the outermost SELECT.
353
354
355

Form: basic setup
-----------------
Carsten  Rose's avatar
Carsten Rose committed
356
357

+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
358
| Name                   | Type                                                     | Description                                                                             |
Carsten  Rose's avatar
Carsten Rose committed
359
360
361
362
363
+========================+==========================================================+=========================================================================================+
|id                      | int, autoincrement                                       | created by by MySQL                                                                     |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|name                    | string                                                   | unique and speaking name of the form. Form will be identified by this name              |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
364
|title                   | string                                                   | Title, shown on/above the form.                                                         |
Carsten  Rose's avatar
Carsten Rose committed
365
366
367
368
369
370
371
372
373
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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                                                                            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
374
|showButton              | set('new', 'delete')                                     | Default 'new,delete'. Displays button 'new' and 'delete'.                               |
Carsten  Rose's avatar
Carsten Rose committed
375
376
377
378
379
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|render                  | enum('plain','table', 'bootstrap')                       | Default bootstrap                                                                       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiMode               | enum('none','horizontal','vertical')                     | Default 'none'                                                                          |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
380
|multiSql                | text                                                     | Optional. SQL Query which selects all records to edit.                                  |
Carsten  Rose's avatar
Carsten Rose committed
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiDetailForm         | string                                                   | Optional. Form to open, if a record is selected to edit (double click on record line)   |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiDetailFormParameter| string                                                   | Optional. Translated Parameter submitted to detailform (like subrecord parameter)       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|forwardMode             | string: 'auto|no|page'.                                  |                                                                                         |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|forwardPage             | string / query                                           | If $forward=="page": page to jump to                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|bsLabelColumns          | string                                                   | title: default number of 'bootstrap 12grid' columns                                     |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|bsInputColumns          | string                                                   | input: default number of 'bootstrap 12grid' columns                                     |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|bsNoteColumns           | string                                                   | note: default number of 'bootstrap 12grid' columns                                      |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
396
|parameter               | text                                                     | Misc additional parameters. See :ref:`form-parameter`                                   |
Carsten  Rose's avatar
Carsten Rose committed
397
398
399
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|deleted                 | string                                                   | 'yes'|'no'.                                                                             |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
400
|modified                | timestamp                                                | updated automatically through stored procedure                                          |
Carsten  Rose's avatar
Carsten Rose committed
401
402
403
404
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|created                 | datetime                                                 | set once through QFQ                                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+

405
406
407
408
409
410
411
412
413
414
Field: Form.showButton
^^^^^^^^^^^^^^^^^^^^^^

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

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



415
.. _form-parameter:
Carsten  Rose's avatar
Carsten Rose committed
416

417
418
Field: Form.parameter
^^^^^^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
419

420
* The following parameter are optional and can be configured in the *Form.parameter* field.
Carsten  Rose's avatar
Carsten Rose committed
421
422
423
424
425
426
427
428
429

+------------------------+--------+---------------------------------------------------------------------------------------------------+
| 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                 |
+------------------------+--------+---------------------------------------------------------------------------------------------------+

430
431
* Example:

432
433
  * maxVisiblePill = 5
  * class = container-fluid
434
435
436
437
438
439

FormElements
------------
* Each *form* contains one or more *FormElement*.
* The *FormElements* are divided in three categories:
  
440
441
442
  * :ref:`class-container`
  * :ref:`class-native`
  * :ref:`class-action`
Carsten  Rose's avatar
Carsten Rose committed
443

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

447
448
.. _class-container:

Carsten  Rose's avatar
Carsten Rose committed
449
450
451
Class: Container
----------------

452
* Pills are containers for 'fieldset' *and* 'native' Form-Elements.
453
* Fieldsets are containers for 'native' Form-Elements
Carsten  Rose's avatar
Carsten Rose committed
454
455
456
457

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

458
* Native Formelements can be assigned to a fieldset.
Carsten  Rose's avatar
Carsten Rose committed
459
460
461
462
463
464
* name: technical name, used as HTML identifier.
* label: Shown title of the fieldset.

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

465
466
467
468
* Pill is synonymous for a tab. A pill looks like a tab.
* Pills are only available with mode render='bootstrap'.
* If there is at least one pill defined, every native Formelement needs to be assigned to a pill or to a fieldset.
* If there is at least one pill defined, every fieldset needs to be assigned to a pill.
Carsten  Rose's avatar
Carsten Rose committed
469
470
471
472
473

* Parameter:

  * FormElement.'''name''': technical name, used as HTML identifier.
  * FormElement.'''label''': Label shown on the corresponding pill button or inside the dropdown menu.
474
  * FormElement.'''type''': *pill*
Carsten  Rose's avatar
Carsten Rose committed
475
  * FormElement.'''feIdContainer''': 0  # Pill's can't be nested.
476
  * 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
477

478
479
.. _class-native:

Carsten  Rose's avatar
Carsten Rose committed
480
481
482
483
484
485
486
487
488
489
490
491
492
493
Class: Native
-------------

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


+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| Attribute        | checkbox | dateJQW | datetimeJQW |  gridJQW | hidden | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
+==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+==========+=========+========+
563
|id                |Internal id                                                                                                                                |
Carsten  Rose's avatar
Carsten Rose committed
564
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
565
|formId            |Form                                                                                                                                       |
Carsten  Rose's avatar
Carsten Rose committed
566
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
567
|containerId       |Assign the Formelement to user defined fieldSet or pill                                                                                    |
Carsten  Rose's avatar
Carsten Rose committed
568
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
569
|enabled           |Formelement is active or not                                                                                                               |
Carsten  Rose's avatar
Carsten Rose committed
570
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
571
|name              |Name of a column of the primary table. Formelements with a corresponding table will be saved automatically.                                |
Carsten  Rose's avatar
Carsten Rose committed
572
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
573
|label             |Label shown to the user.                                                                                                                   |
Carsten  Rose's avatar
Carsten Rose committed
574
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
575
|mode              |show, readonly, required, lock, disable.                                                                                                   |
Carsten  Rose's avatar
Carsten Rose committed
576
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
577
|class             |native                                                                                                                                     |
Carsten  Rose's avatar
Carsten Rose committed
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|type              | checkbox | dateJQW | datetimeJQW |  gridJQW | hidden | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|checkType         |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -      |   -     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|checkPattern      |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -      |   -     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|onChange          |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|ord               |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|tabindex          |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|size              |   -  1   |         |             |          |        |   -   |      |   -      |   -  1|   -  2 |           |   -  1   |   -     |   -  ? |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|maxLength         |          |         |             |          |        |   -   |      |   -      |       |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|note              |   -      |   -     |   -         |          |        |   -   |   -  |   -      |   -   |   -    |   -       |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|tooltip           |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|placeholder       |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|clientJs          |          |   -     |   -         |   -      |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|value             |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
605
|sql1              |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
606
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
607
|sql2              |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
608
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
609
|Additional attributes in Field 'parameter'. Typically in key=value format.                                                                                    |
Carsten  Rose's avatar
Carsten Rose committed
610
611
612
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| type             | checkbox | dateJQW | datetimeJQW | gridJQW  | hidden | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
613
| accept           |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
614
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
615
| alt              |?                                                                                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| autocomplete     |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -      |   -     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| autofocus        |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| checkBoxMode     |   -      |     -   |             |          |        |       |      |          |       |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| checked          |   -      |         |             |          |        |   -   |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| unchecked        |   -      |         |             |          |        |   -   |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| label2           |   -      |         |             |          |        |       |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| itemList         |   -      |         |             |          |        |       |      |          |   -   |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| emptyItemAtStart |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| emptyItemAtEnd   |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
635
636
| emptyHide        |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
Carsten  Rose's avatar
Carsten Rose committed
637
638
639
640
641
642
643
644
645
646
647
648
| accept           |          |         |             |          |        |       |      |          |       |        |           |          |         |   -  3 |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+

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

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

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

649
Checkboxes can be rendered in mode:
Carsten  Rose's avatar
Carsten Rose committed
650

651
* *single*:
Carsten  Rose's avatar
Carsten Rose committed
652

653
  * One column in a table corresponds to one checkbox.
654
  * The value for statuses *checked* and *unchecked* are free to choose.
655
656
  * 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
657

658
659
    * *checkBoxMode* = single (optional)
    * *checked* = <value> (optional, the value which represents 'checked')
Carsten  Rose's avatar
Carsten Rose committed
660

661
      * 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
662

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

665
      * 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
666

667
    * *label2* = <value>       (Text right beside checkbox) (optional)
Carsten  Rose's avatar
Carsten Rose committed
668
669


670
671
* *multi*:

672
  * One column in a table represents multiple checkboxes. This is typically useful for the column type *set*.
673
674
675
676
677
678
679
680
681
682
683
  * 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
    * *orientation*: vertical | horizontal (default), optional - the checkboxes are rendered horizontal or vertical.
    * *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
684
685
686
687

Type: date
^^^^^^^^^^

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

Carsten  Rose's avatar
Carsten Rose committed
692
Type: datetime
693
^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
694

695
696
697
698
699
700
 * 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.

Carsten  Rose's avatar
Carsten Rose committed
701
Type: hidden
702
^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
703
704

Type: input
705
^^^^^^^^^^^
706

707
* General input for text and number.
Carsten  Rose's avatar
Carsten Rose committed
708
709
710
* size:

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

Type: note
714
^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
715
716

Type: radio
717
^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
718

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

721
  * 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
722
723
724

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

      * 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
728
729
730

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

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

733
  * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
Carsten  Rose's avatar
Carsten Rose committed
734
735
736
737
738

* FormElement.'''parameter''':

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

Type: select
743
^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
744

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

747
  * 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
748
749
750
751

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

752
753
      * 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
754
755
756

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

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

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

* FormElement.'''size''':

  * <empty>|0|1: Dropdown list.
764
  * >1: Select field with 'size' rows height. Multiple selection of items is possible.
Carsten  Rose's avatar
Carsten Rose committed
765
766
767
768
769

* FormElement.'''parameter''':

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

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

776
777
778
779
780
781
782
783
'subrecord' will be rendered as HTML table.

* *parameter*

  * *detail*: e.g. *detail=id:gr_id,#{{a}}:p_id,#12:x_id*
  * *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.
Carsten  Rose's avatar
Carsten Rose committed
784

785
786
* *sql1*: SQL query to select records. E.g.::

787
   {{!SELECT a.id AS id, CONCAT(a.street, a.streetnumber) AS a, a.city AS b, a.zip AS c FROM adresse AS a}}
788

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

791
792
  * Exactly one column 'id' has to exist; it specifies the primary record for the target form. If the column 'id' should
    not be shown to the user, it's ok to hide the columen by name it '_id'.
Carsten  Rose's avatar
Carsten Rose committed
793

794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
  * Columnname: *<title>[|<number>][|width=<number>][|nostrip][|icon][|url][|mailto]*

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

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

  * Special column name: *_rowClass*
810
811

    * Define CSS class name(s) which will be rendered in the *<tr class="<_rowClass>">* of the subrecord table.
812
    * By using Bootstrap, the following predefined classes are available:
813

814
815
      * 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)
Carsten  Rose's avatar
Carsten Rose committed
816
817
818
819
820
821
822

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

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

823
Typically not used. Useful if user wishes an explicit 'Submit' Button.
Carsten  Rose's avatar
Carsten Rose committed
824
825
826
827

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

828
829
830
831
* 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.
832

Carsten  Rose's avatar
Carsten Rose committed
833
834
835
836
Type: upload
^^^^^^^^^^^^

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

839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
An upload element is based on a file browse button and a delete button. Only one of them is shown at a time.
If there is no file already uploaded, the file browse button is displayed.

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

* FormElement. *parameter*:

  * *pathFileName*: Destination where to copy the file. A good practice is to specify a relative pathFileName - such an
    installation (filesystem and database) are moveable. If the final pathFileName should contain the original filename,
    the variable *{{_filename}}* can be used. Example::

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


858
859
.. _class-action:

Carsten  Rose's avatar
Carsten Rose committed
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
Class: Action
-------------

Type: before load
^^^^^^^^^^^^^^^^^

* Former: formallow
* Function: a) fire SQL, b) allow / deny access
* respects 'processRow'

Type: after load
^^^^^^^^^^^^^^^^

* Probably not implemented: no usecase.
* Function: fire SQL
* respects 'processRow'

Type: before save
^^^^^^^^^^^^^^^^^

* Former: lookup
* Function: a) fire SQL, b) allow / deny access
* respects 'processRow'

Type: after save
^^^^^^^^^^^^^^^^

887
* Maybe successor of *addnupdate*
Carsten  Rose's avatar
Carsten Rose committed
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
* Function: fire SQL
* respects 'processRow'

Type: before /after insert
^^^^^^^^^^^^^^^^^^^^^^^^^^

* Function: a) fire SQL, b) (before) allow / deny access
* respects 'processRow'

Type: before /after update
^^^^^^^^^^^^^^^^^^^^^^^^^^

* Function: a) fire SQL, b) (before) allow / deny access
* respects 'processRow'

Type: before / after delete
^^^^^^^^^^^^^^^^^^^^^^^^^^^

* Function: a) fire SQL, b) (before) allow / deny access
* respects 'processRow'

Type: addnupdate
^^^^^^^^^^^^^^^^

* Probably not implemented: no usecase. Probably replaced by after save | after insert. Depends on functionality of 'after ...'.

Type: sendmail
^^^^^^^^^^^^^^

* Send mail(s) on request.
* respects 'processRow'

920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
.. _dynamic-update:

Dynamic Update
--------------

Depending of the form requirements, it's necessary to update FormElements depending on the recent user input. E.g. a user
activates a checkbox and therefore the content of a select list should change.

Make a form dynamic:

* Mark all FormElements with {dynamic update}=enabled, which should send **or** receive a 'do update' signal.
* Define the receiving FormElements in a way, that they will interpret the recent user change. In the example, the FormElement
  'carPriceRange' is the sender and the receiving FormElement might be of type 'radio' or 'selectList'.

  [receiving formElement].parameter: itemList={{ SELECT IF({{carPriceRange}}='expensive','Ferrari,Tesla,Jaguar','General Motors,Honda,Seat,Fiat') }}

Carsten  Rose's avatar
Carsten Rose committed
936
937
938
939
940

Report
======


941
942
General
-------
Carsten  Rose's avatar
Carsten Rose committed
943

944
To display a report on any given TYPO3 page, create a content element of type 'QFQ Element' (plugin) on that page.
Carsten  Rose's avatar
Carsten Rose committed
945
946

A simple example
947
^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
948
949

Assume that the database has a table person with columns first_name and last_name. To create a simple list of all persons, we can do the following:
950
951
952
::

    10.sql = SELECT id AS person_id, CONCAT(first_name, " ", last_name, " ") AS name FROM person
Carsten  Rose's avatar
Carsten Rose committed
953

954
10 Stands for a *root level* of the report (see section `Structure`_). 10.sql defines a SQL query for this specific level. When the query is executed it will return a result having one single column name containing first and last name
Carsten  Rose's avatar
Carsten Rose committed
955
956
957
958
959
960
961
962
963
964
965
separated by a space character.

The HTML output displayed on the page resulting from only this definition could look as follows:
::

    Marc MusterElton JohnSpeedy Gonzales

..



966
I.e., QFQ will simply output the content of the SQL result row after row for each single level.
Carsten  Rose's avatar
Carsten Rose committed
967

968
However, we can modify (wrap) the output by setting the values of various keys for each level: 10.rsep=<br/> for example tells QFQ to seperate the rows of the result by a HTML-line break. The final result in this case is:
Carsten  Rose's avatar
Carsten Rose committed
969
970
971

::

972
973
    10.sql = SELECT id AS person_id, CONCAT(first_name, " ", last_name, " ") AS name FROM person
    10.sep = <br />
Carsten  Rose's avatar
Carsten Rose committed
974

975
HTML output:
Carsten  Rose's avatar
Carsten Rose committed
976
977
::

978
    Marc Muster<br />Elton John<br />Speedy Conzales<br />
Carsten  Rose's avatar
Carsten Rose committed
979
980
981
982
983
984
985
986
987
988
989
990
991

..


Syntax
------

    All **root level queries** will be fired in the order specified by 'level' (Integer value).

    For **each** row of a query (this means *all* queries), all subqueries will be fired once.

    *   E.g. if the outer query selects 5 rows, and a nested query always select 3 rows, than the total number of rows are 5 x 3 = 15 rows.

992
    There is a set of **variables** that will get replaced before the SQL-Query gets executed:
Carsten  Rose's avatar
Carsten Rose committed
993

994
        Column values of the recent rows: {{<level>.<columnname>}}
Carsten  Rose's avatar
Carsten Rose committed
995

996
        Global variables: {{global.<name>}}
Carsten  Rose's avatar
Carsten Rose committed
997

998
        Variables from specific stores: {{<name>[:<store/s>[:<sanitize class>]]}}
Carsten  Rose's avatar
Carsten Rose committed
999

1000
        Current row index: {{<level>.line.count}}