diff --git a/doc/CODING.md b/doc/CODING.md index 5f6cd691b6bc6a6d806b9f58a8cf2c648251f09a..abed0946acd5bf11a6f07d01d91e202f3246347a 100644 --- a/doc/CODING.md +++ b/doc/CODING.md @@ -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 ----- diff --git a/doc/PROTOCOL.md b/doc/PROTOCOL.md index 9c758fa0fc4b19a95540dd3f83b8771301400057..349170e4d22cdeae6f0e956b64adbc526d7a00cc 100644 --- a/doc/PROTOCOL.md +++ b/doc/PROTOCOL.md @@ -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.