Commit 9b1ef2ce authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'F11998CustomQFQ-Function' into 'develop'

F11998 custom qfq function

See merge request !321
parents 5744133f 92963fb7
Pipeline #5060 passed with stages
in 3 minutes and 39 seconds
......@@ -320,8 +320,8 @@ In :ref:`config-qfq-php` mutliple database credentials can be prepared. Mandator
`DB_1_USER`, `DB_1_SERVER`, `DB_1_PASSWORD`, `DB_1_NAME`. The number '1' indicates the `dbIndex`. Increment the number
to specify further database credential setups.
Typically the credentials for `DB_1` also have access to the T3 database.
By convention, it's necessary that `DB_1` is the one who also have access to the Typo3 database. E.q. `QFQ Function`_ or
download links (based on QFQ functions) needs access to the T3 database to directly fetch tt-content records.
Different QFQ versions, shared database
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
......@@ -173,11 +173,11 @@ Processing of the resulting rows and columns:
* In general, all columns of all rows will be printed out sequentially.
* On a per column base, printing of columns can be suppressed by starting the column name with an underscore '_'. E.g.
`SELECT id AS _id`.
``SELECT id AS _id``.
This might be useful to store values, which will be used later on in another query via the `{{id:R}}` or
`{{<level>.columnName}}` variable. To suppress printing of a column, use a underscore as column name prefix. E.g.
`SELECT id AS _id`
This might be useful to store values, which will be used later on in another query via the ``{{id:R}}`` or
``{{<level>.columnName}}`` variable. To suppress printing of a column, use a underscore as column name prefix. E.g.
``SELECT id AS _id``
*Reserved column names* have a special meaning and will be processed in a special way. See
:ref:`Processing of columns in the SQL result<Processing of columns in the SQL result>` for details.
......@@ -489,8 +489,8 @@ Access column values
Columns of the upper / outer level result can be accessed via variables in two ways
* STORE_RECORD: `{{pId:R}}`
* Level Key: `{{10.pId}}`
* STORE_RECORD: ``{{pId:R}}``
* Level Key: ``{{10.pId}}``
The STORE_RECORD will always be merged with previous content. The Level Keys are unique.
......@@ -507,7 +507,7 @@ Example::
10.sql = SELECT 'p:home&form=Person|s|b:success|t:Edit' AS _link
10.20.sql = SELECT '{{link:R}}', '{{&link:R}}'
The first column of row `10.20` returns 'p:home&form=Person|s|b:success|t:Edit',the second column returns
The first column of row `10.20` returns `p:home&form=Person|s|b:success|t:Edit`,the second column returns
'<span class="btn btn-success"><a href="?home&s=badcaffee1234">Edit</a></span>'.
Example STORE_RECORD::
......@@ -606,11 +606,11 @@ One exception are columns, whose name starts with '_'. E.g.::
* The fourth column (alias name 'link') uses a QFQ special column name. Here, only in this example, it has no
further meaning.
* All columns in a row, with the same special column name (e.g. ``... AS _page``) will have the same column name: 'page'.
To access individual columns a uniq column title is necessary and can be added ``|_column1``::
To access individual columns a uniq column title is necessary and can be added ``...|column1``::
10.sql = SELECT '..1..' AS '_page|column1', '..2..' AS '_page|column2'
Those columns can be accessed via ``{{10.column1}}`` , ``{{10.column2}}`` or (recommended) ``{{column1:R}}`` , ``{{column2:R}}``
Those columns can be accessed via ``{{column1:R}}`` , ``{{column2:R}}`` (recommended) or ``{{10.column1}}`` , ``{{10.column2}}``.
* To skip wrapping via ``fbeg``, ``fsep``, ``fend`` for dedicated columns, add the keyword ``|_noWrap`` to the column alias.
Example::
......@@ -618,17 +618,17 @@ One exception are columns, whose name starts with '_'. E.g.::
Summary:
.. note::
* Special column names always start with '_'.
* Columns starting with a '_' but not defined as as QFQ special column name are hidden(!) - in other words: they are
not **printed** as output.
* SQL hint: If there is no column alias defined, the column name becomes the value
of the first row. E.g. if the first selected row contains a '_' as the first
character, the column name becomes '_....' - which will be hidden! To be safe: always define an alias!
* 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
* For 'special column names': the column name together with the value controls how QFQ processes the column.
* Special column names always start with '_'.
* 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.
* Columns starting with a '_' but not defined as as QFQ special column name are hidden(!) - in other words: they are
not **printed** as output.
* Tip: if a column name starts with '_' the column name becomes '_....' - which will be hidden! To be safe: always
define an alias!
* Access to 'hidden' columns via ``{{<level>.<column>}}`` or ``{{<column>:R}}`` are possible and often used.
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Reserved column name | Purpose |
......@@ -687,13 +687,14 @@ Summary:
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _XLSn |Used for Excel export. Prepend 'n=' and append a `newline` character around the string. See :ref:`excel-export`. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _noWrap |Skip wrapping via `fbeg`, ``fsep``, ``fend``. |
| _noWrap |Skip wrapping via ``fbeg``, ``fsep``, ``fend``. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _hide |Column is hidden. |
| _hide |Hide a column with a special column name (like ``... AS _link``). Note: regular columns should be hidden by using '_' as the first letter of the column name. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _+<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>' |
| _+<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 :ref:`STORE_USER`, :ref:`store_user_examples` |
| _=<varname> |The content will be saved in store 'user' under 'varname'. Retrieve it later via ``{{varname:U}}``. Example: ``'SELECT "Hello world" AS _=text'``. |
| |See :ref:`STORE_USER`, :ref:`store_user_examples` |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_<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. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
......@@ -704,10 +705,10 @@ Column: _link
^^^^^^^^^^^^^
* Most URLs will be rendered via class link.
* Column names like `_pagee`, `_mailto`, ... are wrapper to 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 :ref:`qbar-escape-qfq-delimiter`.
via QFQ SQL function ``QBAR()`` - see :ref:`qbar-escape-qfq-delimiter`.
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|URL|IMG|Meaning |Qualifier |Example |Description |
......@@ -1017,16 +1018,16 @@ references are not found, if they use different colummnnames or tablenames.
Mode: table
"""""""""""
* `table=<table name>`
* `r=<record id>`
* ``table=<table name>``
* ``r=<record id>``
Deletes the record with id '<record id>' from table '<table name>'.
Mode: form
""""""""""
* `form=<form name>`
* `r=<record id>`
* ``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.
......@@ -1044,7 +1045,7 @@ Examples
Columns: _Page[X]
^^^^^^^^^^^^^^^^^
* Similar to `_page[X]`
* Similar to ``_page[X]``
* Parameter are position dependent and therefore without a qualifier!
::
......@@ -1056,7 +1057,7 @@ Columns: _Page[X]
Column: _Paged
^^^^^^^^^^^^^^
* Similar to `_paged`
* Similar to ``_paged``
* Parameter are position dependent and therefore without a qualifier!
::
......@@ -1416,7 +1417,7 @@ Run a php function defined in an external script.
* If the function returns an associative array, then the **key-value pairs will be accessible via the VARS store `V`**.
* If the function throws an **exception** then a standard QFQ error message is shown.
* Text sent to 'stderr' by the php function is not returned at all.
* The script has access to the following **qfq functions** using the interface (see examples below):
* The script has access to the following **qfq php functions** using the interface (see examples below):
* $qfq::apiCall($method, $url, $data = '', $header = [], $timeout = 5)
* arguments:
* string $method: can be PUT/POST/GET/DELETE
......@@ -1510,9 +1511,9 @@ Most of the other Link-Class attributes can be used to customize the link. ::
* Parameter are position independent.
* *<params>*: see :ref:`download-parameter-files`
* For column `_pdf` and `_zip`, the element sources `p:...`, `U:...`, `u:...`, `F:...` might repeated multiple times.
* For column `_zip`, an optional parameter might define the path and filename inside the ZIP: `F:<orig filename>:<inside ZIP path and filename>`
* To only render the page content without menus add the parameter `type=2`. For example: `U:id=pageToPrint&type=2&_sip=1&r=', r.id`
* For column ``_pdf`` and ``_zip``, the element sources ``p:...``, ``U:...``, ``u:...``, ``F:...`` might repeated multiple times.
* For column ``_zip``, an optional parameter might define the path and filename inside the ZIP: `F:<orig filename>:<inside ZIP path and filename>`
* To only render the page content without menus add the parameter ``type=2``. For example: ``U:id=pageToPrint&type=2&_sip=1&r=', r.id``
* Example::
# ... AS _file
......@@ -1547,8 +1548,8 @@ 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 :ref:`download-parameter-files`), including possible wkhtmltopdf parameters
* The export filename and path as `d:` - for security reasons, this path has to start with *fileadmin/* and end with *.pdf*.
* One or more element sources (such as ``F:``, ``U:``, ``p:``, see :ref:`download-parameter-files`), including possible wkhtmltopdf parameters
* The export filename and path as ``d:`` - for security reasons, this path has to start with *fileadmin/* and end with *.pdf*.
Tips:
......@@ -1569,12 +1570,12 @@ Example::
Column: _thumbnail
^^^^^^^^^^^^^^^^^^
For file `T:<pathFileName>` a thumbnail will be rendered, saved (to be reused) and a HTML `<img>` tag is returned,
For file ``T:<pathFileName>`` a thumbnail will be rendered, saved (to be reused) and a HTML ``<img>`` tag is returned,
With the SIP encoded thumbnail.
The thumbnail:
* Size is specified via `W:<dimension>`. The file is only rendered once and subsequent access is delivered via a local QFQ cache.
* 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.
* Of multi page files like PDFs, the first page is used as the thumbnail.
......@@ -1584,7 +1585,7 @@ used. Office file formats are not supported. Due to speed and quality reasons, S
If a file format is not known, QFQ tries to show a corresponding file type image provided by Typo3 - such an image is not
scaled.
In :ref:`configuration` the exact location of `convert` and `inkscape` can be configured (optional) as well as the directory
In :ref:`configuration` the exact location of ``convert`` and ``inkscape`` can be configured (optional) as well as the directory
names for the cached thumbnails.
+-------+--------------------------------+----------------------------------------------------------------------------+
......@@ -1595,15 +1596,15 @@ names for the cached thumbnails.
| 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. |
| 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, ')">'`
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, ')">'``
Example::
......@@ -1839,7 +1840,7 @@ 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()`.
necessary to 'escape' (adding a '\' in front of the problematic character) the bar which is done by using ``QBAR()``.
.. _qbar-escape-qfq-colon-coma:
......@@ -1939,6 +1940,86 @@ Output::
my name is john - end of sentence
.. _qfq_function:
QFQ Function
------------
QFQ SQL reports can be reused, similar to a function in a regular programming language, including call parameter and return
values.
* Per tt-content record the field 'subheader' (in Typo3 backend) defines the function name. The function
can also referenced by using the tt-content number (`uid`) - but this is less readable.
* The calling report calls the function by defining ``<level>.function = <function name>(var1, var2, ...) => return1, return2, ...``
* STORE_RECORD will be saved before calling the function and will be restored when the function has been finished.
* The function has only access to STORE_RECORD variables which has been explicitly defined in the braces (var1, var2, ...).
* The function return values will be copied to STORE_RECORD after the function finished.
* Inside the QFQ function, all other STORES are fully available.
* If ``<level>.function`` and ``<level>.sql`` are both given, ``<level>.function`` is processed first.
* If ``<level>.function`` is given, but ``<level>.sql`` not, the values of ``shead, stail, althead`` are even processed.
* If a function outputs something, this is *not* shown.
* The output of a QFQ function is accessible via ``{{_output:R}}``.
* It is possible to call functions inside of a function.
* If ``render = api`` is defined in the function, both tt-content records can be saved on the *same* page and won't interfere.
Example tt-content record for the function::
Subheader: getFirstName
Code:
#
# {{pId:R}}
#
render = api
100 {
  sql = SELECT p.firstName AS _firstName
               , NOW() AS now, CONCAT('p:{{pageAlias:T}}&form=person&r=', p.id ) AS '_pagee|_hide|myLink'            
          FROM Person AS p
          WHERE p.id={{pId:R}}
}                       
Example tt-content record for the calling report::
#
# Example how to use `<level>.function = ...`
#
10 {
  sql = SELECT p.id AS _pId, p.name FROM Person AS p ORDER BY p.name
  head = <table class="table"><tr><th>Name</th><th>Firstname</th><th>Link (final)</th><th>Link (source)</th><th>NOW() (via Output)</th></tr>
  tail = </table>
  rbeg = <tr>
  renr = </tr>
  fbeg = <td>
  fend = </td>
                                                                    
  20 {
    function = getFirstName(pId) => firstName, myLink    
  }
                                                                    
  30 {
    sql = SELECT '{{firstName:R}}', "{{myLink:R}}", "{{&myLink:R}}", '{{_output:R}}'
    fbeg = <td>
    fend = </td>
  }
}                                                                    
Explanation:
* Level 10 iterates over all `person`.
* Level 10.20 calls QFQ function `getFirstName()` by delivering the `pId` via STORE_RECORD. The function expects the return
value `firstName` and `myLink`.
* The function selects in level 100 the person given by ``{{pId:R}}``. The `firstName` is not printed but a hidden column.
Column ``now`` is printed. Column 'myLink' is a rendered link, but not printed.
* Level 10.30 prints the return values ``firstName`` and ``myLink`` (as rendered link and as source definition). The last
column is the output of the function - the value of ``NOW()``
.. tip::
If there are STORE_RECORD variables which can't be replaced: typically they have been not defined as function parameter
or return values.
.. _download:
Download
......@@ -1974,29 +2055,29 @@ The rest of this section applies only to `Persistent Link` and `Secure Link`. Do
* ZIP archive - filled with several files ('uploaded' or 'HTML to PDF'-converted).
* Excel - created from scratch or fill a template xlsx with database values.
By using the `_link` column name:
By using the ``_link`` column name:
* the option `d:...` initiate creating the download link and optional specifies
* the option ``d:...`` initiate creating the download link and optional specifies
* in `SIP` mode: an export filename (),
* in `persistent link` mode: path download script (optional) and key(s) to identify the record with the PathFilename
* in ``SIP`` mode: an export filename (),
* in ``persistent link`` mode: path download script (optional) and key(s) to identify the record with the PathFilename
information (see below).
* the optional `M:...` (Mode) specifies the export type (file, pdf, zip, export),
* the alttext `a:...` specifies a message in the download popup.
* the optional ``M:...`` (Mode) specifies the export type (file, pdf, zip, export),
* the alttext ``a:...`` specifies a message in the download popup.
By using `_pdf`, `_Pdf`, `_file`, `_File`, `_zip`, `_Zip`, `_excel` as column name, the options `d`, `M` and `s`
By using ``_pdf``, ``_Pdf``, ``_file``, ``_File``, ``_zip``, ``_Zip``, ``_excel`` as column name, the options `d`, `M` and `s`
will be set.
All files will be read by PHP - therefore the directory might be protected against direct web access. This is the
preferred option to offer secure downloads via QFQ.
preferred option to offer secure downloads via QFQ. Check `secure-direct-file-access`_.
.. _download-parameter-files:
Parameter and (element) sources
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* mode `secure link` (s:1) - *download*: `d[:<exportFilename>]`
* mode `secure link` (s:1) - *download*: ``d[:<exportFilename>]``
* *exportFilename* = <filename for save as> - Name, offered in the 'File save as' browser dialog. Default: 'output.<ext>'.
......@@ -2049,34 +2130,34 @@ Parameter and (element) sources
Link: https://example.com/dl.php/doe/john
* *popupMessage*: `a:<text>` - will be displayed in the popup window during download. If the creating/download is fast, the window might disappear quickly.
* *popupMessage*: ``a:<text>`` - will be displayed in the popup window during download. If the creating/download is fast, the window might disappear quickly.
* *mode*: `M:<mode>`
* *mode*: ``M:<mode>``
* *mode* = <file | pdf | zip | excel>
* If `M:file`, the mime type is derived dynamically from the specified file. In this mode, only one element source
* If ``M:file``, the mime type is derived dynamically from the specified file. In this mode, only one element source
is allowed per download link (no concatenation).
* In case of multiple element sources, only `pdf`, `zip` and `excel` (template mode) is supported.
* If `M:zip` is used together with `p:...`, `U:...` or `u:..`, those HTML pages will be converted to PDF. Those files
* If ``M:zip`` is used together with `p:...`, `U:...` or `u:..`, those HTML pages will be converted to PDF. Those files
get generic filenames inside the archive.
* If not specified, the **default** 'Mode' depends on the number of specified element sources (=file or web page):
* If only one `file` is specified, the default is `file`.
* If there is a) a page defined or b) multiple elements, the default is `pdf`.
* *element sources* - for `M:pdf` or `M:zip`, all of the following element sources may be specified multiple times.
* *element sources* - for ``M:pdf`` or ``M:zip``, all of the following element sources may be specified multiple times.
Any combination and order of these options are allowed.
* *file*: `F:<pathFileName>` - relative or absolute pathFileName offered for a) download (single), or to be concatenated
* *file*: ``F:<pathFileName>`` - relative or absolute pathFileName offered for a) download (single), or to be concatenated
in a PDF or ZIP.
* *page*: `p:id=<t3 page>&<key 1>=<value 1>&<key 2>=<value 2>&...&<key n>=<value n>`.
* *page*: ``p:id=<t3 page>&<key 1>=<value 1>&<key 2>=<value 2>&...&<key n>=<value n>``.
* By default, the options given to wkhtml will *not* be encoded by a SIP!
* To encode the parameter via SIP: Add '_sip=1' to the URL GET parameter.
E.g. `p:id=form&_sip=1&form=Person&r=1`.
E.g. ``p:id=form&_sip=1&form=Person&r=1``.
In that way, specific sources for the `download` might be SIP encrypted.
......@@ -2085,13 +2166,31 @@ Parameter and (element) sources
* If there are trouble with accessing FE_GROUP protected content, please check :ref:`wkhtmltopdf<wkhtml>`.
* *url*: `u:<url>` - any URL, pointing to an internal or external destination.
* *url*: ``u:<url>`` - any URL, pointing to an internal or external destination.
* *uid*: ``uid:<function name>`` - the output is treated as HTML (will be converted to PDF) or EXCEL data.
* *uid*: `uid:<tt-content record id>` - the tt_content.uid of a QFQ PageContent record (shown on hover in the backend). This will render
only the specified QFQ content record, without any Typo3 layout elements (Menu, Body,...)
QFQ will retrieve the tt-content's bodytext from the Typo3 database, parse it, and render it as a PDF. Parameters can be
passed: `uid:<tt-content record id>[&arg1=value1][&arg2=value2][...]` and will be available in the SIP store for the QFQ PageContent,
or passed as wkhtmltopdf arguments, if applicable.
* The called tt-content record is identified by `function name`, specified in the subheader field. Optional
the numeric id of the tt-content record (=uid) can be given.
* Only the specified QFQ content record will be rendered, without any Typo3 layout elements (Menu, Body,...)
* QFQ will retrieve the tt-content's bodytext from the Typo3 database, parse it, and render it as a PDF or Execl data.
* Parameters can be passed: ``uid:<tt-content record id>[&arg1=value1][&arg2=value2][...]`` and will be available via
STORE_SIP in the QFQ PageContent, or passed as wkhtmltopdf arguments, if applicable.
* For more obviously structuring, put the additional tt-content record on the same Typo3 page (where the QFQ
tt-content record is located which produces the link) and specify ``render = api`` (`report-render`_).
* *source*: ``source:<function name>[&arg1=value1][&arg2=value2][&...]`` - (similar to a `uid`) the output is treated
as further sources. Example result reported by *function name* might be: ``F:file.pdf1|uid:myData&arg=2|...``
* Use this functionality to define a *central managed download* function, which can be reused anywhere by just specify the
*function name* and required arguments.
* The called tt-content record is identified by `function name`, specified in the subheader field. Optional
the numeric id of the tt-content record (=uid) can be given.
* The output of the tt-content record will be treated as further source arguments. Nothing else than valid source
references should be printed. Separate the references as usual by '|'.
* The supplied arguments are available via STORE_SIP (this is different from `qfq_function`_).
* Tip: For more obviously structuring, put the additional tt-content record on the same Typo3 page (where the QFQ
tt-content record is located which produces the link) and specify ``render = api`` (`report-render`_).
* *WKHTML Options* for `page`, `urlParam` or `url`:
......@@ -2127,6 +2226,12 @@ Example `_link`: ::
# One source and a header file. Note: the parameter to the header URL is escaped with double backslash.
SELECT "d:complete.pdf|s|t:Complete PDF|p:id=detail2&r=1&--orientation=Landscape&--header={{URL:R}}?indexp.php?id=head\\&L=1|F:fileadmin/pdf/test.pdf" AS _link
# One indirect source reference
SELECT "d:complete.pdf|s|t:Complete PDF|source:centralPdf&pId=1234" AS _link
An additional tt-content record is defined with `sub header: centralPdf`. One or multiple attachments might be concatenated.
10.sql = SELECT '|F:', a.pathFileName FROM Attachments AS a WHERE a.pId={{pId:S}}
..
Example `_pdf`, `_zip`: ::
......@@ -2306,13 +2411,13 @@ Setup
* Create a T3 PageContent which delivers the content.
* It is recommended to use the `uid:<tt-content record id>` syntax for excel imports, because there should be no html code on the
* It is recommended to use the ``uid:<tt-content record id>`` syntax for excel imports, because there should be no html code on the
resulting content. QFQ will retrieve the PageContent's bodytext from the Typo3 database, parse it, and pass the
result as the instructions for filling the excel file.
* Parameters can be passed: `uid:<tt-content record id>?param=<value1>&param2=<value2>` and will be accessible in the SIP Store (S) in the
* Parameters can be passed: ``uid:<tt-content record id>?param=<value1>&param2=<value2>`` and will be accessible in the SIP Store (S) in the
QFQ PageContent.
* Use the regular QFQ Report syntax to create output.
* The newline at the end of every line needs to be CHAR(10). To make it simpler, the special column name `... AS _XLS`
* The newline at the end of every line needs to be CHAR(10). To make it simpler, the special column name ``... AS _XLS``
(see _XLS, _XLSs, _XLSb, _XLSn) can be used.
* One option per line.
* Empty lines will be skipped.
......@@ -2440,18 +2545,21 @@ This defines a menu (three vertical buttons) - a click on it shows two menu entr
Format the dropdown menu symbol:
* *Glyph*: Via `G:<glyphicon name>` any glyphicon can be defined. To hide the default glyph, specify: `G:0`.
* *Text*: Via `t:Menu` an additional text will be displayed for the menu symbol.
* *Tooltip*: Via `o:Detail menu` a tooltip is defined.
* *Render mode*: Via `r:3` the menu is disabled. No menu entries / links / sip are rendered.
* *Button*: Via `b` the dropdown meny symbol will be rendered with a button. Also `b:<style>` might set the BS color.
* *Glyph*: Via ``G:<glyphicon name>`` any glyphicon can be defined. To hide the default glyph, specify: `G:0`.
* *Text*: Via ``t:Menu`` an additional text will be displayed for the menu symbol.
* *Tooltip*: Via ``o:Detail menu`` a tooltip is defined.
* *Render mode*: Via ``r:3`` the menu is disabled. No menu entries / links / sip are rendered.
* *Button*: Via ``b`` the dropdown meny symbol will be rendered with a button. Also `b:<style>` might set the BS color.
Format a menu entry:
* *qfq link*: All options as with a regular QFQ link.
* *header*: If a text starts with '===', it becomes a header in the dropdown menu. Multiple headers are possible. Headers can't be a link. An additional `r:1` is necessary.
* *separator*: If a text is exactly '---', it becomes a separator line between two menu entries. An additional `r:1` is necessary.
* *disabled menu entry*: If a text starts with '---' (like separator), the following text becomes a disable menu entry. An additional `r:1` is necessary.
* *header*: If a text starts with '===', it becomes a header in the dropdown menu. Multiple headers are possible.
Headers can't be a link. An additional `r:1` is necessary.
* *separator*: If a text is exactly '---', it becomes a separator line between two menu entries. An additional ``r:1``
is necessary.
* *disabled menu entry*: If a text starts with '---' (like separator), the following text becomes a disable menu entry.
An additional ``r:1`` is necessary.
Example 2::
......@@ -2463,11 +2571,11 @@ Example 2::
'||d|p:form&form=person&r=',p.id,'|s|t:Download Person|b:0',
'||r:1|t:---Disabled entry') AS _link
Line 1: The dropdown menu symbol definition, with a text 'Menu' `t:Menu`, but without the three vertical bullets `G:0`
and a tooltip for the menu `o:Please select an option`.
Line 1: The dropdown menu symbol definition, with a text 'Menu' ``t:Menu``, but without the three vertical bullets ``G:0``
and a tooltip for the menu ``o:Please select an option``.
Line 2: First menu entry. Directs to T3 page 'home' `p:home`. `t:Home` sets the menu entry text. `G:glyphicon-home` set's
glyphicon symbol in the menu entry. `b:0` switches off the button, which has been implicit activated by the use of `G:...`.
Line 2: First menu entry. Directs to T3 page 'home' ``p:home``. ``t:Home`` sets the menu entry text. ``G:glyphicon-home`` set's
glyphicon symbol in the menu entry. ``b:0`` switches off the button, which has been implicit activated by the use of ``G:...``.
Line 3: A separator line.
......@@ -2547,13 +2655,13 @@ Part 1: Display list
Display the list of elements via a regular QFQ content record. All 'drag and drop' elements together have to be nested by a HTML
element. Such HTML element:
* With `class="qfq-dnd-sort"`.
* With a form name: `{{'form=<form name>' AS _data-dnd-api}}` (will be replaced by QFQ)
* With ``class="qfq-dnd-sort"``.
* With a form name: ``{{'form=<form name>' AS _data-dnd-api}}`` (will be replaced by QFQ)
* Only *direct* children of such element can be dragged.
* Every children needs a unique identifier `data-dnd-id="<unique>"`. Typically this is the corresponding record id.
* Every children needs a unique identifier ``data-dnd-id="<unique>"``. Typically this is the corresponding record id.
* The record needs a dedicated order column, which will be updated through API calls in time.
A `<div>` example HTML output (HTML send to the browser): ::
A ``<div>`` example HTML output (HTML send to the browser): ::
<div class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Classes/Api/dragAndDrop.php?s=badcaffee1234">
<div class="anyClass" id="<uniq1>" data-dnd-id="55">
......@@ -2568,7 +2676,7 @@ A `<div>` example HTML output (HTML send to the browser): ::
</div>
A typical QFQ report which generates those `<div>` HTML::
A typical QFQ report which generates those ``<div>`` HTML::
10 {
sql = SELECT '<div id="anytag-', n.id,'" data-dnd-id="', n.id,'">' , n.note, '</div>'
......@@ -2581,7 +2689,7 @@ A typical QFQ report which generates those `<div>` HTML::
}
A `<table>` based setup is also possible. Note the attribute `data-columns="3"` - this generates a dropzone
A ``<table>`` based setup is also possible. Note the attribute ``data-columns="3"`` - this generates a dropzone
which is the same column width as the outer table. ::
<table>
......@@ -2639,7 +2747,7 @@ A dedicated `Form`, without any `FormElements`, is used to define the reorder lo
Fields:
* Name: <custom form name> - used in Part 1 in the `_data-dnd-api` variable.
* Name: <custom form name> - used in Part 1 in the ``_data-dnd-api`` variable.
* Table: <table with the element records> - used to update the records specified by `dragAndDropOrderSql`.
* Parameter:
......@@ -2680,7 +2788,7 @@ QFQ iterates over the result set of `dragAndDropOrderSql`. The value of column `
QFQ Icons
---------
Located under ` typo3conf/ext/qfq/Resources/Public/icons`::
Located under ``typo3conf/ext/qfq/Resources/Public/icons``::
black_dot.png bullet-red.gif checked-red.gif emoji.svg mail.gif pointer.svg up.gif
blue_dot.png bullet-yellow.gif checked-yellow.gif gear.svg marker.svg rectangle.svg upload.gif
......@@ -2719,7 +2827,7 @@ Example::
Example::
10.sql = SELECT "p:home&r=0|t:Home|c:qfq-100 qfq-left" AS _pagev
10.sql = SELECT "p:home&r=0|t:Home|c:qfq-100 qfq-left" AS _pages
Tablesorter
-----------
......
......@@ -22,7 +22,7 @@ Quick Form Query Extension
en
:Copyright:
2017-2020
2017-2021
:Authors:
Carsten Rose, Benjamin Baer
......
......@@ -490,9 +490,6 @@ const SYSTEM_DB_INIT = 'init';
const SYSTEM_DB_INDEX_DATA = "indexData";
const SYSTEM_DB_INDEX_QFQ = "indexQfq";
//const SYSTEM_DB_INDEX_DATA_DEPRECATED = "DB_INDEX_DATA";
//const SYSTEM_DB_INDEX_QFQ_DEPRECATED = "DB_INDEX_QFQ";
// Automatically filled by QFQ
const SYSTEM_DB_NAME_DATA = 'dbNameData';
const SYSTEM_DB_NAME_QFQ = 'dbNameQfq';
......@@ -1010,6 +1007,7 @@ const F_PARAMETER = 'parameter'; // valid for F_ and FE_
// Form columns: via parameter field
const F_DB_INDEX = 'dbIndex';
const DB_INDEX_DEFAULT = "1";
const DB_INDEX_T3 = DB_INDEX_DEFAULT;
const PARAM_DB_INDEX_DATA = '__dbIndexData'; // Submitted via SIP to make record locking DB aware.
const F_FORM_SUBMIT_LOG_MODE = 'formSubmitLogMode';
......@@ -1529,6 +1527,7 @@ const SENDMAIL_TOKEN_ATTACHMENT_PAGE = 'p';
// Report, BodyText
const TOKEN_SQL = 'sql';
const TOKEN_FUNCTION = 'function';
const TOKEN_TWIG = 'twig';
const TOKEN_HEAD = 'head';
const TOKEN_ALT_HEAD = 'althead';
......@@ -1553,7 +1552,7 @@ const TOKEN_DB_INDEX = F_DB_INDEX;
const TOKEN_CONTENT = 'content';
const TOKEN_REPORT_FILE = 'file';
const TOKEN_VALID_LIST = 'sql|twig|head|althead|altsql|tail|shead|stail|rbeg|rend|renr|rsep|fbeg|fend|fsep|fskipwrap|rbgd|debug|form|r|debugShowBodyText|dbIndex|sqlLog|sqlLogMode|content|render';