Store.rst 27.8 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.. ==================================================
.. ==================================================
.. ==================================================
.. Header hierarchy
.. ==
..  --
..   ^^
..    ""
..     ;;
..      ,,
..
.. --------------------------------------------used to the update the records specified ------
.. Best Practice T3 reST: https://docs.typo3.org/m/typo3/docs-how-to-document/master/en-us/WritingReST/CheatSheet.html
..             Reference: https://docs.typo3.org/m/typo3/docs-how-to-document/master/en-us/WritingReST/Index.html
.. Italic *italic*
.. Bold **bold**
.. Code ``text``
.. External Links: `Bootstrap <http://getbootstrap.com/>`_
19
.. Internal Link: :ref:downloadButton` (default url text) or :ref:`download Button<downloadButton>` (explicit url text)
20
21
22
23
24
25
26
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
.. Add Images:    .. image:: ../Images/a4.jpg
..
..
.. Admonitions
..           .. note::   .. important::     .. tip::     .. warning::
.. Color:   (blue)       (orange)           (green)      (red)
..
.. Definition:
.. some text becomes strong (only one line)
..      description has to indented

.. -*- coding: utf-8 -*- with BOM.

.. include:: Includes.txt


.. _`store`:

Store
=====

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

+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| Name |                                       Description                                       |                                      Content                                       |
+======+=========================================================================================+====================================================================================+
| B    | :ref:`STORE_BEFORE`: Record - the current record loaded in the form before any update.  | All columns of the current record from the current table. See :ref:`STORE_BEFORE`. |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| C    | :ref:`STORE_CLIENT`: POST variable, if not found: GET variable.                         | Parameter sent from the Client (=Browser). See :ref:`STORE_CLIENT`.                |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| D    | Default values column : The *table.column* specified *default value*.                   |                                                                                    |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| E    | *Empty* - always an empty string, might be helpful if a variable is empty or undefined  | Any key                                                                            |
|      | and will be used in an SQL statement.                                                   |                                                                                    |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| F    | :ref:`STORE_FORM`: data not saved in database yet.                                      | All native *FormElements*. Recent values from the Browser. See: :ref:`STORE_FORM`  |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| L    | :ref:`STORE_LDAP`: Will be filled on demand during processing of a *FormElement*.       | Custom specified list of LDAP attributes. See :ref:`STORE_LDAP`.                   |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| M    | Column type: The *table.column* specified *type*.                                       |                                                                                    |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| P    | Parent record. E.g.: on multi & copy forms the current record of the outer query.       | All columns of the MultiSQL Statement from the table for the current row           |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| R    | :ref:`STORE_RECORD`: Record - the current record loaded in the form.                    | All columns of the current record from the current table. See :ref:`STORE_RECORD`. |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| S    | :ref:`STORE_SIP`: Client parameter 's' will indicate the current SIP, which will be     | sip, r (recordId), form. See :ref:`STORE_SIP`.                                     |
|      | loaded from the SESSION repo to the SIP-Store.                                          |                                                                                    |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| T    | :ref:`STORE_TYPO3`: a) Bodytext (ttcontent record), b) Typo3 internal variables.        | See Typo3 tt_content record configuration. See `STORE_TYPO3`_.                     |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| U    | :ref:`STORE_USER`: per user variables, valid as long as the browser session lives.      | Set via report: '...' AS '_=<var name>' See: :ref:`STORE_USER`,                    |
|      |                                                                                         | :ref:`store_user_examples`                                                         |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| V    | :ref:`STORE_VARS`: Generic variables.                                                   | See :ref:`STORE_VARS`.                                                             |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| Y    | :ref:`STORE_SYSTEM`: a) Database, b) helper vars for logging/debugging:                 | See :ref:`STORE_SYSTEM`.                                                           |
|      | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN, c) Any custom fields: CONTACT, HELP, ... |                                                                                    |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| 0    | *Zero* - always value: 0, might be helpful if a variable is empty or undefined and      | Any key                                                                            |
|      | will be used in an SQL statement.                                                       |                                                                                    |
+------+-----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+

* Default *<prio>*: *FSRVD* - Form / SIP / Record / Vars / Table definition.
* Hint: Preferable, parameter should be submitted by SIP, not by Client (=URL).

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

.. _STORE_FORM:

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

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

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

+---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Name                            | Explanation                                                                                                                                |
+=================================+============================================================================================================================================+
| <FormElement name>              | Name of native *FormElement*. To get, exactly and only, the specified *FormElement* (for 'pId'): *{{pId:F}}*                               |
+---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+

.. _STORE_SIP:

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

* Sanitized: *no*
* Filled automatically by creating links. E.g.:

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

+-------------------------+-----------------------------------------------------------+
| Name                    | Explanation                                               |
+=========================+===========================================================+
| sip                     | 13 char uniqid                                            |
+-------------------------+-----------------------------------------------------------+
| r                       | current record id                                         |
+-------------------------+-----------------------------------------------------------+
| form                    | current form name                                         |
+-------------------------+-----------------------------------------------------------+
| table                   | current table name                                        |
+-------------------------+-----------------------------------------------------------+
| urlparam                | all non Typo3 parameter in one string                     |
+-------------------------+-----------------------------------------------------------+
| <user defined>          | additional user defined link parameter                    |
+-------------------------+-----------------------------------------------------------+

.. _STORE_RECORD:

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


* Sanitized: *no*
* *Form*: Current record.
* *Report*: See :ref:`access-column-values`
* If r=0, all values are empty.

+------------------------+-------------------------------------------------------------------------------------------------------------------------+
| Name                   | Type     | Explanation                                                                                                  |
+========================+==========+==============================================================================================================+
| <column name>          | Form     | Name of a column of the primary table (as defined in the current form). Example: *{{pId:R}}*                 |
+------------------------+----------+--------------------------------------------------------------------------------------------------------------+
| <column name>          | Report   | Name of a column of a previous fired SQL query. Example: *{{pId:R}}*                                         |
+------------------------+----------+--------------------------------------------------------------------------------------------------------------+
| &<column name>         | Report   | Name of a column of a previous fired SQL query, typically used by columns with a :ref:`special-column-names`.|
|                        | (final)  | Final value. Example: '{{link:R}}' returns 'p:home&form=Person|s|b:success|t:Edit'.                          |
|                        |          | Whereas '{{&link:R}}' returns '<span class="btn btn-success"><a href="?home&s=badcaffee1234">Edit</a></span> |
+------------------------+----------+--------------------------------------------------------------------------------------------------------------+

.. _STORE_BEFORE:

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


* Sanitized: *no*
* Current record loaded in Form without any modification.
* If r=0, all values are empty.

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

+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| Name                   | Explanation                                                                                                                                      |
+========================+==================================================================================================================================================+
| <column name>          | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form *FormElement*: *{{pId:B}}*  |
+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+

.. _STORE_CLIENT:

Store: *CLIENT* - C
-------------------

* Sanitized: *yes*

+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| Name                    | Explanation                                                                                                                              |
+=========================+==========================================================================================================================================+
| s                       | =SIP                                                                                                                                     |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| r                       | record id. Only if specified as GET parameter - typically stored in SIP (=STORE_SIP)                                                     |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| form                    | Name of form to load. Only if specified as GET parameter - typically stored in SIP (=STORE_SIP)                                          |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| HTTP_HOST               | current HTTP HOST                                                                                                                        |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| REMOTE_ADDR             | Client IP address                                                                                                                        |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| All HTTP Header         | SERVER_ADDR, SERVER_NAME, SERVER_SOFTWARE,SERVER_PROTOCOL, REQUEST_METHOD, REQUEST_TIME, REQUEST_TIME_FLOAT, QUERY_STRING, DOCUMENT_ROOT,|
| variables               | HTTP_ACCEPT, HTTP_ACCEPT_CHARSET, HTTP_ACCEPT_ENCODING, HTTP_ACCEPT_LANGUAGE, HTTP_CONNECTION, HTTP_HOST, HTTP_REFERER,                  |
|                         | HTTP_USER_AGENT, HTTPS, REMOTE_ADDR, REMOTE_HOST, REMOTE_PORT, REMOTE_USER, REDIRECT_REMOTE_USER, SCRIPT_FILENAME, SERVER_ADMIN,         |
|                         | SERVER_PORT, SERVER_SIGNATURE, PATH_TRANSLATED, SCRIPT_NAME, REQUEST_URI, PHP_AUTH_DIGEST, PHP_AUTH_USER, PHP_AUTH_PW,                   |
|                         | AUTH_TYPE, PATH_INFO, ORIG_PATH_INFO                                                                                                     |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| Authorization           | Value of the HTTP Header 'Authorization'. This is typically not set. Mostly used for authentication of REST requests                     |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+



.. _STORE_TYPO3:

Store: *TYPO3* (Bodytext) - T
-----------------------------

* Sanitized: *no*

+-------------------------+-------------------------------------------------------------------+----------+
| Name                    | Explanation                                                       | Note     |
+=========================+===================================================================+==========+
| form                    | | Formname defined in ttcontent record bodytext                   | see note |
|                         | | * Fix. E.g. *form = person*                                     |          |
|                         | | * via SIP. E.g. *form = {{form:SE}}*                            |          |
+-------------------------+-------------------------------------------------------------------+----------+
| pageId                  | Record id of current Typo3 page                                   | see note |
+-------------------------+-------------------------------------------------------------------+----------+
| pageAlias               | Alias of current Typo3 page. If empty, take  pageId.              | see note |
+-------------------------+-------------------------------------------------------------------+----------+
| pageTitle               | Title of current Typo3 page                                       | see note |
+-------------------------+-------------------------------------------------------------------+----------+
| pageType                | Current selected page type (typically URL parameter 'type')       | see note |
+-------------------------+-------------------------------------------------------------------+----------+
| pageLanguage            | Current selected page language (typically URL parameter 'L')      | see note |
+-------------------------+-------------------------------------------------------------------+----------+
| ttcontentUid            | Record id of current Typo3 content element                        | see note |
+-------------------------+-------------------------------------------------------------------+----------+
| feUser                  | Logged in Typo3 FE User                                           |          |
+-------------------------+-------------------------------------------------------------------+----------+
| feUserUid               | Logged in Typo3 FE User uid                                       |          |
+-------------------------+-------------------------------------------------------------------+----------+
| feUserGroup             | FE groups of logged in Typo3 FE User                              |          |
+-------------------------+-------------------------------------------------------------------+----------+
| beUser                  | Logged in Typo3 BE User                                           |          |
+-------------------------+-------------------------------------------------------------------+----------+
| beUserLoggedIn          | 'yes' | 'no' - Status if a BE-User is logged in                   |          |
+-------------------------+-------------------------------------------------------------------+----------+

* **note**: not available:

  * in :ref:`dynamic-update` or
  * by *FormElement* class 'action' with type 'beforeSave', 'afterSave', 'beforeDelete', 'afterDelete'.

.. _STORE_VARS:

Store: *VARS* - V
-----------------

* Sanitized: *no*

+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Name                    | Explanation                                                                                                                                |
+=========================+============================================================================================================================================+
259
| random                  | Random string with length of 32 alphanum chars (lower & upper case). This variable is always filled. Each access gives a new value.        |
260
|                         | Remember: QFQ variables will be replaced **before** a SQL statement is fired. Uniqueness is given via PHP function *uniqid()*.             |
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| slaveId                 | see :ref:`slave-id`                                                                                                                        |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| allRequiredGiven        | Form save - Set during check of all required FE. If every *required* FE is given: *1*. Else: *0*. If there is no required FE: *1*.         |
|                         | Even with `formModeGlobal` = `requiredOff` | `requiredOffButMark` the variable will be set.                                                |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+

.. _`store_vars_form_element_upload`:

* FormElement 'upload':

+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Name                    | Explanation                                                                                                                                |
+=========================+============================================================================================================================================+
| filename                | Original filename of an uploaded file via an 'upload'-FormElement. Valid only during processing of the current 'upload'-formElement.       |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| filenameOnly            | Like filename, but without path.                                                                                                           |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| filenameBase            | Like `filename`, but without an optional extension. E.g. filename='image.png' comes to filenameBase='image'                                |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| filenameExt             | Like `filename`, but only the optional extension. E.g. filename='image.png' comes to filenameExt='png'                                     |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| fileDestination         | Destination (path & filename) for an uploaded file. Defined in an 'upload'-FormElement.parameter. Valid: same as 'filename'.               |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| fileSize                | Size of the uploaded file.                                                                                                                 |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| mimeType                | Mime type of the uploaded file.                                                                                                            |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+


The directive `fillStoreVar` will fill the store VARS with custom values. Existing Store VARS values will be merged together with them.
E.g.: ::

    fillStoreVar = {{! SELECT p.name, p.email FROM Person AS p WHERE p.id={{pId:S}} }}

* After filling the store, the values can be retrieved via `{{name:V}}` and `{{email:V}}`.
* Be careful by specifying general purpose variables like `id`, `r`, `pageId` and so on. This might conflict with existing variables.
* `fillStoreVar` can be used in :ref:`form-parameter` and :ref:`fe-parameter-attributes`


.. _STORE_LDAP:

Store: *LDAP* - L
-----------------

* Sanitized: *yes*
* See also :ref:`LDAP`:

+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Name                    | Explanation                                                                                                                                |
+=========================+============================================================================================================================================+
| <custom defined>        | See *ldapAttributes*                                                                                                                       |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+



.. _STORE_SYSTEM:

Store: *SYSTEM* - Y
-------------------

* Sanitized: *no*

See :ref:`configuration` for a list of all settings.



.. _STORE_USER:

Store: *USER* - U
-----------------

* Sanitized: *no*

At start of a new browser session (=user calls the website the first time or was logged out before) the store is empty.
As soon as a value is set in the store, it remains as long as the browser session is alive (=until user logs out).

Values can be set via report '... AS "_=<var name>"'

See also: :ref:`store_user_examples`