Index.rst 132 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
19
20
21
22


Features not implemented now
----------------------------

* Multi Forms
* File upload
23
24
25
* FormElement:
  * type=action (especially not *addNupdate*)
  * field dependencies (activating a parent element, activates child elements and vice versa)
26
  * Checkbox: some combinations not tested.
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

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

QFQ are used by configuring Typo3 content elements. Insert one or more QFQ content element on a Typo3 page.
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)
^^^^^^^^^^^^^^^^^^^^^^^

 +-----------------+---------------------------------------------------------------------------------+
 | 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}} }}** |
 +-----------------+---------------------------------------------------------------------------------+
 | debugShowStack  | In case of an exception, show the call stack. E.g. *debugShowStack = 1*         |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.db      | Select a DB. Only necessary if a different than the standard DB should be used. |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.debug   | Debug Level for *report*                                                        |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.fbeg    | Start token for every field (=column)                                           |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.fend    | End token for every field (=column)                                             |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.head    | Start token for whole <level>                                                   |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.tail    | End token for whole <level>                                                     |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.rbeg    | Start token for row.                                                            |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.rbgd    | Alternating (per row) token                                                     |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.rend    | End token for row. Will be rendered **before** subsequent levels are processed  |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.renr    | End token for row. Will be rendered **after** subsequent levels are processed   |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.rsep    | Seperator token between rows                                                    |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.fsep    | Seperator token between fields (=columns)                                       |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.sql     | SQL Query                                                                       |
 +-----------------+---------------------------------------------------------------------------------+
 | <level>.althead | If <level>.sql is empty, these token will be rendered                           |
+-----------------+----------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
78
79
80
81

Form
----

82
* Forms will be created by using the *Form editor*. The Formeditor itself consist of two regular QFQ forms: *form* and *formElement*
83
84
85
86
87
88
* 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:

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

89
  * The form will create necessary SQL commands for insert, update and delete automatically.
90
91
92
93
94
95
96
97
98

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

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

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

  * 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
99
100


101
102
Variable (incl. mixed SQL Statement)
------------------------------------
Carsten  Rose's avatar
Carsten Rose committed
103
104
105
106
107
108
109

Most fields of a form specification might contain:
* ''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.

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

112
  *{{VarName[:<store / prio>[:<sanitize class>]]}}*
Carsten  Rose's avatar
Carsten Rose committed
113
114
115

* Example:

116
  *{{recordid}}*
Carsten  Rose's avatar
Carsten Rose committed
117

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

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

122
  *{{SELECT name FROM person WHERE id={{key1:C:ALNUMX}} }}*
Carsten  Rose's avatar
Carsten Rose committed
123
124
125

* Leading and tailing spaces inside curly braces are removed.

126
127
  * *{{ SELECT "Hello World"   }}* acts as *{{SELECT "Hello World"}}*
  * *{{ varname   }}* acts as *{{varname}}*
Carsten  Rose's avatar
Carsten Rose committed
128

129
130
131
* There are several stores, from where to retrieve the value. If a value is not found in one store, take the next store,
  until a value has been found.
* If there is an empty string found, this '''is''' a value: value found will stop further search.
Carsten  Rose's avatar
Carsten Rose committed
132
133
134
135
136
* If no value is found, the value is an <empty string>.

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

137
* URL (=GET) Parameter can be used in *forms* and *reports* as variables.
138
* If a value a parameter sanitize class, an exception is thrown.
Carsten  Rose's avatar
Carsten Rose committed
139
140
141
142

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

143
* All values in Store *C* (Client) and store *F* (Form) will be sanitized with one of three classes:
Carsten  Rose's avatar
Carsten Rose committed
144
145
146
147
148

  * **digit**: [0-9].-+
  * **alnumx**: [A-Za-z][0-9]@-_.,; /()
  * **all**: no sanitizing

149
150
* All :ref:`predefined-variable-names` have a specific default sanitize class. For these variables, it's not necessary
  to specify a sanitize class.
Carsten  Rose's avatar
Carsten Rose committed
151
* All other variables (Store: C, F) get by default the sanitize class 'digit'.
152
* A default sanitize class can be overwritten by individual definition: *{{a:C:all}}*
Carsten  Rose's avatar
Carsten Rose committed
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170

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

Only variables, which are known in a specified store, can be substituted.

 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+
 |Name |Description                                                                             | Content                                                              |
 +=====+========================================================================================+======================================================================+
 | F   | Form: data still not saved in database.                                                | 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 one who will 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 for the current row   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+
171
 | D   | The *table.column* specified *default value*.                                          |                                                                      |
Carsten  Rose's avatar
Carsten Rose committed
172
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+
173
 | M   | The *table.column* specified *type*                                                    |                                                                      |
Carsten  Rose's avatar
Carsten Rose committed
174
175
176
177
178
179
180
181
182
183
184
185
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+
 | C   | Client: POST variable, if not found: GET variable                                      | Parameter send from the Client (=Browser).                           |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+
 | T   | Typo3: a) Bodytext (ttcontent record), b) Typo3 internal varibles like fe_user_uid, ...| See Typo3 tt_content record configuration                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+
 | 0   | Value: 0, might helpfull if variable is empty but used in an SQL statement, which      | All possible keys                                                    |
 |     | might produce a SQL error otherwise if substituted with an empty string                |                                                                      |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+
 | Y   | System: a) Database credentials, b) helper vars for logging/debugging:                 |                                                                      |
 |     | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN                                          |                                                                      |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------+

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

189
190
191
  * 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
192
193
194
195
196
197

.. _predefined-variable-names:

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

198
Store: *CLIENT* - C
Carsten  Rose's avatar
Carsten Rose committed
199
200
201
202
203
204
205
206
207
208
209
^^^^^^^^^^^^^^^^^^^

 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | Name          | Explanation                                                                                                                              |
 +===============+==========================================================================================================================================+
 | s             | =SIP                                                                                                                                     |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | r             | record id. Typically stored in SIP, rarely specified on the URL                                                                          |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | keySemId      | always current Semester Id                                                                                                               |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
210
 | keySemIdUser  | *{{keySemIdUser}}*, may be changed by user                                                                                               |
Carsten  Rose's avatar
Carsten Rose committed
211
212
213
214
215
216
217
218
219
220
221
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | pageId        | current T3 page Id                                                                                                                       |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | pageType      | T3 GET Parameter 'type'                                                                                                                  |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | pageLanguage  | T3 GET Parameter 'L'                                                                                                                     |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | HTTP_HOST     | current HTTP HOST                                                                                                                        |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | REMOTE_ADDR   | Client IP address                                                                                                                        |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
222
 | '$_SERVER[*]' | All other variables accessable by *$_SERVER[]*. Only the often used have a pre defined sanitize class.                                   |
Carsten  Rose's avatar
Carsten Rose committed
223
224
225
226
227
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | form          | Unique name of current form                                                                                                              |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | random        | random string with length of 32 chars, alphanum                                                                                          |
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
228
 | ANREDE        | *{{sex}}* == male >> Sehr geehrter Herr, *{{sex}}* == female  Sehr geehrte Frau                                                          |
Carsten  Rose's avatar
Carsten Rose committed
229
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+
230
 | EANREDE       | *{{sex}}* == male >> Dear Mr., *{{sex}}* == female >> Dear Mrs.                                                                          |
Carsten  Rose's avatar
Carsten Rose committed
231
232
 +---------------+------------------------------------------------------------------------------------------------------------------------------------------+

233
Store: *TYPO3* (Bodytext) - T
Carsten  Rose's avatar
Carsten Rose committed
234
235
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Carsten  Rose's avatar
Carsten Rose committed
236
237
238
239
 +---------------+-------------------------------------------------------------------+
 | Name          | Explanation                                                       |
 +===============+===================================================================+
 | form          | Formname defined in ttcontent record bodytext                     |
240
 |               | * fix. E.g. *form = person*                                       |
241
 |               | * via SIP. E.g. *form = {{form}}                                  |
Carsten  Rose's avatar
Carsten Rose committed
242
 +---------------+-------------------------------------------------------------------+
243
 | debugShowStack| Any exception will show the call stack. E.g. *debugShowStack = 1* |
Carsten  Rose's avatar
Carsten Rose committed
244
 +---------------+-------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
245
246
247
248
 | debugLoad     | Debug Level for 'load', defined in ttcontent record bodytext      |
 +---------------+-------------------------------------------------------------------+
 | debugSave     | Debug Level for 'save', defined in ttcontent record bodytext      |
 +---------------+-------------------------------------------------------------------+
249
250
251
 | feUser        | Logged in Typo3 FE User                                           |
 +---------------+-------------------------------------------------------------------+
 | feUserUid     | Logged in Typo3 FE User uid                                       |
Carsten  Rose's avatar
Carsten Rose committed
252
 +---------------+-------------------------------------------------------------------+
253
 | feUserGroup   | FE groups of logged in Typo3 FE User                              |
Carsten  Rose's avatar
Carsten Rose committed
254
 +---------------+-------------------------------------------------------------------+
255
 | ttcontentUid  | Record id of current Typo3 content element                        |
Carsten  Rose's avatar
Carsten Rose committed
256
 +---------------+-------------------------------------------------------------------+
257
258
259
 | typo3PageId   | Record id of current Typo3 page                                   |
 +---------------+-------------------------------------------------------------------+

Carsten  Rose's avatar
Carsten Rose committed
260

261
Store: *FORM* - F
Carsten  Rose's avatar
Carsten Rose committed
262
263
264
265
266
267
268
269
270
271
^^^^^^^^^^^^^^^^^
* 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.

 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name               | Explanation                                                                                                                                |
 +====================+============================================================================================================================================+
272
 | 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
273
274
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+

275
Store: *RECORD* - R
Carsten  Rose's avatar
Carsten Rose committed
276
277
278
279
^^^^^^^^^^^^^^^^^^^
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name               | Explanation                                                                                                                                |
 +====================+============================================================================================================================================+
280
 | 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
281
282
283
284
285
 +--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+

SQL
---

286
287
288
* The detection of an SQL command is case *insensitive*.
* Leading  whitespaces will be skipped.
* The following commands are interpreted as SQL commands:
Carsten  Rose's avatar
Carsten Rose committed
289

290
291
292
293
294
  * SELECT
  * INSERT
  * UPDATE
  * DELETE
  * SHOW
Carsten  Rose's avatar
Carsten Rose committed
295
296
297
298
299

* A SQL Statement might contain parameter, including additional SQL statements. Inner SQL queries will be fired first.
* All variables will be substituted one by one from inner to outer.
* Maximum recursion depth: 5 (a recursion depth of 2 is sometimes used for mailing with templates, 3 and more probably confuses too much and are therefore not practicable, but supported until depth of 5)
* The number of variables inside an input field or a SQL statement is not limited.
300
* 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
301

302
* Example::
Carsten  Rose's avatar
Carsten Rose committed
303

304
305
306
307
308
309
310
311
312
313
314
315
  {{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 ...}}*

  * This is only possible for the most outer SELECT.

Form: basic setup
-----------------
Carsten  Rose's avatar
Carsten Rose committed
316
317

+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
318
| Name                   | Type                                                     | Description                                                                             |
Carsten  Rose's avatar
Carsten Rose committed
319
320
321
322
323
+========================+==========================================================+=========================================================================================+
|id                      | int, autoincrement                                       | created by by MySQL                                                                     |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|name                    | string                                                   | unique and speaking name of the form. Form will be identified by this name              |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
324
|title                   | string                                                   | Title, shown on/above the form.                                                         |
Carsten  Rose's avatar
Carsten Rose committed
325
326
327
328
329
330
331
332
333
334
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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                                                                            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|permitUrlParameter      | textarea                                                 | Braucht es das wircklich? per line one GET-'parameter name' with a class DIGIT, ALNUMX, |
335
|                        |                                                          | ALL. F.e.: *email:ALPHANUM \n postalcode:DIGIT*                                         |
Carsten  Rose's avatar
Carsten Rose committed
336
337
338
339
340
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|render                  | enum('plain','table', 'bootstrap')                       | Default bootstrap                                                                       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiMode               | enum('none','horizontal','vertical')                     | Default 'none'                                                                          |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
341
|multiSql                | text                                                     | Optional. SQL Query which selects all records to edit.                                  |
Carsten  Rose's avatar
Carsten Rose committed
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|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                                      |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
357
|parameter               | text                                                     | Misc additional parameters. See :ref:`form-parameter`                                   |
Carsten  Rose's avatar
Carsten Rose committed
358
359
360
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|deleted                 | string                                                   | 'yes'|'no'.                                                                             |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
361
|modified                | timestamp                                                | updated autmatically through stored procedure                                           |
Carsten  Rose's avatar
Carsten Rose committed
362
363
364
365
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|created                 | datetime                                                 | set once through QFQ                                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+

366
.. _form-parameter:
Carsten  Rose's avatar
Carsten Rose committed
367

368
369
Field: Form.parameter
^^^^^^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
370

371
* The following parameter are optional and can be configured in the *Form.parameter* field.
Carsten  Rose's avatar
Carsten Rose committed
372
373
374
375
376
377
378
379
380

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

381
382
383
384
385
386
387
388
389
390
391
392
393
* Example:

  maxVisiblePill = 5
  class = container-fluid

FormElements
------------
* Each *form* contains one or more *FormElement*.
* The *FormElements* are divided in three categories:
  
  * *native*
  * *container*
  * *action*
Carsten  Rose's avatar
Carsten Rose committed
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422

* Ordering and grouping: Native Form-Elements and Container-Elements, both with feIdContainer=0 will ordered by 'ord'.
* Inside of a container, all nested elements will be displayed.

Class: Container
----------------

* Pill's are container for 'fieldset' and 'native' Form-Elements.
* Fieldsets are container for 'native' Form-Elements

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

* Native Formelements might be assigned to a fieldset.
* name: technical name, used as HTML identifier.
* label: Shown title of the fieldset.

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

* Pill is a synonym for a tab. A pill looks like a tab.
* Pill's are only available with mode render='bootstrap'.
* If there is a pill defined, every native Formelements needs to be assigned to a pill or to a fieldset.
* If there is a pill defined, every fieldset needs to be assigned to a pill.

* Parameter:

  * FormElement.'''name''': technical name, used as HTML identifier.
  * FormElement.'''label''': Label shown on the corresponding pill button or inside the dropdown menu.
423
  * FormElement.'''type''': *pill*
Carsten  Rose's avatar
Carsten Rose committed
424
  * FormElement.'''feIdContainer''': 0  # Pill's can't be nested.
425
  * Form.'''Parameter''': *maxVisiblePill=<nr>* Number of Pill-Buttons shown. Undefined means unlimited. Remaining Pill buttons, not shown, will be displayed as a dropdown menu.
Carsten  Rose's avatar
Carsten Rose committed
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444

Class: Native
-------------

+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| Name         | Type                        | Description                                                                                       |
+==============+=============================+===================================================================================================+
| id           | int                         |                                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| formId       | int                         |                                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feIdContainer | int                         |                                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|enabled       | enum('yes'|'no')            |                                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|name          | string                      |                                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|label         | string                      | Label of formelement. Depending on layout model, left or on top of the formelement                |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
445
446
447
448
|mode          | enum('show', 'readonly',    | Default: normal - *Normal*: regular user input field. *Readonly* : user can't change any data.    |
|              | 'required',  'lock',        | *Important* : user manipulated data wont be saved. *Required* User has to specify a value.        |
|              | 'disable' )                 | Typically, an <empty string> represents 'no value' . *lock* form element is read only and grayed  |
|              |                             | out, *disable*: form element is not visible                                                       |
Carsten  Rose's avatar
Carsten Rose committed
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|class         | enum('native', 'action',    | Details below.                                                                                    |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|              | 'container')                |                                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|type          | enum('checkbox', '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' )'.          |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkType     | enum('min|max', 'pattern',  |                                                                                                   |
|              | 'number', 'email')          |                                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkPattern  | 'regexp'                    |if $check_type=='pattern': pattern to match                                                        |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|onChange      | string                      |list of 'form element names' of current form, separated by ', ', If one of the named form elements |
|              |                             | change, reload own data / status / mode                                                           |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|ord           | string                      |display order of form elements ('order' is a reserved keyword)                                     |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|tabindex      | string                      |HTML tabindex attribute                                                                            |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|size          | string                      |Visible length of input element. Might be ommited, depending on the choosen form layout            |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|maxLength     | string                      |Maximum characters for input.                                                                      |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|note          | string                      |Note of formelement. Depending on layout model, right or below of the formelement                  |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|tooltip       | text                        |Display this text as tooltip on mouse over                                                         |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|placeholder   | string                      | text, displayed inside the input element in light grey                                            |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|clientJs      | text                        |Javascript called on 'on change' formelements                                                      |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|value         | text                        |Default value                                                                                      |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|sql1          | text                        |SQL query  ('sql' is a reserved keyword)                                                           |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|sql2          | text                        |second SQL query                                                                                   |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|parameter     | text                        |might contain misc parameter. Depends on the type of formelement.                                  |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feGroup       | string                      | Comma separated list of Typo3 FE Group ID. NOT SURE IF THIS WILL BE IMPLEMENTED. Natvie           |
|              |                             | formElements, fieldsets and pills can be assigned to feGroups. Group status: show, hidden,        |
|              |                             | disabled. Group Access: FE-Groups. User will be assigned to FE-Groups and the form defintion      |
|              |                             | reference such FE-groups. Easy way of granting permission.                                        |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|deleted       | string                      |'yes'|'no'.                                                                                        |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|modified      | timestamp                   |updated autmatically throught stored procedure                                                     |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|created       | datetime                    |set once through QFQ                                                                               |
+--------------+-----------------------------+---------------------------------------------------------------------------------------------------+


+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| Attribute        | checkbox | dateJQW | datetimeJQW |  gridJQW | hidden | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
+==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+==========+=========+========+
|id                |<-14> Internal id                                                                                                                          |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|formId            |<-14> Form                                                                                                                                 |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|containerId       |<-14> Assign the Formelement to user defined fieldSet or pill                                                                              |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|enabled           |<-14> Formelement is active or not                                                                                                         |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|name              |<-14> Name of a column of the primary table. Formelements with a corresponding table will be saved automatically.                          |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|label             |<-14> Label shown to the user.                                                                                                             |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|mode              |<-14> show, readonly, required, lock, disable.                                                                                             |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|class             |<-14> native                                                                                                                               |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|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             |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|sql1              |<-14> ?                                                                                                                                    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|sql2              |<-14> ?                                                                                                                                    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|<-15 rowbgcolor="#eeeeee"> Additional attributes in Field 'parameter'. Typically in key=value format.                                                         |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| type             | checkbox | dateJQW | datetimeJQW | gridJQW  | hidden | input | note | password | radio | select | subrecord | textarea | timeJQW | upload |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| accept           |<-15> ?                                                                                                                                    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| alt              |<-15> ?                                                                                                                                    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| autocomplete     |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -      |   -     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| autofocus        |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -      |   -     |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| checkBoxMode     |   -      |     -   |             |          |        |       |      |          |       |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| checked          |   -      |         |             |          |        |   -   |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| unchecked        |   -      |         |             |          |        |   -   |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| label2           |   -      |         |             |          |        |       |      |          |   -   |        |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| itemList         |   -      |         |             |          |        |       |      |          |   -   |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| emptyItemAtStart |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| emptyItemAtEnd   |          |         |             |          |        |       |      |          |       |   -    |           |          |         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| 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)


Class: native
^^^^^^^^^^^^^

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

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

596
Checkboxes can be rendered in mode:
Carsten  Rose's avatar
Carsten Rose committed
597

598
* *single*:
Carsten  Rose's avatar
Carsten Rose committed
599

600
601
602
603
  * One column in a table corresponds to one checkbox.
  * The value for stati *checked* and *unchecked* are free to choose.
  * 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
604

605
606
    * *checkBoxMode* = single (optional)
    * *checked* = <value> (optional, the value which represents 'checked')
Carsten  Rose's avatar
Carsten Rose committed
607

608
      * 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
609

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

612
      * 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
613

614
    * *label2* = <value>       (Text right beside checkbox) (optional)
Carsten  Rose's avatar
Carsten Rose committed
615
616


617
618
619
620
621
622
623
624
625
626
627
628
629
630
* *multi*:

  * One column in a table represents multiple checkboxes. This is typically usefull for the column type *set*.
  * 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
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656

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

Type: datetime
^^^^^^^^^^^^^^^^^^^^

Type: hidden
^^^^^^^^^^^^^^^^^^^^

Type: input
^^^^^^^^^^^^^^^^^^^^
* General tnput for text and number.
* size:

  * <number>:  width of input element in characters. Lineheight = 1.
  * <cols>,<rows>: inpit element = textarea, width=<cols>, height=<rows>

Type: note
^^^^^^^^^^^^^^^^^^^^

Type: radio
^^^^^^^^^^^^^^^^^^^^

* Radio Buttons will be build from one of three sources:

657
  * 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
658
659
660

    * Resultset format 'named': column 'label' and optional a column 'id'.
    * Resultset format 'index':
661
662
    * One column in resultset >> first column represent *label*
    * Two or more columns in resultset >> first column represent *id* and the second column represent *label*.
Carsten  Rose's avatar
Carsten Rose committed
663
664
665

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

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

668
  * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
Carsten  Rose's avatar
Carsten Rose committed
669
670
671
672
673
674
675
676
677
678
679

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

Type: select
^^^^^^^^^^^^^^^^^^^^

* Select lists will be build from one of three sources:

680
  * 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
681
682
683
684

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

685
686
      * One column in resultset >> first column represent *label*
      * Two or more columns in resultset >> first column represent *id* and the second column represent *label*.
Carsten  Rose's avatar
Carsten Rose committed
687
688
689

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

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

692
  * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
Carsten  Rose's avatar
Carsten Rose committed
693
694
695
696
697
698
699
700
701
702
703
704
705
706

* FormElement.'''size''':

  * <empty>|0|1: Dropdown list.
  * >1: Select field with 'size' rows height. Multiple selection of items are possible.

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

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

707
708
709
710
711
712
713
714
'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
715

716
717
718
719
720
721
722
* *sql1*: SQL query to select records. E.g.::

   {{!SELECT a.id AS id, CONCAT(a.strasse, a.hausnummer) AS a, a.city AS b, a.zip AS c FROM adresse AS a}}

   # Remark 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 and specifies the primary record for the target form.
Carsten  Rose's avatar
Carsten Rose committed
723

724
* Columnname: *<title>[|<number>][|width=<number>][|nostrip][|icon][|url][|mailto]*
Carsten  Rose's avatar
Carsten Rose committed
725

726
727
728
729
730
731
732
  * *<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 *fileadmin/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'''.
Carsten  Rose's avatar
Carsten Rose committed
733
734
  * The parameters are position independet.
  * Examples::
735

Carsten  Rose's avatar
Carsten Rose committed
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
    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' ...


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

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

Typical not used. Usefull if user wisches an explicit 'Submit' Button.

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

Type: upload
^^^^^^^^^^^^

* See: https://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)
755
* parameter:accept: *image/*,video/*,audio/*,.doc,.docx,.pdf,<mime type>*
Carsten  Rose's avatar
Carsten Rose committed
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783

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

784
* Maybe successor of *addnupdate*
Carsten  Rose's avatar
Carsten Rose committed
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
* 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'


Report
======


How to create a report
----------------------

825
To display a report on a given TYPO3 page, create a content element of type formreport (plugin) on that page.
Carsten  Rose's avatar
Carsten Rose committed
826
827

A simple example
828
^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
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
887
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
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992

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:

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

..



I.e. formreport will simply output the content of the SQL result row after row for each single level.

However, we can modify (wrap) the output by setting the values of various ?keys for each level: 10.rsep=<br/> for example tells formreport to seperate the rows of the result by a HTML-line break. The final result then is

::


    Marc Muster<br />Elton John<br />Speedy Conzales<br />

..



which gives us the desired simple list (we use linebreaks for simplicity here) when displayed by a browser:

::


    Marc Muster
    Elton John
    Speedy Conzales

..



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.

    There is a set of **variables** that will get replace before the SQL-Query gets executed:

        Column values of the recent rows: ~<level>.<columnname>

        Global variables: ~global.<name>

        Sanitized URL (Post/Get) variables: ~url.<name>

        Row index and total rows: ~<level>.line.count|total

        'last_insert_id' and 'affected_rows': ~<level>.line.total

        See ?Variables for a full list of all available variables.

    Different types of SQL queries are possible: SELECT, INSERT, UPDATE, DELETE, SHOW

    Only SELECT and SHOW queries will fire subqueries.

*   Processing of the resulting rows and columns:

    *   In general, all columns of all rows will be printed out sequentially.

        On a per column base, printing of columns can be suppressed. This might be useful to select values which will be accesed later on in another query via the ~level.columnname variable. To suppress printing of a column, use a
        underscore as column name prefix.

        Reserved column names have a special meaning and will be processed in a special way. See ?Processing of columns in the SQL result for details.

        There are extensive ways to ?wrap columns and rows automatically.

Structure
---------

A report can be divided into several levels. This can make report definitions more readable because it allows to split otherwise excessively long SQL queries. For example, if your SQL query on the root level selects a number of person
records from your person table, you can use the SQL query on the second level to look up the city where each person lives.

See the example below:

::


    10.sql = SELECT id as _person_id, concat(first_name, " ", last_name, " ") as name FROM person
    10.sep = <br />

    10.10.sql = SELECT concat(postal_code, " ", city) FROM address WHERE p_id = ~10._person_id
    10.10.rbeg = (
    10.10.rend = )

..



This would result in

::


    Marc Muster (3004 Bern)
    Elton John (8008 Zürich)
    Speedy Conzales (3012 Bern)

..



Columns of the upper level result can be accessed via variables, eg. ~10._person_id will be replaced by the value in the _person_id column.

Certain column names have a special meaning. Their content will be processes in a special way. For example columns with a leading _ in their name will not get displayed, their content will only be available as variables (see _person_id in
the example above).

+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Levels**   |A report is divided into levels. Example 1 has 3 levels **10**, **20.20**, **20.30.10**                                                                                                                                      |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Qualifier**|A level is divided into qualifiers **20.30.10** has 3 qualifiers **20**, **30**, **10**                                                                                                                                      |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Root       |Is a level with one qualifier. Example 1 has 2 root levels *10* and *20*.                                                                                                                                                    |
|levels**     |                                                                                                                                                                                                                             |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Sub        |Is a level with more than one qualifier. Example 1 has 2 sub levels **20.20** and **20.30.10**                                                                                                                               |
|levels**     |                                                                                                                                                                                                                             |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Child**    |The level **20** has one child **20.20**                                                                                                                                                                                     |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Parent**   |The level 20.20 has a parent **20**                                                                                                                                                                                          |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Example    |**10** and **20** is a root level and will be executed independently. **10** don't have a sub level. **20.20** will be executed as many times as **20** has row numbers. **20.30.10** won't be executed because there isn't  |
|explanation**|any **20.30** level                                                                                                                                                                                                          |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+


Report Example 1:

::


    # Displays current date
    10.sql = SELECT CURDATE()

    # Show all students from the person table (_p_id won't be shown because of the leading underscore)
    20.sql = SELECT p.id AS _p_id, p.first_name, " - ", p.last_name FROM person AS p WHERE p.typ LIKE "student"

    # Show all the marks from the current student ordered chronological
    20.20.sql = SELECT e.mark FROM exam AS e WHERE e.p_id=~20._p_id ORDER BY e.date

    # This query will never be fired, cause there is no direct parent called 20.30.
    20.30.10.sql = SELECT 'never fired'

..


Wrapping rows and columns: Level keys
-------------------------------------

993
994
995
Order and nesting of queries, will be defined with a typoscript similar syntax: level.sublevel1.subsublevel2. ...
Each 'level' directive needs a final keys, e.g: 20.30.10.**sql**. To process a level a key **sql** is necessary.
All `QFQ Keywords (Bodytext)`_.
Carsten  Rose's avatar
Carsten Rose committed
996
997
998
999

Processing of columns in the SQL result
---------------------------------------

1000
1001
1002
1003
* The content of all columns of all rows will be printed sequentially, without separator.
* Rows with `Special column names`_  will be processed in a special way.
* Column names, which start with a '_', will not be printed. This is useful if you only want to access the content of
  some columns during later on via the ~<level>.<column> variable but don't want to print the content of those columns.
Carsten  Rose's avatar
Carsten Rose committed
1004

1005
1006
Special column names
********************
Carsten  Rose's avatar
Carsten Rose committed
1007

1008
1009
1010
* The input parameters for the processing function are stored as as column values.
* Single parameters are delimited by the '|' character.
* Parameters are identified by the function either
Carsten  Rose's avatar
Carsten Rose committed
1011

1012
1013
  * by their **order**
  * or by a **one character qualifier** followed by the : character, placed in front of the actual parameter value.
Carsten  Rose's avatar
Carsten Rose committed
1014
1015

+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1016
|**Special column name** | **Purpose**                                                                                                                                                                                  |
Carsten  Rose's avatar
Carsten Rose committed
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_<someName>             |Suppress output. Column names with leading underscore are used to select data from the database and make it available in other parts of the report without generating any output.            |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?link                   |Easily create links with different features.                                                                                                                                                 |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?mailto                 |Quickly create email links. A click on the link will open the default mailer. The address is encrypted via JS against email bots.                                                            |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?pageX or PageX         |Shortcut version of the link interface for fast creation of internal links. The column name is composed of the string *page*/*Page* and a optional character to specify the type of the link.|
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?sendmail               |Send emails.                                                                                                                                                                                 |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?exec                   |Run batch files or excutables on the webserver.                                                                                                                                              |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?vertical               |Render Text vertically. This is usefull for tables with limited column width.                                                                                                                |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?img                    |Display images.                                                                                                                                                                              |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?F                      |Wrap/modify content. Undocumented.                                                                                                                                                           |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+


Column: link
1039
************
Carsten  Rose's avatar
Carsten Rose committed
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063

{{url | display | **i (intern)**, e(extern) | **- (same)**,n (new), p (parent), t(top) | **-**, (e(edit), c(copy), n(new), d(delete), i(insert) , f(file)) }}

    Most of URLs will be rendered via link.

    Columnnames like pagee, mailto,... are wrapper to link.

    The parameters for link contains a prefix to make them position independet.

*   For less conflicts:

        A:<u|m|p>:<url|mail|page> (A=Anchor)

        G:<ENTIMC> (G=Grafic)

        G:<PbC>:<color|Text> (G=Grafic)

+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|URL|IMG|Meaning   |Qualifier                          |Example                    |Description                                                                                                                             |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Anchor    |A:...                              |See above                  |Superclass for regular URL defnition                                                                                                    |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Grafic    |G:...                              |See above                  |Superclass for grafic definiton                                                                                                         |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
1064
|x  |   |URL       |u:<url>                            |u:http://www.example.com   |If an image is specified, it will be rendered inside the link, default link class: external                                             |
Carsten  Rose's avatar
Carsten Rose committed
1065
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
1066
|x  |   |Mail      |m:<email>                          |m:info@example.com         |Default link class: email                                                                                                               |
Carsten  Rose's avatar
Carsten Rose committed
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|x  |   |Page      |p:<pageId>                         |p:impressum                |'?' is prepended, no hostname qualifier (will be set automatically by the browser), default link class: internal                        |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Text      |t:<text>                           |t:Firstname Lastname       |-                                                                                                                                       |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Render    |r:<mode>                           |r:[0-5]                    |Rendering mode: see below. Default: 0                                                                                                   |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Picture   |P:<filename>                       |P:bullet-red.gif           |Picture '<imgsrc="bullet-red.gif"alt="....">', default link class: internal.                                                            |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Edit      |E                                  |E                          |Show 'edit' icon as image                                                                                                               |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |New       |N                                  |N                          |Show 'new' icon as image                                                                                                                |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Delete    |D                                  |D                          |Show 'delete' icon as iamge                                                                                                             |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Help      |H                                  |H                          |Show 'help' icon as iamge                                                                                                               |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Info      |I                                  |I                          |Show 'information' icon as iamge                                                                                                        |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Show      |S                                  |S                          |Show 'show' icon as iamge                                                                                                               |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Bullet    |B:[<color>]                        |B:green                    |Show bullet with '<color>'. Colors: blue, gray, green, pink, red, yellow. Default Color: green.                                         |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |x  |Check     |C:[<color>]                        |C:green                    |Show checked with '<color>'. Colors: blue, gray, green, pink, red, yellow. Default Color: green.                                        |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |URL Params|U:<key1>=<value1>[&<keyN>=<valueN>]|U:a=value1&b=value2&c=...] |Any number of additional Params. Links to forms: U:form=Person&r=1234                                                                   |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Tooltip   |o:<text>                           |o:More information here    |Tooltip text                                                                                                                            |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Alttext   |a:<text>                           |a:Name of person           |Alttext for images                                                                                                                      |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Class     |c:[n|i|e|<text>]                   |c:i                        |CSS class for link. n:no class attribut, i:internal (ext_localconf.php)(default), e:external (ext_localconf.php), <text>: explicit named|
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Target    |g:<text>                           |g:_blank                   |target=_blank, Default: no target                                                                                                       |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Question  |q:<text>                           |q:please confirm           |Link will be executed only if user clicks ok                                                                                            |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Encryption|e:0|1|...                          |e:1                        |Encryption of the mail: 0: no encryption, 1:via Javascript (default)                                                                    |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Right     |R                                  |R                          |Defines picture position: Default is 'left' (no definition) of the 'text'. 'R' means 'right' of the 'text'                              |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|   |   |Hash      |h                                  |h                          |An hash entry is generated with all Parameter. No other URL parameter than 'S_hash' (=hash)                                             |
+---+---+----------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+


**Render mode**

+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+
|Mode       |Both: url & text    |Only: url          |Only: text|Description                                                        |
+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+
|0 (default)|<a href=url>text</a>|<a href=url>url</a>|          |text or image will be shown, only if there is a url, page or mailto|
+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+
|1          |<a href=url>text</a>|<a href=url>url</a>|text      |Text or image will be shown, independet of there is a url          |
+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+
|2          |<a href=url>text</a>|                   |          |no link if text is empty                                           |
+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+
|3          |text                |url                |text      |no link, only text or image                                        |
+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+
|4          |url                 |url                |url       |no link, show text, if text is empty, show url                     |
+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+
|5          |                    |                   |          |nothing at all                                                     |
+-----------+--------------------+-------------------+----------+-------------------------------------------------------------------+


Link Examples
'''''''''''''

+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|SQL-Query                                                           |Result                                                                                                                                  |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"m:info@example.com"aslink                                    |info@example.com as linked text, encrypted with javascript, class=external                                                              |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"m:info@example.com|c:0"aslink                                |info@example.com as linked text, not encrypted, class=external                                                                          |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"m:info@example.com|P:mail.gif"aslink                         |info@example.com as linked image mail.gif, encrypted with javascript, class=external                                                    |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
1143
|select"m:info@example.com|P:mail.gif|o:sendmail"aslink              |*info@example.com*_ as linked image mail.gif, encrypted with javascript, class=external, tooltip: "sendmail"                            |
Carsten  Rose's avatar
Carsten Rose committed
1144
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
1145
|select"m:info@example.com|t:mailtoinfo@example.com|o:sendmail"aslink|'mail to *info@example.com*_' as linked text, encrypted with javascript, class=external                                                 |
Carsten  Rose's avatar
Carsten Rose committed
1146
1147
1148
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"u:www.example.com"aslink                                     |www.example as link, class=external                                                                                                     |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
1149
|select"u:http://www.example.com"aslink                              |*http://www.example*_ as link, class=external                                                                                           |
Carsten  Rose's avatar
Carsten Rose committed
1150
1151
1152
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"u:www.example.com|q:Pleaseconfirm"aslink                     |www.example as link, class=external, ?JavaScript Window which has to be confirmed with click on 'ok'                                    |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
1153
|select"u:www.example.com|c:i"aslink                                 |*http://www.example*_ as link, class=internal                                                                                           |
Carsten  Rose's avatar
Carsten Rose committed
1154
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
1155
|select"u:www.example.com|c:nicelink"aslink                          |*http://www.example*_ as link, class=nicelink                                                                                           |
Carsten  Rose's avatar
Carsten Rose committed
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"p:form_person|c:e"aslink                                     |<a class="external" href="?form_person">Text</a>                                                                                        |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"p:form_person&S_person=Text|t:Person"aslink                  |<a class="internal" href="?form_person&S_person=Text">Person</a>                                                                        |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"p:form_person|e"aslink                                       |<a class="internal" href="?form_person"><img alttext="Edit" src="fileadmin/typo3conf/ext/formreport/icons/edit.gif"></a>                |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"p:form_person|e|g:_blank"aslink                              |<a target="_blank" class="internal" href="?form_person"><img alttext="Edit" src="fileadmin/typo3conf/ext/formreport/icons/edit.gif"></a>|
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"p:form_person|C"aslink                                       |<a class="internal" href="?form_person"><img alttext="Check" src="fileadmin/typo3conf/ext/formreport/icons/checked-green.gif"></a>      |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"p:form_person|C:green"aslink                                 |<a class="internal" href="?form_person"><img alttext="Check" src="fileadmin/typo3conf/ext/formreport/icons/checked-green.gif"></a>      |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"A:p:form_person|G:C"aslink                                   |<a class="internal" href="?form_person"><img alttext="Check" src="fileadmin/typo3conf/ext/formreport/icons/checked-green.gif"></a>      |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|select"A:u:www.example.com|G:P:home.gif|t:Home"aslink               |<a class="internal" href="?form_person"><img alttext="Check" src="ffileadmin/typo3conf/ext/formreport/icons/home.gif">Home</a>          |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+


1175
1176
Columns: pageX & PageX
**********************
Carsten  Rose's avatar
Carsten Rose committed
1177

1178
1179
These columns provide a shortcut version of the link interface to use for fast creation of internal links. The colum name
is composed of the string *page* and a optional character to specify the type of the link.
Carsten  Rose's avatar
Carsten Rose committed
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256

[<page id|alias>[&param=value&...]] | [record id] | [text] | [tooltip] | [msgbox] | [class] | [target] | [render mode] | [create hash] "" as pagee Fastest way to create links, inside of the current T3 installation. Main purpose is the
automatic hash to be used by the forms

**Syntax**

::

    select "[options]" as page[<link type>]
    where

    [options] = [<page>]|[<record id>]|[<text>]|[<tooltip>]|[<msgbox>]|[<class>]|[<target>]|[<render mode>]|[<create hash>]

    <link type> = c,d,e,h,i,n,s

..

The following table summarizes all available page colomns. For most link types, all parameters are optional. If some parameters are required by a certain link type, this is indicated in the *Mandatory parameters* colomn of the table
below.

+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|**column name**|**Purpose**                                    |**create hash**|**default value of msgbox parameter**|**Mandatory parameters**                      |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|page           |Internal link without a grafic                 |no             |empty                                |p:<pageId>                                    |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|pagec          |Internat link without a grafic, with messagebox|no             |*Please confirm!*                    |p:<pageId>                                    |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|paged          |Internal link with delete icon (trash)         |yes            |*Delete record ?*                    |p:<pageId>,i:<id>,T:<table name>|f:<form name>|
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|pagee          |Internal link with edit icon (pencil)          |yes            |empty                                |p:<pageId>,i:<id>                             |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|pageh          |Internal link with help icon (questionmark)    |yes            |empty                                |p:<pageId>                                    |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|pagei          |Internal link with information icon (i)        |no             |empty                                |p:<pageId>                                    |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|pagen          |Internal link with new icon (sheet)            |yes            |empty                                |p:<pageId>                                    |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+
|pages          |Internal link with how icon (magnifier)        |yes            |empty                                |p:<pageId>                                    |
+---------------+-----------------------------------------------+---------------+-------------------------------------+----------------------------------------------+


*   All paramater are optional.

*   Optional set of predefined icons.

*   Optional set of dialog boxes.

*   If there is a hash, parameter S_hash ('hash') und N_r ('pseudo record id') will automatically be registered and appended.

+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|**Parameter**|**Description**                                                                                  |**Default value**                                         |Example                                                        |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<page>       |TYPO3 page id or page alias.                                                                     |The current page: *~pageId*                               |45 application application&N_param1=1045                       |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<recordid>   |Effective Record ID stored in hash array.                                                        |<empty>                                                   |7011                                                           |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<text>       |Text, wraped by the link. If there is an icon, text will be displayed right of it.               |empty string                                              |                                                               |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<tooltip>    |Text to appear as a ?ToolTip                                                                     |empty string                                              |                                                               |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<msgbox>     |If there is a msgbox text given, a msgbox will be opened. Only if the user clicks on ok, the link|**Expected "=" to follow "see"**                          |                                                               |
|             |will be called                                                                                   |                                                          |                                                               |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<class>      |CSS Class for the a tag                                                                          |The default class defined for internal links in           |                                                               |
|             |                                                                                                 |ext_localconf.php (see ...)                               |                                                               |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<target>     |arameter for HTML 'target='. F.e.: Opens a new window                                            |empty                                                     |P                                                              |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<rendermode> |Easy way not to show/render a link at all. Render modes (0-5) are defined in table **Render      |0                                                         |5                                                              |
|             |mode** in section ?link                                                                          |                                                          |                                                               |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<createhash> |h                                                                                                |see below                                                 |'h': create a hash, 'H': create no hash. Specify only if       |
|             |                                                                                                 |                                                          |default is not suitable                                        |
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+


Column: vertical
1257
****************
Carsten  Rose's avatar
Carsten Rose committed
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311

Render text vertically. This is useful for tables with limited column width. The vertical rendering is achieved via CSS tranformations (rotation) defined in the style attribute of the wrapping tag. You can optionally specify the rotation
angle.

**Syntax**

::


    select "<text>|[<angle>]|[<width>]|[<height>]|[<wrap tag>]" as vertical

..



+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
|**Parameter**|**Description**                                                                                        |**Default value**|
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
|<text>       |The string that should be rendered vertically.                                                         |none             |
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
|<angle>      |How many degrees should the text be rotated? The angle is measured clockwise from baseline of the text.|*270*            |
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
|<width>      |Width (of what?). Needs to have a CSS_unit (e.g. px, em) specified. (Implemented?)                     |*1em*            |
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
|<height>     |Height (of what?). Needs to have a CSS-unit (e.g. px, em) specified. (Implemented?)                    |none             |
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
|<wraptag>    |What tag should be used to wrap the vertical text? Possible options are *div*, *span*, etc.            |*div*            |
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+


**Minimal Example**

::


    10.sql = select "Hallo" as vertical

..



**Advanced Examples**

::


    10.sql = select "Hallo|90" as vertical
    20.sql = select "Hallo|90|3em|7em|span" as vertical

..



Column: mailto
1312
**************
Carsten  Rose's avatar
Carsten Rose committed
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360

Easily create Email links.

**Syntax**

::


    select "<email address>|[<link text>]" as mailto

..



+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
|**Parameter** |**Description**                                                                                                                                                                                               |**Default    |
|              |                                                                                                                                                                                                              |value**      |
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
|<emailaddress>|The email address where the link should point to.                                                                                                                                                             |none         |
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
|<linktext>    |The text that should be displayed on the website and be linked to the email address. This will typically be the name of the recipient. If this parameter is omitted, the email address will be displayed as   |none         |
|              |link text.                                                                                                                                                                                                    |             |
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+


**Minimal Example**

::


    10.sql = select "john.doe@example.com" as mailto

..



**Advanced Example**

::


    10.sql = select "john.doe@example.com|John Doe" as mailto

..



Column: sendmail
1361
****************
Carsten  Rose's avatar
Carsten Rose committed
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415

Send simple plain text emails. Every mail will be logged in the mail log. The logfile can be configured in ext_localconf.php via $TYPO3_CONF_VARS[$_EXTKEY]['log']['mail'].

**Syntax**

::


    select "receiver@domain.com[:john doe],receiver2@domain.com[:jane doe]|sender@domain.com[:willi wutzmann]|subject|body" as sendmail

..



+------------------------------------------------------------+------------------------------------------------------------------------------------------+------------+
|**Parameter**                                               |**Description**                                                                           |**Required**|
+------------------------------------------------------------+------------------------------------------------------------------------------------------+------------+
|receiver@domain.com[:johndoe],receiver2@domain.com[:janedoe]|Comma-separated list of Email-receiver(s). An optional name can be added using a colon (:)|            |
+------------------------------------------------------------+------------------------------------------------------------------------------------------+------------+
|sender@domain.com[:williwutzmann]                           |Sender of the email. An optional name can be added using a colon (:)                      |            |
+------------------------------------------------------------+------------------------------------------------------------------------------------------+------------+
|subject                                                     |Subject of the email                                                                      |            |
+------------------------------------------------------------+------------------------------------------------------------------------------------------+------------+
|body                                                        |Message                                                                                   |            |
+------------------------------------------------------------+------------------------------------------------------------------------------------------+------------+


**Minimal Example**

::


    10.sql = select "john.doe@example.com|company@example.com|Latest News|The new version of FormReport is now available." as sendmail

..



This will send an email with subject *Latest News* from company@example.com to john.doe@example.com.

**Advanced Examples**

::


    10.sql = select "customer1@example.com, customer2@example.com|company@example.com|Latest News|The new version of FormReport is now available." as sendmail

..



This will send an email with subject *Latest news* from company@example.com to customer1@example.com and to customer2@example.com.

Column: advancedmail
1416
********************
Carsten  Rose's avatar
Carsten Rose committed
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453

Send plain text/html emails. This is identical to ?t#Column:_sendmail, but allows to additionaly set the cc:, bcc: and reply-to: -headers. Every mail will be logged in the mail log. The logfile can be configured in ext_localconf.php via
$TYPO3_CONF_VARS[$_EXTKEY]['log']['mail'].

**Syntax**

::


    select "receiver@domain.com[:john doe],receiver2@domain.com[:jane doe]|sender@domain.com[:willi wutzmann]|subject|cc1@domain.com[:willi wutzmann]|bcc1@domain.com[:george wutzmann]|replyto@domain.com[:Support-Desk]|format|body" as sendmail

..



+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|**Parameter**                                               |**Description**                                                                               |**required**|
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|receiver@domain.com[:johndoe],receiver2@domain.com[:janedoe]|Comma-separated list of Email-receiver(s). An optional name can be added using a colon (:)    |            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|sender@domain.com[:williwutzmann]                           |Sender of the email. An optional name can be added using a colon (:)                          |            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|subject                                                     |Subject of the email                                                                          |            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|cc1@domain.com[:williwutzmann]                              |Comma-separated list of CC-receiver(s). An optional name can be added using a colon (:)       |            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|bcc1@domain.com[:georgewutzmann]                            |Comma-separated list of BCC-receiver(s). An optional name can be added using a colon (:)      |            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|replyto@domain.com[:Support-Desk]                           |Reply-to address. An optional name can be added using a colon (:)                             |            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|format                                                      |Flag indicating if this is a plaintext or html message. Possible values are 'plain' and 'html'|            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
|body                                                        |Message (plain text or html)                                                                  |            |
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+


Column: img
1454
***********
Carsten  Rose's avatar
Carsten Rose committed
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513

Render images. Allows to define a alternative text and a title attribute for the image. Alternative text and title text are optional.

    If no alternative text is defined, an empty alt attribute is rendered in the img tag (since this attribute is mandatory in HTML).

*   If no title text is defined, the title attribute will not be rendered at all.

**Syntax**

::


    select "<path to image>|[<alt text>]|[<title text>]" as img

..



+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|**Parameter**|**Description**                                                                            |**Default value/behaviour**|
+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|<pathtoimage>|The path to the image file.                                                                |none                       |
+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|<alttext>    |Alternative text. Will be displayed if the image can't be loaded (altattribute of img tag).|empty string               |
+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|<titletext>  |Text that will be output as image title in the title attribute of the img tag.             |no title attribute rendered|
+-------------+-------------------------------------------------------------------------------------------+---------------------------+


**Minimal Example**

::


    10.sql = select "fileadmin/img/img.jpg" as img

..



**Advanced Examples**

::


    10.sql = select "fileadmin/img/img.jpg|Aternative Text" as img            # alt="Alternative Text, no title
    20.sql = select "fileadmin/img/img.jpg|Aternative Text|" as img           # alt="Alternative Text, no title
    30.sql = select "fileadmin/img/img.jpg|Aternative Text|Title Text" as img # alt="Alternative Text, title="Title Text"
    40.sql = select "fileadmin/img/img.jpg|Alternative Text" as img           # alt="Alternative Text", no title
    50.sql = select "fileadmin/img/img.jpg" as img                            # empty alt, no title
    60.sql = select "fileadmin/img/img.jpg|" as img                           # empty alt, no title
    70.sql = select "fileadmin/img/img.jpg||Title Text" as img                # empty alt, title="Title Text"
    80.sql = select "fileadmin/img/img.jpg||" as img                          # empty alt, no title

..



Column: exec
1514
************
Carsten  Rose's avatar
Carsten Rose committed
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548

Runs batch files or excutables on the webserver. In case of an error, returncode and errormessage will be returned.

**Syntax**

::


    <command>

..



+-------------+--------------------------------------------------+-----------------+
|**Parameter**|**Description**                                   |**Default value**|
+-------------+--------------------------------------------------+-----------------+
|<command>    |The command that should be executed on the server.|none             |
+-------------+--------------------------------------------------+-----------------+


**Minimal Examples**

::


    10.sql = select "ls -s" as exec
    20.sql = select "./batchfile.sh" as exec

..



Column: F
1549
*********
Carsten  Rose's avatar
Carsten Rose committed
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583

Challenge 1
'''''''''''

Due to the limitations of MySQL, reserved column names can't be further concatenated. Assume you want to display an image:

::


    # This is valid:
    10.sql = select concat("/static/directory/", p.foto) as img from person as p where...

    # Returns:
    <img src=...>

..



Now assume you want to wrap the image in a div tag:

::


    # This is valid:
    10.sql = select "<div>", concat("/static/directory/", p.foto) as img, "</div>" from person as p where...

    # Returns:
    <div><img src=...></div>

..



1584
The example above works fine - however, as soon as you want to use *field wrappers*_, things get messy:
Carsten  Rose's avatar
Carsten Rose committed
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643

::


    # This is valid:
    10.sql = select "<div>", concat("/static/directory/", p.foto) as img, "</div>" from person as p where...
    10.fbeg = <td>
    10.fend = </td>

    # Returns:
    <td><div></td><td><img src=...></td><td></div></td>

..



To achieve the desired result, one might want to try something like this:

::


    # This is NOT valid:
    10.sql = select concat("<div>", concat("/static/directory/", p.foto) as img, "</div>") from person as p where...
    10.fbeg = <td>
    10.fend = </td>

    # Returns a MySQL error because nesting concat() -functions is not allowed

..



Challenge 2
'''''''''''

Assume you have multiple columns with reserved names in the same query and want to use one of them in a later query:

::


    10.sql = select concat("/static/directory/", g.picture) as img, concat("/static/preview/", g.thumbnail) as img from gallery as g where...

    20.sql = select "~10.img", d.text from description as d.....

..



The example above will fail because there are two img columns which can not be distinguished.

Solution
''''''''

The reserved column 'F'(=Format) can be used to

*   further wrap columns with a reserved name

*   assign an arbitrary name to a column built through a reserved name to make it accessible in later queries.

1644
Solution for *#Challenge_1*_:
Carsten  Rose's avatar
Carsten Rose committed
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659

::


    10.sql = select concat("Q:img|T:div") as wrappedImg from person as p where...
    10.fbeg = <td>
    10.fend = </td>

    # Returns:
    <td><div><img src=...></div></td>

..



1660
Solution for *#Challenge_2*_:
Carsten  Rose's avatar
Carsten Rose committed
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675

::


    10.sql = select concat("Q:img|V:mypic") as wrappedImg from person as p where...

    20.sql = select "~10.mypic" ...

..



+-------------+--------------------------------------------------------------------+--------+
|**Parameter**|**Description**                                                     |Required|
+-------------+--------------------------------------------------------------------+--------+
1676
|Q            |Any of the *reserved column names*_                                 |        |
Carsten  Rose's avatar
Carsten Rose committed
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
+-------------+--------------------------------------------------------------------+--------+
|Z            |Process the column but don't display it                             |        |
+-------------+--------------------------------------------------------------------+--------+
|X            |Striptags / Remove all tags                                         |        |
+-------------+--------------------------------------------------------------------+--------+
|T            |Wrap the column with the defined tag. F.e.: T:tdcolspan="2"         |        |
+-------------+--------------------------------------------------------------------+--------+
|V            |Define an unambiguous variable name for this colum. F.e.: V:someName|        |
+-------------+--------------------------------------------------------------------+--------+
|*            |Add all the parameters required for the column defined with Q:      |        |
+-------------+--------------------------------------------------------------------+--------+


Include a form via link/url
1691
***************************
Carsten  Rose's avatar
Carsten Rose committed
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713

In most occasions it is handy if a formname does not have to be hard-coded in report but can be passed to the page as a parameter. To achieve this, first build a link on page A which includes the required parameters:

**page A**

::


    10.sql = SELECT CONCAT("p:pageB|U:form=Person&r=", id) AS pagee FROM ...

..



The above example builds a link to pageB - refer to the 'link'-manual for details. The link tells page B to render the form with name formname and load the record with id id for editing.

Examples
--------

The follwing section gives some examples of typical reports

Basic Queries
1714
*************
Carsten  Rose's avatar
Carsten Rose committed
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785

*   One simple query

::


    10.sql = SELECT "Hello World"

..



Result:

::


    Hello World

..



    Two simple queries

::


    10.sql = SELECT "Hello World"
    20.sql = SELECT "Say hello"

..



    Result:

::


    Hello WorldSay hello

..



    Two simple queries, with break

::


    10.sql = SELECT "Hello World<br />"
    20.sql = SELECT "Say hello"

..



    Result:

::


    Hello World
    Say hello

..



Accessing the database
1786
**********************
Carsten  Rose's avatar
Carsten Rose committed
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834

    Real data, one single column

::


    10.sql = SELECT p.first_name FROM exp_person AS p

..



    Result:

::


    BillieElvisLouisDiana

..



    Real data, two columns

::


    10.sql = SELECT p.first_name, p.last_name FROM exp_person AS p

..



    Result:

::


    BillieHolidayElvisPresleyLouisArmstrongDianaRoss

..



The result of the SQL query is output row by row and column by column without adding any formatting information. See ?Formating Examples for examples of how the output can be formatted.

Formating Examples
1835
******************
Carsten  Rose's avatar
Carsten Rose committed
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981

Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two different ways:

    One can either add formatting output directely into the SQL by either putting it in a separate column of the output or by using concat to concatenate data and formatting output in a single column.

    One can use ?level keys to define formatting information that will be put before/after/between all rows/columns of the actual levels result.

    Two columns

::


    # Add the formating information as a coloum
    10.sql = SELECT p.first_name, " " , p.last_name, "'<br /'>" FROM exp_person AS p

..



    Result:

::


    Billie Holiday
    Elvis Presley
    Louis Armstrong
    Diana Ross

..



    One column 'rend'

::


    10.sql = SELECT p.name FROM exp_person AS p
    10.rend = <br />

..



    Result:

::


    Billie Holiday
    Elvis Presley
    Louis Armstrong
    Diana Ross

..



    More HTML

::


    10.sql = SELECT p.name FROM exp_person AS p
    10.head = <ul>
    10.tail = </ul>
    10.rbeg = <li>
    10.rend = </li>

..



    Result:

::


    o Billie Holiday
    o Elvis Presley
    o Louis Armstrong
    o Diana Ross

..



    Two queries

::


    10.sql = SELECT p.name FROM exp_person AS p
    10.rend = <br />
    20.sql = SELECT a.street FROM exp_address AS a
    20.rend = <br />

..



    Two queries: nested

::


    # outer query
    10.sql = SELECT p.name FROM exp_person AS p
    10.rend = <br />

    # inner query
    10.10.sql = SELECT a.street FROM exp_address AS a
    10.10.rend = <br />

..



*   For every record of '10', all records of 20 will be printed.

*   Two queries: nested with variables {{{ #!highlight sql

# outer query 10.sql = SELECT p.id, p.name FROM exp_person AS p 10.rend = <br />

# inner query 10.10.sql = SELECT a.street FROM exp_address AS a WHERE a.pid='~10.id' 10.10.rend = <br /> }}}

*   For every record of '10', all assigned records of 20 will be printed.

    Two queries: nested with hidden variables in a table

::


    10.sql = SELECT p.id AS _p_id, p.name FROM exp_person AS p
    10.rend = <br />

    # inner query
    10.10.sql = SELECT a.street FROM exp_address AS a WHERE a.p_id='~10.p_id'
    10.10.rend = <br />

..



*   Columns starting with a '_' won't be printed but can be accessed as regular columns.