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

Bug 7514: broken defaults in _pdf, _file, _link. Fixes #7514.

parent 54d9bb1d
Pipeline #1252 passed with stage
in 1 minute and 45 seconds
...@@ -6141,30 +6141,6 @@ Most of the other Link-Class attributes can be used to customize the link. :: ...@@ -6141,30 +6141,6 @@ Most of the other Link-Class attributes can be used to customize the link. ::
10.sql = SELECT "d:complete.pdf|t:Download PDF|F:fileadmin/test.pdf|p:id=export&r=1|u:www.example.com" AS _pdf 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_ppdf:
Column: _Pdf | _File | _Zip
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Detailed explanation: download_
A limited set of attributes is supported: ::
10.sql = SELECT "[options]" AS _Pdf, "[options]" AS _File, "[options]" AS _Zip
with: [options] = [<exportFilename>]|[<text>]|[<1: urlparam|file>]|[<2: urlparam|file>]| ... |[<n: urlparam|file>]
* Parameter are position dependent and therefore without a qualifier!
* `<urlparam>` or `<file>` might be given.
* If there is more than one `<urlparam|file>`, only `_Pdf` or `_Zip` is possible.
* Example: ::
SELECT "||fileadmin/test.pdf" AS _File, "||fileadmin/test.pdf" AS _Pdf, "||fileadmin/test.pdf" AS _Zip
SELECT "output.pdf|Download PDF|fileadmin/test.pdf" AS _File, "output.pdf|Download PDF|fileadmin/test.pdf" AS _Pdf, "output.zip|Download ZIP|fileadmin/test.pdf" AS _Zip
SELECT "complete.pdf|Download PDF|fileadmin/test1.pdf|fileadmin/test2.pdf|id=export&r=1" AS _Pdf
.. _column-save-pdf: .. _column-save-pdf:
Column: _savePdf Column: _savePdf
......
...@@ -475,7 +475,17 @@ class Link { ...@@ -475,7 +475,17 @@ class Link {
$regular = array(); $regular = array();
foreach ($param as $value) { foreach ($param as $value) {
if ($value == '') {
continue;
}
$key = substr($value, 0, 2); $key = substr($value, 0, 2);
if (strlen($key) == 1) {
$key .= ':';
}
if ($key == TOKEN_DOWNLOAD . ':') { if ($key == TOKEN_DOWNLOAD . ':') {
$prio[] = $value; $prio[] = $value;
} else { } else {
...@@ -589,6 +599,11 @@ class Link { ...@@ -589,6 +599,11 @@ class Link {
$vars = $this->buildCopyToClipboardLate($vars); $vars = $this->buildCopyToClipboardLate($vars);
} }
// Check for special default setting.
if ($vars[NAME_SIP] === false) {
$vars[NAME_SIP] = "0";
}
// Final Checks // Final Checks
$this->checkParam($rcTokenGiven, $vars); $this->checkParam($rcTokenGiven, $vars);
...@@ -626,7 +641,7 @@ class Link { ...@@ -626,7 +641,7 @@ class Link {
NAME_RENDER => '0', NAME_RENDER => '0',
NAME_RIGHT => 'l', NAME_RIGHT => 'l',
NAME_SIP => '0', NAME_SIP => false,
NAME_ENCRYPTION => '0', NAME_ENCRYPTION => '0',
NAME_DELETE => '', NAME_DELETE => '',
...@@ -1378,7 +1393,7 @@ EOF; ...@@ -1378,7 +1393,7 @@ EOF;
} }
// No download link! Only text/button // No download link! Only text/button
if($vars[NAME_RENDER]=='3'){ if ($vars[NAME_RENDER] == '3') {
return $vars; return $vars;
} }
...@@ -1404,6 +1419,11 @@ EOF; ...@@ -1404,6 +1419,11 @@ EOF;
$vars[NAME_EXTRA_CONTENT_WRAP] = '<span ' . $attributes . $onClick . '>'; $vars[NAME_EXTRA_CONTENT_WRAP] = '<span ' . $attributes . $onClick . '>';
$vars[NAME_BOOTSTRAP_BUTTON] = '0'; $vars[NAME_BOOTSTRAP_BUTTON] = '0';
// Download links should be by default SIP encoded.
if (($vars[NAME_SIP])===false) {
$vars[NAME_SIP] = "1";
}
return $vars; return $vars;
} }
......
...@@ -1260,7 +1260,7 @@ class Report { ...@@ -1260,7 +1260,7 @@ class Report {
/** /**
* Renders _download: extract token and determine if any default value has to be applied * Renders _download: extract token and determine if any default value has to be applied
* [d:<exportFilename][U:<params>][u:<url>][f:file][t:<text>][a:<message>]|[o:<tooltip>]|[c:<class>]|[r:<render * [d:<exportFilename][U:<params>][u:<url>][F:file][t:<text>][a:<message>]|[o:<tooltip>]|[c:<class>]|[r:<render
* mode>] * mode>]
* *
* @param string $columnName * @param string $columnName
...@@ -1327,7 +1327,8 @@ class Report { ...@@ -1327,7 +1327,8 @@ class Report {
if ($defaultDownload !== '') { if ($defaultDownload !== '') {
// Action 'Download' needs to be specified at the beginning // Action 'Download' needs to be specified at the beginning
$columnValue = $defaultDownload . "|" . $columnValue; // $columnValue = $defaultDownload . "|" . $columnValue;
$columnValue .= $defaultDownload . "|" ;
} }
if ($defaultMode !== '') { if ($defaultMode !== '') {
......
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