Newer
Older
* Access to 'hidden' columns via {{<level>.<column>}} or {{<column>:R}} are possible and often used.
* Important: to reference a column, the name has to be given without '_'. E.g. `SELECT 'cat' AS _pet` will be used with
`{{pet:R}}` (notice the missing '_').
* For 'special column names': the column name together with the value controls how QFQ processes the column.

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Reserved column name | Purpose |
+========================+=============================================================================================================================================================================================+
| _link | `column-link`_ - Build links with different features. |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _pageX or _PageX | `column_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. |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _download | `download`_ - single file (any type) or concatenate multiple files (PDF, ZIP) |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _pdf, _file, _zip | `column_pdf`_ - Shortcut version of the link interface for fast creation of `download`_ links. Used to offer single file download or to concatenate several PDFs and printout of websites |
| _Pdf, _File, _Zip | to one PDF file. |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _savePdf | `column-save-pdf`_ - pre render PDF files |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _excel | `excel-export`_ - creates Excel exports based on QFQ Report queries, optional with pre uploaded Excel template files |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _yank | `copyToClipboard`_. Shortcut version of the link interface |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _mailto | `column_mailto`_ - Build email links. A click on the link will open the default mailer. The address is encrypted via JS against email bots. |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _exec | `column_exec`_ - Run batch files or executables on the webserver. |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _vertical | `column_vertical`_ - Render Text vertically. This is useful for tables with limited column width. |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _bullet |Display a blue/gray/green/pink/red/yellow bullet. If none color specified, show nothing. |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _check |Display a blue/gray/green/pink/red/yellow checked sign. If none color specified, show nothing. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _nl2br |All newline characters will be converted to `<br>`. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _striptags |HTML Tags will be stripped. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _htmlentities |Characters will be encoded to their HTML entity representation. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _fileSize |Show file size of a given file |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _mimeType |Show mime type of a given file |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _thumbnail | `thumbnail`_ - Create thumbnails on the fly. See `column-thumbnail`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _monitor | `column-monitor`_ - Constantly display a file. See `column-monitor`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| _XLS |Used for Excel export. Append a `newline` character at the end of the string. Token must be part of string. See `excel-export`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| _XLSs |Used for Excel export. Prepend the token 's=' and append a `newline` character at the string. See `excel-export`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| _XLSb |Used for Excel export. Like '_XLSs' but encode the string base64. See `excel-export`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _XLSn |Used for Excel export. Prepend 'n=' and append a `newline` character around the string. See `excel-export`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _+<html-tag attributes>|The content will be wrapped with '<html-tag attributes>'. Example: SELECT 'example' AS '_+a href="http://example.com"' creates '<a href="http://example.com">example</a>' |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _=<varname> |The content will be saved in store 'user' under 'varname'. Retrieve it later via {{varname:U}}. Example: 'SELECT "Hello world" AS _=text'. See `STORE_USER`_, `store_user_examples`_ |

Carsten Rose
committed
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_<nonReservedName> |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. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. _column-link:
Column: _link
^^^^^^^^^^^^^
* Most URLs will be rendered via class link.
* Column names like `_pagee`, `_mailto`, ... are wrapper to class link.
* The parameters for link contains a prefix to make them position-independent.
* Parameter have to be separated with '|'. If '|' is part of the value, it needs to be escaped '\\|'. This can be done via QFQ SQL function `QBAR()` - see `qbar-qscape-qfq-delimiter`_.

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|URL|IMG|Meaning |Qualifier |Example |Description |
+===+===+==============+===================================+===========================+========================================================================================================================================+
|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 |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|x | |Mail |m:<email> |m:info@example.com |Default link class: email |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
|x | |Page |p:<pageId> |p:impressum |Prepend '?' or '?id=', no hostname qualifier (automatically set by browser) |

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|x | |Download |d:[<exportFilename>] |d:complete.pdf |Link points to `api/download.php`. Additional parameter are encoded into a SIP. 'Download' needs an enabled SIP. See `download`_. |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
|x | |Copy to |y:[some content] |y:this will be copied |Click on it copies the value of 'y:' to the clipboard. Optional a file ('F:...') might be specified as source. |
| | |clipboard | | |See `copyToClipboard`_. |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| | |Dropdown menu |z |z||p:home|t:Home |Creates a dropdown menu. SEe `dropdownMenu`_. |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Render |r:<mode> |r:3 |See: `render-mode`_, Default: 0 |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Button | b[:0|1|<btn class>] | b:0, b:1, b:success |'b', 'b:1': a bootstrap button is created. 'b:0' disable the button. <btn class>: default, primary, success, info, warning,danger |

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| |x |Picture |P:<filename> |P:bullet-red.gif |Picture '<img src="bullet-red.gif"alt="....">'. |

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| |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 image (only the icon, no database record 'delete' functionality) |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| |x |Help |H |H |Show 'help' icon as image |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| |x |Info |I |I |Show 'information' icon as image |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| |x |Show |S |S |Show 'show' icon as image |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| |x |Glyph |G:<glyphname> |G:glyphicon-envelope |Show <glyphname>. Check: https://getbootstrap.com/docs/3.4/components/ |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| |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. |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| |x |Thumbnail |T:<pathFileName> |T:fileadmin/file.pdf |Creates a thumbnail on the fly. Size is specified via 'W'. See `column-thumbnail`_ |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Dimension |W:[width]x[height] |W:50x , W:x60 , W:50x60 |Defines the pixel size of thumbnail. See `column-thumbnail`_ |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |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. Used to create 'record delete'-links. |

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Tooltip |o:<text> |o:More information here |Tooltip text |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Alttext |a:<text> |a:Name of person |a) Alttext for images, b) Message text for `download`_ popup window. |

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Class |c:[n|<text>] |c:text-muted |CSS class for link. n:no class attribute, <text>: explicit named |

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| | |Attribute |A:<key>="<value"> |A:data-reference="person" |Custom attributes and a corresponding value. Might be used by application tests. |

Carsten Rose
committed
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| | |Target |g:<text> |g:_blank |target=_blank,_self,_parent,<custom>. Default: no target |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Question |q:<text> |q:please confirm |See: `question`_. Link will be executed only if user clicks ok/cancel, default: 'Please confirm' |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Encryption |e:0|1|... |e:1 |Encryption of the e-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' |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |SIP |s[:0|1] |s, s:0, s:1 |If 's' or 's:1' a SIP entry is generated with all non Typo 3 Parameters. The URL contains only parameter 's' and Typo 3 parameter |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Mode |M:file|pdf|zip |M:file, M:pdf, M:zip |Mode. Used to specify type of download. One or more element sources needs to be configured. See `download`_. |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |File |F:<filename> |F:fileadmin/file.pdf |Element source for download mode file|pdf|zip. See `download`_. |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
| | |Delete record | x[:a|r|c] |x, x:r, x:c |a: ajax (only QFQ internal used), r: report (default), c: close (current page, open last page) |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
.. _render-mode:
Render mode
^^^^^^^^^^^
The following table might be hard to read - but it's really useful to understand. It solves a lot of different situations.
If there are no special condition (like missing value, or suppressed links), render mode 0 is sufficient.
But if the URL text is missing, or the URL is missing, OR the link should be rendered in sql row 1-10, but not 5, then
render mode might dynamically control the rendered link.
* Column *Mode* is the render mode and controls how the link is rendered.
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+
|Mode |Given: url & text |Given: only url | Given: 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, independently of whether there is a url or not|
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+
|2 |<a href=url>text</a> | | |no link if text is empty |
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+
|3 |text |url |text |no link, only text or image, incl. Optional tooltip. For Bootstrap buttons |
| | | | | r:3 will set the button to disable and no link/sip is rendered. |
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+
|4 |url |url |text |no link, show text, if text is empty, show url, incl. optional tooltip |
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+
|5 | | | |nothing at all |
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+
|6 | pure text | |pure text |no link, pure text |
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+
|7 | pure url |pure url | |no link, pure url |
+------------+---------------------+--------------------+------------------+---------------------------------------------------------------------------+

Carsten Rose
committed

Carsten Rose
committed
Example::
10.sql = SELECT CONCAT('u:', p.homepage, IF(p.showHomepage='yes', '|r:0', '|r:5') ) AS _link FROM Person AS p
Tip:
An easy way to switch between different options of rendering a link, incl. Bootstrap buttons, is to use the render mode.
* no render mode or 'r:0' - the full functional link/button.
* 'r:3' - the link/button is rendered with text/image/glyph/tooltip ... but without a HTML a-tag! For Bootstrap button, the button get the 'disabled' class.
* 'r:5' - no link/button at all.

Carsten Rose
committed
Link Examples
^^^^^^^^^^^^^
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|SQL-Query | Result |
+=======================================================================+=========================================================================================================================================+
| SELECT "m:info@example.com" AS _link | info@example.com as linked text, encrypted with javascript, class=external |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "m:info@example.com|c:0" AS _link | info@example.com as linked text, not encrypted, class=external |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "m:info@example.com|P:mail.gif" AS _link | info@example.com as linked image mail.gif, encrypted with javascript, class=external |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "m:info@example.com|P:mail.gif|o:Email" AS _link | *info@example.com* as linked image mail.gif, encrypted with javascript, class=external, tooltip: "sendmail" |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "m:info@example.com|t:mailto:info@example.com|o:Email" AS link | 'mail to *info@example.com*' as linked text, encrypted with javascript, class=external |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "u:www.example.com" AS _link | www.example as link, class=external |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "u:http://www.example.com" AS _link | *http://www.example* as link, class=external |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "u:www.example.com|q:Please confirm" AS _link | www.example as link, class=external, See: `question`_ |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "u:www.example.com|c:nicelink" AS _link | *http://www.example* as link, class=nicelink |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "p:form_person¬e=Text|t:Person" AS _link | <a href="?form_person¬e=Text">Person</a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "p:form_person|E" AS _link | <a href="?form_person"><img alttext="Edit" src="typo3conf/ext/qfq/Resources/Public/icons/edit.gif"></a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "p:form_person|E|g:_blank" AS _link | <a target="_blank" href="?form_person"><img alttext="Edit" src="typo3conf/ext/qfq/Resources/Public/icons/edit.gif"></a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "p:form_person|C" AS _link | <a href="?form_person"><img alttext="Check" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif"></a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "p:form_person|C:green" AS _link | <a href="?form_person"><img alttext="Check" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif"></a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "U:form=Person&r=123|x|D" as _link | <a href="typo3conf/ext/qfq/Classes/Api/delete.php?s=badcaffee1234"><span class="glyphicon glyphicon-trash" ></span>"></a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "U:form=Person&r=123|x|t:Delete" as _link | <a href="typo3conf/ext/qfq/Classes/Api/delete.php?s=badcaffee1234">Delete</a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "s:1|d:full.pdf|M:pdf|p:id=det1&r=12|p:id=det2|F:cv.pdf| | <a href="typo3conf/ext/qfq/Classes/Api/download.php?s=badcaffee1234">Download</a> |
| t:Download|a:Create complete PDF - please wait" as _link | |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "y:iatae3Ieem0jeet|t:Password|o:Clipboard|b" AS _link | <button class="btn btn-info" onClick="new QfqNS.Clipboard({text: 'iatae3Ieem0jeet'});" title='Copy to clipboard'>Password</button> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "y|s:1|F:dir/data.R|t:Data|o:Clipboard|b" AS _link | <button class="btn btn-info" onClick="new QfqNS.Clipboard({uri: 'typo3conf/.../download.php?s=badcaffee1234'});" |
| | title='Copy to clipboard'>Data</button> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+

Carsten Rose
committed
.. _question:
Question
^^^^^^^^
**Syntax**
::
q[:<alert text>[:<level>[:<positive button text>[:<negative button text>[:<timeout>[:<flag modal>]]]]]]
* If a user clicks on a link, an alert is shown. If the user answers the alert by clicking on the 'positive button', the browser opens the specified link.
If the user click on the negative answer (or waits for timout), the alert is closed and the browser does nothing.
* All parameter are optional.
* Parameter are separated by ':'
* To use ':' inside the text, the colon has to be escaped by \\. E.g. 'ok\\ : I understand'.

Carsten Rose
committed
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Parameter | Description |
+======================+==========================================================================================================================+
| Text | The text shown by the alert. HTML is allowed to format the text. Any ':' needs to be escaped. Default: 'Please confirm'. |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Level | success, info, warning, danger |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Positive button text | Default: 'Ok' |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Negative button text | Default: 'Cancel'. To hide the second button: '-' |

Carsten Rose
committed
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Timeout in seconds | 0: no timeout, >0: after the specified time in seconds, the alert will dissapear and behaves like 'negative answer' |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Flag modal | 0: Alert behaves not modal. 1: (default) Alert behaves modal. |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
Examples:
+------------------------------------------------------------+---------------------------------------------------------------------------+
| SQL-Query | Result |
+============================================================+===========================================================================+
| SELECT "p:form_person|q:Edit Person:warn" AS _link | Shows alert with level 'warn' |
+------------------------------------------------------------+---------------------------------------------------------------------------+
| SELECT "p:form_person|q:Edit Person::I do:No way" AS _link | Instead of 'Ok' and 'Cancel', the button text will be 'I do' and 'No way' |
+------------------------------------------------------------+---------------------------------------------------------------------------+
| SELECT "p:form_person|q:Edit Person:::10" AS _link | The Alert will be shown 10 seconds |
+------------------------------------------------------------+---------------------------------------------------------------------------+
| SELECT "p:form_person|q:Edit Person:::10:0" AS _link | The Alert will be shown 10 seconds and is not modal. |
+------------------------------------------------------------+---------------------------------------------------------------------------+

Carsten Rose
committed
Columns: _page[X]
^^^^^^^^^^^^^^^^^
The colum name is composed of the string *page* and a trailing character to specify the type of the link.

Carsten Rose
committed
**Syntax**::

Carsten Rose
committed
10.sql = SELECT "[options]" AS _page[<link type>]

Carsten Rose
committed
with: [options] = [p:<page & param>][|t:<text>][|o:<tooltip>][|q:<question parameter>][|c:<class>][|g:<target>][|r:<render mode>]

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

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+
| column name | Purpose |default value of question parameter | Mandatory parameters |
+===============+===============================================+=====================================+==============================================+

Carsten Rose
committed
|_page |Internal link without a grafic |empty |p:<pageId/pageAlias>[¶m] |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+

Carsten Rose
committed
|_pagec |Internal link without a grafic, with question |*Please confirm!* |p:<pageId/pageAlias>[¶m] |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+
|_paged |Internal link with delete icon (trash) |*Delete record ?* | | U:form=<formname>&r=<record id> *or* |
| | | | | U:table=<tablename>&r=<record id> |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+

Carsten Rose
committed
|_pagee |Internal link with edit icon (pencil) |empty |p:<pageId/pageAlias>[¶m] |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+

Carsten Rose
committed
|_pageh |Internal link with help icon (question mark) |empty |p:<pageId/pageAlias>[¶m] |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+

Carsten Rose
committed
|_pagei |Internal link with information icon (i) |empty |p:<pageId/pageAlias>[¶m] |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+

Carsten Rose
committed
|_pagen |Internal link with new icon (sheet) |empty |p:<pageId/pageAlias>[¶m] |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+

Carsten Rose
committed
|_pages |Internal link with show icon (magnifier) |empty |p:<pageId/pageAlias>[¶m] |

Carsten Rose
committed
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+
* All parameter are optional.
* Optional set of predefined icons.
* Optional set of dialog boxes.
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
| Parameter | Description | Default value |Example |
+==============+=================================================================================================+==========================================================+===============================================================+
|<page> |TYPO3 page id or page alias. |The current page: *{{pageId}}* |45 application application&N_param1=1045 |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<text> |Text, wrapped by the link. If there is an icon, text will be displayed to the right of it. |empty string | |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<tooltip> |Text to appear as a ToolTip |empty string | |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<question> |If there is a question text given, an alert will be opened. Only if the user clicks on 'ok', |**Expected "=" to follow "see"** | |
| |the link will be called | | |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<class> |CSS Class for the <a> tag | | |
| | | | |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<target> |Parameter for HTML 'target='. F.e.: Opens a new window |empty |P |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<render mode> |Show/render a link at all or not. See `render-mode`_ | | |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
|<create sip> |s | |'s': create a SIP |
+--------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+

Carsten Rose
committed

Carsten Rose
committed
Column: _paged
^^^^^^^^^^^^^^
These column offers a link, with a confirmation question, to delete one record (mode 'table') or a bunch of records
(mode 'form'). After deleting the record(s), the current page will be reloaded in the browser.

Carsten Rose
committed
**Syntax** ::

Carsten Rose
committed
10.sql = SELECT "U:table=<tablename>&r=<record id>|q:<question>|..." AS _paged
10.sql = SELECT "U:form=<formname>&r=<record id>|q:<question>|..." AS _paged

Carsten Rose
committed
..

Carsten Rose
committed
If the record to delete contains column(s), whose column name match on `%pathFileName%` and such a

Carsten Rose
committed
column points to a real existing file, such a file will be deleted too. If the table contains records where the specific
file is multiple times referenced, than the file is not deleted (it would break the still existing references). Multiple
references are not found, if they use different colummnnames or tablenames.
Mode: table

Carsten Rose
committed
"""""""""""

Carsten Rose
committed
* `table=<table name>`
* `r=<record id>`
Deletes the record with id '<record id>' from table '<table name>'.
Mode: form

Carsten Rose
committed
""""""""""

Carsten Rose
committed
* `form=<form name>`
* `r=<record id>`
Deletes the record with id '<record id>' from the table specified in form '<form name>' as primary table.
Additional action *FormElement* of type *beforeDelete* or *afterDelete* will be fired too.

Carsten Rose
committed
Examples

Carsten Rose
committed
""""""""

Carsten Rose
committed
::
10.sql = SELECT 'U:table=Person&r=123|q:Do you want delete John Doe?' AS _paged
10.sql = SELECT 'U:form=person-main&r=123|q:Do you want delete John Doe?' AS _paged

Carsten Rose
committed

Carsten Rose
committed
Columns: _Page[X]
^^^^^^^^^^^^^^^^^
* Similar to `_page[X]`
* Parameter are position dependent and therefore without a qualifier!
::
"[<page id|alias>[¶m=value&...]] | [text] | [tooltip] | [question parameter] | [class] | [target] | [render mode]" as _Pagee.

Carsten Rose
committed
Column: _Paged
^^^^^^^^^^^^^^
* Similar to `_paged`
* Parameter are position dependent and therefore without a qualifier!
::
"[table=<table name>&r-<record id>[¶m=value&...] | [text] | [tooltip] | [question parameter] | [class] | [render mode]" as _Paged.
"[form=<form name>&r-<record id>[¶m=value&...] | [text] | [tooltip] | [question parameter] | [class] | [render mode]" as _Paged.

Carsten Rose
committed
Column: _vertical
^^^^^^^^^^^^^^^^^
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.

Carsten Rose
committed

Carsten Rose
committed
**Syntax** ::

Carsten Rose
committed
10.sql = SELECT "<text>|[<angle>]" AS _vertical

Carsten Rose
committed
..
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
|**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* |
+-------------+-------------------------------------------------------------------------------------------------------+-----------------+
The text is surrounded by some HTML tags in an effort to make other elements position appropriately around it.
This works best for angles close to 270 or 90.

Carsten Rose
committed

Carsten Rose
committed
**Minimal Example** ::

Carsten Rose
committed
10.sql = SELECT "Hallo" AS _vertical
20.sql = SELECT "Hallo|90" AS _vertical
20.sql = SELECT "Hallo|-75" AS _vertical

Carsten Rose
committed
..

Carsten Rose
committed
Column: _mailto
^^^^^^^^^^^^^^^
Easily create Email links.

Carsten Rose
committed
**Syntax** ::

Carsten Rose
committed
10.sql = SELECT "<email address>|[<link text>]" AS _mailto

Carsten Rose
committed
..
+--------------+----------------------------------------------------------------------------------------+-------------+
|**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. |none |
| | This will typically be the name of the recipient. If this parameter is omitted, | |
| | the email address will be displayed as link text. | |
+--------------+----------------------------------------------------------------------------------------+-------------+

Carsten Rose
committed

Carsten Rose
committed
**Minimal Example** ::

Carsten Rose
committed
10.sql = SELECT "john.doe@example.com" AS _mailto

Carsten Rose
committed
**Advanced Example** ::

Carsten Rose
committed
10.sql = SELECT "john.doe@example.com|John Doe" AS _mailto

Carsten Rose
committed
Column: _sendmail
^^^^^^^^^^^^^^^^^

Carsten Rose
committed
t:<TO:email[,email]>|f:<FROM:email>|s:<subject>|b:<body>
[|c:<CC:email[,email]]>[|B:<BCC:email[,email]]>[|r:<REPLY-TO:email>]
[|A:<flag autosubmit: on/off>][|g:<grId>][|x:<xId>][|y:<xId2>][|z:<xId3>][|h:<mail header>]
[|e:<subject encode: encode/decode/none>][E:<body encode: encode/decode/none>][|mode:html]
[|C][d:<filename of the attachment>][|F:<file to attach>][|u:<url>][|p:<T3 uri>]
The following parameters can also be written as complete words for ease of use::
to:<email[,email]>|from:<email>|subject:<subject>|body:<body>
[|cc:<email[,email]]>[|bcc:<email[,email]]>[|reply-to:<email>]
[|autosubmit:<on/off>][|grid:<grid>][|xid:<xId>][|xid2:<xId2>][|xid3:<xId3>][|header:<mail header>]
Elias Villiger
committed
[|mode:html]
Send emails. Every mail will be logged in the table `mailLog`. Attachments are supported.

Carsten Rose
committed

Carsten Rose
committed
**Syntax** ::

Carsten Rose
committed
10.sql = SELECT "t:john@doe.com|f:jane@doe.com|s:Reminder tomorrow|b:Please dont miss the meeting tomorrow" AS _sendmail
10.sql = SELECT "t:john@doe.com|f:jane@doe.com|s:Reminder tomorrow|b:Please dont miss the meeting tomorrow|A:off|g:1|x:2|y:3|z:4" AS _sendmail

Carsten Rose
committed
..
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
|**Token** | **Parameter** |**Description** |**Required**|
+==============+========================================+==================================================================================================+============+
| | f | email |**FROM**: Sender of the email. Optional: 'realname <john@doe.com>' | yes |
| | from | | | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | t | email[,email] |**TO**: Comma separated list of receiver email addresses. Optional: `realname <john@doe.com>` | yes |
| | to | | | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | c | email[,email] |**CC**: Comma separated list of receiver email addresses. Optional: 'realname <john@doe.com>' | |
| | cc | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | B | email[,email] |**BCC**: Comma separated list of receiver email addresses. Optional: 'realname <john@doe.com>' | |
| | bcc | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | r | REPLY-TO:email |**Reply-to**: Email address to reply to (if different from sender) | |
| | reply-to | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | s | Subject |**Subject**: Subject of the email | yes |
| | subject | | | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | b | Body |**Body**: Message - see also: `html-formatting`_ | yes |
| | body | | | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | h | Mail header |**Custom mail header**: Separate multiple header with \\r\\n | |
| | header | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| F | Attach file |**Attachment**: File to attach to the mail. Repeatable. | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| u | Attach created PDF of a given URL |**Attachment**: Convert the given URL to a PDF and attach it the mail. Repeatable. | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| p | Attach created PDF of a given T3 URL |**Attachment**: Convert the given URL to a PDF and attach it the mail. Repeatable. | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| d | Filename of the attachment |**Attachment**: Useful for URL to PDF converted attachments. Repeatable. | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| C | Concat multiple F|p|u| together |**Attachment**: All following (until the next 'C') 'F|p|u' concatenated to one attachment. | |
| | | Repeatable. | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | A | flagAutoSubmit 'on' / 'off' |If 'on' (default), add mail header 'Auto-Submitted: auto-send' - suppress OoO replies | |
| | autosubmit | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | g | grId |Will be copied to the mailLog record. Helps to setup specific logfile queries | |
| | grid | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | x | xId |Will be copied to the mailLog record. Helps to setup specific logfile queries | |
| | xid | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | y | xId2 |Will be copied to the mailLog record. Helps to setup specific logfile queries | |
| | xid2 | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| | z | xId3 |Will be copied to the mailLog record. Helps to setup specific logfile queries | |
| | xid3 | | | yes |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| e | encode|decode|none |**Subject**: will be htmlspecialchar() encoded, decoded (default) or none (untouched) | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| E | encode|decode|none |**Body**: will be htmlspecialchar() encoded, decoded (default) or none (untouched). | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| mode | html |**Body**: will be send as a HTML mail. | |
+--------------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+

Carsten Rose
committed
* **e|E**: By default, QFQ stores values 'htmlspecialchars()' encoded. If such values have to send by email, the html entities are
unwanted. Therefore the default setting for 'subject' und 'body' is to decode the values via 'htmlspecialchars_decode()'.
If this is not wished, it can be turned off by `e=none` and/or `E=none`.

Carsten Rose
committed

Carsten Rose
committed
**Minimal Example** ::

Carsten Rose
committed
10.sql = SELECT "t:john.doe@example.com|f:company@example.com|s:Latest News|b:The new version is now available." AS _sendmail

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

Carsten Rose
committed
**Advanced Examples** ::

Carsten Rose
committed
10.sql = SELECT "t:customer1@example.com,Firstname Lastname <customer2@example.com>, Firstname Lastname <customer3@example.com>| \\
f:company@example.com|s:Latest News|b:The new version is now available.|r:sales@example.com|A:on|g:101|x:222|c:ceo@example.com|B:backup@example.com" AS _sendmail

Carsten Rose
committed
This will send an email with subject *Latest News* from company@example.com to customer1, customer2 and customer3 by
using a realname for customer2 and customer3 and suppress generating of OoO answer if any receiver is on vacation.
Additional the CEO as well as backup will receive the mail via CC and BCC.

Carsten Rose
committed
For debugging, please check `REDIRECT_ALL_MAIL_TO`_.
.. _html-formatting:
**Mail Body HTML Formatting**
In order to send an email with HTML formatting, such as bold text or bullet lists, specify 'mode=html'.
The subsequent contents will be interpreted as HTML and is rendered correctly by most email programs.
.. _attachment:

Carsten Rose
committed
""""""""""
The following options are provided to attach files to an email:
+-------+------------------------------------------------------+--------------------------------------------------------+
| Token | Example | Comment |
+=======+======================================================+========================================================+
| F | F:fileadmin/file3.pdf | Single file to attach |
+-------+------------------------------------------------------+--------------------------------------------------------+
| u | u:www.example.com/index.html?key=value&... | A URL, will be converted to a PDF and than attached. |
+-------+------------------------------------------------------+--------------------------------------------------------+
| p | p:?id=export&r=123&_sip=1 | A SIP protected local T3 page. |
| | | Will be converted to a PDF and than attached. |
+-------+------------------------------------------------------+--------------------------------------------------------+
| d | d:myfile.pdf | Name of the attachment in the email. |
+-------+------------------------------------------------------+--------------------------------------------------------+
| C | C|u:http://www.example.com|F:file1.pdf|C|F:file2.pdf | Concatenate all named sources to one PDF file. The |
| | | souces has to be PDF files or a web page, which will be|
| | | converted to a PDF first. |
+-------+------------------------------------------------------+--------------------------------------------------------+
Any combination (incl. repeating them) are possible. Any source will be added as a single attachment.
Optional any number of sources can be concatenated to a single PDF file: 'C|F:<file1>|F:<file2>|p:export&a=123'.
Examples in Report::
# One file attached.
10.sql = SELECT "t:john.doe@example.com|f:company@example.com|s:Latest News|b:The new version is now available.|F:fileadmin/summary.pdf" AS _sendmail
# Two files attached.
10.sql = SELECT "t:john.doe@example.com|f:company@example.com|s:Latest News|b:The new version is now available.|F:fileadmin/summary.pdf|F:fileadmin/detail.pdf" AS _sendmail
# Two files and a webpage (converted to PDF) are attached.
10.sql = SELECT "t:john.doe@example.com|f:company@example.com|s:Latest News|b:The new version is now available.|F:fileadmin/summary.pdf|F:fileadmin/detail.pdf|p:?id=export&r=123|d:person.pdf" AS _sendmail
# Two webpages (converted to PDF) are attached.
10.sql = SELECT "t:john.doe@example.com|f:company@example.com|s:Latest News|b:The new version is now available.|p:?id=export&r=123|d:person123.pdf|p:?id=export&r=234|d:person234.pdf" AS _sendmail
# One file and two webpages (converted to PDF) are *concatenated* to one PDF and attached.
10.sql = SELECT "t:john.doe@example.com|f:company@example.com|s:Latest News|b:The new version is now available.|C|F:fileadmin/summary.pdf|p:?id=export&r=123|p:?id=export&r=234|d:complete.pdf" AS _sendmail
# One T3 webpage, protected by a SIP, are attached.
10.sql = SELECT "t:john.doe@example.com|f:company@example.com|s:Latest News|b:The new version is now available.|p:?id=export&r=123&_sip=1|d:person123.pdf" AS _sendmail

Carsten Rose
committed
Column: _img
^^^^^^^^^^^^
Renders images. Allows to define an 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.

Carsten Rose
committed
**Syntax** ::

Carsten Rose
committed
10.sql = SELECT "<path to image>|[<alt text>]|[<title text>]" AS _img

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

Carsten Rose
committed
**Minimal Example** ::

Carsten Rose
committed
10.sql = SELECT "fileadmin/img/img.jpg" AS _img

Carsten Rose
committed
**Advanced Examples** ::

Carsten Rose
committed
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

Carsten Rose
committed
Column: _exec
^^^^^^^^^^^^^
Run any command on the web server.
* The command is run via web server, so with the uid of the web server.
* The current working directory is the current web instance (e.g. ``/var/www/html``) .
* All text send to 'stdout' will be returned.
* Text send to 'stderr' is not returned at all.
* If 'stderr' should be shown, redirect the output::
* If 'stdout' / 'stderr' should not be displayed, redirect the output::
SELECT 'touch /tmp >/dev/null' AS _exec
SELECT 'touch /root 2>&1 >/dev/null' AS _exec
* Multiple commands can be concatenated by `;`::
* If the return code is not 0, the string '[<rc>] ', will be prepended.
* If it is not wished to see the return code, just add ``true`` to fake rc of 0 (only the last rc will be reported)::

Carsten Rose
committed
**Syntax**
::
<command>
..
+-------------+--------------------------------------------------+-----------------+
|**Parameter**|**Description** |**Default value**|
+=============+==================================================+=================+
|<command> |The command that should be executed on the server.|none |
+-------------+--------------------------------------------------+-----------------+

Carsten Rose
committed
**Minimal Examples** ::

Carsten Rose
committed
10.sql = SELECT "ls -s" AS _exec
20.sql = SELECT "./batchfile.sh" AS _exec

Carsten Rose
committed
Column: _pdf | _file | _zip
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most of the other Link-Class attributes can be used to customize the link. ::
10.sql = SELECT "[options]" AS _pdf, "[options]" AS _file, "[options]" AS _zip
with: [options] = [d:<exportFilename][|p:<params>][|U:<params>][|u:<url>][|F:file][|t:<text>][|a:<message>][|o:<tooltip>][|c:<class>][|r:<render mode>]
* Parameter are position independent.
* *<params>*: see `download-parameter-files`_
* For column `_pdf` and `_zip`, the element sources `p:...`, `U:...`, `u:...`, `F:...` might repeated multiple times.

Carsten Rose
committed
* Example::
10.sql = SELECT "F:fileadmin/test.pdf" as _pdf, "F:fileadmin/test.pdf" as _file, "F:fileadmin/test.pdf" as _zip
10.sql = SELECT "p:id=export&r=1" as _pdf, "p:id=export&r=1" as _file, "p:id=export&r=1" as _zip
10.sql = SELECT "t:Download PDF|F:fileadmin/test.pdf" as _pdf, "t:Download PDF|F:fileadmin/test.pdf" as _file, "t:Download ZIP|F:fileadmin/test.pdf" as _zip
10.sql = SELECT "t:Download PDF|p:id=export&r=1" as _pdf, "t:Download PDF|p:id=export&r=1" as _file, "t:Download ZIP|p:id=export&r=1" as _zip
10.sql = SELECT "d:complete.pdf|t:Download PDF|F:fileadmin/test1.pdf|F:fileadmin/test2.pdf" as _pdf, "d:complete.zip|t:Download ZIP|F:fileadmin/test1.pdf|F:fileadmin/test2.pdf" as _zip
10.sql = SELECT "d:complete.pdf|t:Download PDF|F:fileadmin/test.pdf|p:id=export&r=1|u:www.example.com" AS _pdf
Column: _savePdf
^^^^^^^^^^^^^^^^
Generated PDFs can be stored directly on the server with this functionality. The link query consists of the following parameters:
* One or more element sources (such as `F:`, `U:`, `p:`, see download-parameter-files_), including possible wkhtmltopdf parameters
* The export filename and path as `d:` - for security reasons, this path has to start with *fileadmin/*
* Please note that this option does not render anything in the front end, but is executed each time it is parsed.
You may want to add a check to prevent multiple execution.
* It is not advised to generate the filename with user input for security reasons.
* If the target file already exists it will be overwriten. To save individual files, choose a new filename,
for example by adding a timestamp.

Carsten Rose
committed
Example::
SELECT "d:fileadmin/result.pdf|F:fileadmin/_temp_/test.pdf" AS _savePdf
SELECT "d:fileadmin/result.pdf|F:fileadmin/_temp_/test.pdf|U:id=test&--orientation=landscape" AS _savePdf
.. _column-thumbnail:
Column: _thumbnail
^^^^^^^^^^^^^^^^^^
For file `T:<pathFileName>` a thumbnail will be rendered, saved (to be reused) and a HTML `<img>` tag is returned,

Carsten Rose
committed
With the SIP encoded thumbnail.

Carsten Rose
committed
The thumbnail:

Carsten Rose
committed
* Size is specified via `W:<dimension>`. The file is only rendered once and subsequent access is delivered via a local QFQ cache.
* Will be rendered, if the source file is newer than the thumbnail or if the thumbnail dimension changes.
* The caching is done by building the MD5 of pathFileName and thumbnail dimension.

Carsten Rose
committed
* Of multi page files like PDFs, the first page is used as the thumbnail.

Carsten Rose
committed
All file formats, which 'convert' ImageMagick (https://www.imagemagick.org/) supports, can be
used. Office file formats are not supported. Due to speed and quality reasons, SVG files will be converted by inkscape.
If a file format is not known, QFQ tries to show a corresponding file type image provided by Typo3 - such an image is not
In configuration_ the exact location of `convert` and `inkscape` can be configured (optional) as well as the directory
names for the cached thumbnails.
+-------+--------------------------------+----------------------------------------------------------------------------+
| Token | Example | Comment |
+=======+================================+============================================================================+
| T | T:fileadmin/file3.pdf | File render a thumbnail |
+-------+--------------------------------+----------------------------------------------------------------------------+
| W | W:200x, W:x100, W:200x100 | Dimension of the thumbnail: '<width>x<height>. Both |
| | | parameter are otional. If non is given the default is W:150x |
+-------+--------------------------------+----------------------------------------------------------------------------+
| s | s:1, s:0 | Optional. Default: `s:1`. If SIP is enabled, the rendered URL |
| | | is a link via `api/download.php?..`. Else a direct pathFileName. |
+-------+--------------------------------+----------------------------------------------------------------------------+
| r | r:7 | Render Mode. Default 'r:0'. With 'r:7' only the url will be delivered. |
+-------+--------------------------------+----------------------------------------------------------------------------+
The render mode '7' is useful, if the URL of the thumbnail have to be used in another way than the provided html-'<img>'
tag. Something like `<body style="background-image:url(bgimage.jpg)">` could be solved with
`SELECT "<body style="background-image:url(", 'T:fileadmin/file3.pdf' AS _thumbnail, ')">'`

Carsten Rose
committed
Example::
# SIP protected, IMG tag, thumbnail width 150px
10.sql = SELECT 'T:fileadmin/file3.pdf' AS _thumbnail
# SIP protected, IMG tag, thumbnail width 50px
20.sql = SELECT 'T:fileadmin/file3.pdf|W:50' AS _thumbnail
# No SIP protection, IMG tag, thumbnail width 150px
30.sql = SELECT 'T:fileadmin/file3.pdf|s:0' AS _thumbnail
# SIP protected, only the URL to the image, thumbnail width 150px
40.sql = SELECT 'T:fileadmin/file3.pdf|s:1|r:7' AS _thumbnail

Carsten Rose
committed
"""""""""

Carsten Rose
committed
ImageMagick support various settings to force the thumbnail size.
See https://www.imagemagick.org/script/command-line-processing.php#geometry or http://www.graphicsmagick.org/GraphicsMagick.html#details-geometry.

Carsten Rose
committed
""""""""
By default, the thumbnail directories are never cleaned. It's a good idea to install a cronjob which purges all files
older than 1 year: ::
find /path/to/files -type f -mtime +365 -delete
Render

Carsten Rose
committed
""""""
`Public` thumbnails are rendered at the time when the T3 QFQ record is executed. `Secure` thumbnails are rendered when the
'download.php?s=...' is called. The difference is, that the 'public' thumbnails blocks the page load until all thumbnails
are rendered, instead the `secure` thumbnails are loaded asynchonous via the browser - the main page is already delivered to
browser, all thumbnails appearing after a time.
A way to *pre render* thumbnails, is a periodically called (hidden) T3 page, which iterates over all new uploaded files and
triggers the rendering via column `_thumbnail`.
Thumbnail: secure

Carsten Rose
committed
"""""""""""""""""
Mode 'secure' is activated via enabling SIP (`s:1`, default). The thumbnail is saved under the path `thumbnailDirSecure`
as configured in configuration_.
The secure path needs to be protected against direct file access by the webmaster / webserver configuration too.
QFQ returns a HTML 'img'-tag: ::
<img src="api/download.php?s=badcaffee1234">

Carsten Rose
committed
"""""""""""""""""
Mode 'public' has to be explicit activated by specifying `s:0`. The thumbnail is saved under the path `thumbnailDirPublic`
as configured in configuration_.
QFQ returns a HTML 'img'-tag: ::
<img src="{{thumbnailDirPublic:Y}}/<md5 hash>.png">

Carsten Rose
committed

Carsten Rose
committed
10.sql = SELECT 'file:<filename>|tail:<number of last lines>|append:<0 or 1>|interval:<time in ms>|htmlId:<id>' AS _monitor

Carsten Rose
committed
+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|**Parameter**|**Description** |**Default value/behaviour**|
+=============+===========================================================================================+===========================+
|<filename> |The path to the file. Relative to T3 installation directory or absolute. |none |
+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|<tail> |Number of last lines to show |30 |
+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|<append> |0: Retrieved content replaces current. 1: Retrieved content will be added to current. |0 |
+-------------+-------------------------------------------------------------------------------------------+---------------------------+
|<htmlId> |Reference to HTML element to whose content replaced by the retrieve one. |monitor-1 |
+-------------+-------------------------------------------------------------------------------------------+---------------------------+

Carsten Rose
committed
.. _copyToClipboard:
Copy to clipboard
^^^^^^^^^^^^^^^^^
+-------------------+--------------------------------+----------------------------------------------------------------------------+
| Token | Example | Comment |
+===================+================================+============================================================================+
| y[:<content>] | y, y:some content | Initiates 'copy to clipboard' mode. Source might given text or page or url |
+-------------------+--------------------------------+----------------------------------------------------------------------------+
| F:<pathFileName> | F:fileadmin/protected/data.R | pathFileName in DocumentRoot |
+-------------------+--------------------------------+----------------------------------------------------------------------------+

Carsten Rose
committed
Example::

Carsten Rose
committed

Carsten Rose
committed
10.sql = SELECT 'y:hello world (yank)|t:content direct (yank)' AS _yank,
'y:hello world (link)|t:content direct (link)' AS _link,
CONCAT('F:', p.pathFileName,'|t:File (yank)|o:', p.pathFileName) AS _yank,
CONCAT('y|F:', p.pathFileName,'|t:File (link)|o:', p.pathFileName) AS _link
.. _special-sql-functions:

Carsten Rose
committed
Special SQL Functions (prepared statements)
-------------------------------------------
.. _qbar-qscape-qfq-delimiter:
QBAR: Escape QFQ Delimiter
^^^^^^^^^^^^^^^^^^^^^^^^^^
The SQL function QBAR(text) replaces "|" with "\\|" in `text` to prevent conflicts with the QFQ special column notation.
In general this function should be used when there is a chance that unplanned '|'-characters occur.
Example::
10.sql = SELECT CONCAT('p:notes|t:Information: ', QBAR(Note.title), '|b') AS _link FROM Note
In case 'Note.title' contains a '|' (like 'fruit | numbers'), it will confuse the '... AS _link' class. Therefore it's
necessary to 'escape' (adding a '\' in front of the problematic character) the bar which is done by using `QBAR()`.
.. _qnl2br:
QNL2BR: Convert newline to HTML '<br>'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SQL function QNL2BR(text) replaces `LF` or `CR/LF` by `<br>`. This can be used for data (containing LF) to output
on a HTML page with correctly displayed linefeed.
Example::
10.sql = SELECT QNL2BR(Note.title) FROM Note
One possibility how `LF` comes into the database is with form elements of type `textarea` if the user presses `enter` inside.
.. _qmore-truncate-long-text:
QMORE: Truncate Long Text - more/less