Commit bad9a575 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Doc: move donwload from CODING to PROTOCOL

parent d649c20e
......@@ -194,42 +194,7 @@ Form save
Download
--------
A download might be:
* a single file (any type, will be detected on the fly),
* an export of several files as a ZIP archive,
* an export of a T3-'XML'-Page converted to Excel,
* a converted HTML page to PDF,
* a PDF file, concatenated on single PDF files and/or converted HTML page to PDF.
'api/download.php' will be called with a SIP (no other vars used). The SIP contains:
* DOWNLOAD_EXPORT_FILENAME - any target filename, if none given take DOWNLOAD_OUTPUT_PDF ('output.pdf').
* DONWLOAD_MODE - file / pdf / excel / zip. If not specified:
a) 'file' is the default if only one is given and if this is a file.
b) 'pdf' is the default if there are multiple TOKEN_URL, TOKEN_URL_PARAM, TOKEN_FILE in SIP_DOWNLOAD_PARAMETER found.
* SIP_DOWNLOAD_PARAMETER (base64 encoded) - contains all parameter to source elements.
Format: <format 1>:<element 1>|<format 2>:<element 2>|...|<format n>:<element n>|
<format>: TOKEN_URL, TOKEN_URL_PARAM, TOKEN_FILE
<element>: depending on the token - see below
URL: a) 'u:http://w3c.org', b) 'u:w3c.org/', c) 'u:w3c.org/2017/index.php?issue=23'
URL_PARAM: a) 'U:id=export&r=123', b) 'U:id=export&r=123&_orientation=landscape&_page-size=a3'
FILE: a) 'f:fileadmin/example.png'
* In URL_PARAM extra parameter used by `wkhtmltopdf` can be specified. All Parameter, starting with '-'
will be extracted from the regular URL_PARAM and instead forwarded as options to `wkhtmlpdf`
* The base64 encoding is necessary:
* to deliver multiple elements with the same token (e.g. multiple PDF files to concatenate).
* special parameter names, like 'id', should not force the regular interpretation of 'id' during conversion to a SIP.
During preparing and delivering the download, a popup shows a spinning gear by default. The popup itself will display an
individual message. The popup needs some HTML code (only once per T3 page).
Download links might be generated in `report` as well as in `subrecords of forms`. To trigger the generation of the HTML
popup code, a variable DOWNLOAD_POPUP_REQUEST in STORE_SYSTEM will be set to 'true' (string) in class Link(), as soon as
the first download link is rendered. During internal rendering of the download link, the const text token
DOWNLOAD_POPUP_REPLACE_TEXT and DOWNLOAD_POPUP_REPLACE_TITLE will be replaced with individual texts, defined per download link.
See PROTOCOL.md > Download
Print
-----
......
......@@ -21,7 +21,7 @@ JSON Response from the server containing at least:
{
"status": "success"|"error",
"message": "<message>"
}
}
`status` indicates whether or not the request has been fullfiled by
the server (`"success"`) or encountered an error (`"error"`). On
......@@ -336,6 +336,62 @@ Server Response
: The response contains a [Minimal Response].
[Redirection Response] may be included.
### Download
Request
: api/download.php
Request Method
: GET
URL Parameters
: `s=<SIP>`
Server Response
: header("Content-type: $mimetype");
header("Content-Length: $length");
header("Content-Disposition: inline; filename=\"$outputFilename\"");
header("Pragma: no-cache");
header("Expires: 0");
file_get_contents($file);
A download might be:
* a single file (any type, will be detected on the fly),
* an export of several files as a ZIP archive,
* an export of a T3-'XML'-Page converted to Excel,
* a converted HTML page to PDF,
* a PDF file, concatenated on single PDF files and/or converted HTML page to PDF.
'api/download.php' will be called with a SIP (no other vars used). The SIP contains:
* DOWNLOAD_EXPORT_FILENAME - any target filename, if none given take DOWNLOAD_OUTPUT_PDF ('output.pdf').
* DONWLOAD_MODE - file / pdf / excel / zip. If not specified:
a) 'file' is the default if only one is given and if this is a file.
b) 'pdf' is the default if there are multiple TOKEN_URL, TOKEN_URL_PARAM, TOKEN_FILE in SIP_DOWNLOAD_PARAMETER found.
* SIP_DOWNLOAD_PARAMETER (base64 encoded) - contains all parameter to source elements.
Format: <format 1>:<element 1>|<format 2>:<element 2>|...|<format n>:<element n>|
<format>: TOKEN_URL, TOKEN_URL_PARAM, TOKEN_FILE
<element>: depending on the token - see below
URL: a) 'u:http://w3c.org', b) 'u:w3c.org/', c) 'u:w3c.org/2017/index.php?issue=23'
URL_PARAM: a) 'U:id=export&r=123', b) 'U:id=export&r=123&_orientation=landscape&_page-size=a3'
FILE: a) 'f:fileadmin/example.png'
* In URL_PARAM extra parameter used by `wkhtmltopdf` can be specified. All Parameter, starting with '-'
will be extracted from the regular URL_PARAM and instead forwarded as options to `wkhtmlpdf`
* The base64 encoding is necessary:
* to deliver multiple elements with the same token (e.g. multiple PDF files to concatenate).
* special parameter names, like 'id', should not force the regular interpretation of 'id' during conversion to a SIP.
During preparing and delivering the download, a popup shows a spinning gear by default. The popup itself will display an
individual message. The popup needs some HTML code (only once per T3 page).
Download links might be generated in `report` as well as in `subrecords of forms`. To trigger the generation of the HTML
popup code, a variable DOWNLOAD_POPUP_REQUEST in STORE_SYSTEM will be set to 'true' (string) in class Link(), as soon as
the first download link is rendered. During internal rendering of the download link, the const text token
DOWNLOAD_POPUP_REPLACE_TEXT and DOWNLOAD_POPUP_REPLACE_TITLE will be replaced with individual texts, defined per download link.
### Typeahead
The Client initiates Typeahead actions via a GET request. A JSON key/value dict will we be send back as response.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment