Commit 1acfa298 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3460 / Report: new column types '_striptags, '_htmlentities', '_+Tag'

Manual.rst: describe new special column names.
Report.php: implement new column types.
parent 56254432
......@@ -3975,26 +3975,34 @@ Special column names
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Reserved column name | Purpose |
+========================+=============================================================================================================================================================================================+
|_link |Easily create links with different features. |
| _link |Easily create links with different features. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_mailto |Quickly create email links. A click on the link will open the default mailer. The address is encrypted via JS against email bots. |
| _mailto |Quickly create email links. A click on the link will open the default mailer. The address is encrypted via JS against email bots. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_pageX or _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.|
| _pageX or _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.|
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_pdf, _file, _zip |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 to one PDF file. |
|_Pdf, _File, _Zip | |
| _pdf, _file, _zip |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 to one PDF file. |
| _Pdf, _File, _Zip | |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_sendmail |Send emails. |
| _sendmail |Send emails. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_exec |Run batch files or executables on the webserver. |
| _exec |Run batch files or executables on the webserver. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_vertical |Render Text vertically. This is useful for tables with limited column width. |
| _vertical |Render Text vertically. This is useful for tables with limited column width. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_img |Display images. |
| _img |Display images. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_bullet |Display a blue/gray/green/pink/red/yellow bullet. If none color specified, show nothing |
| _bullet |Display a blue/gray/green/pink/red/yellow bullet. If none color specified, show nothing. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_check |Display a blue/gray/green/pink/red/yellow checked sign. If none color specified, show nothing |
| _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. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _+??? |The content will be wrapped in the tag '???'. Example: SELECT 'example' AS '_+a href="http://example.com"' creates '<a href="http://example.com">example</a>' |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|_<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. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
......
......@@ -998,6 +998,12 @@ const COLUMN_PDF = "pdf";
const COLUMN_FILE = "file";
const COLUMN_ZIP = "zip";
const COLUMN_NL2BR = "nl2br";
const COLUMN_HTMLENTITIES = "htmlentities";
const COLUMN_STRIPTAGS = "striptags";
const COLUMN_WRAP_TOKEN = '+';
const FORM_NAME_FORM = 'form';
const FORM_NAME_FORM_ELEMENT = 'formElement';
......
......@@ -642,6 +642,19 @@ class Report {
$content .= $this->link->renderLink($linkValue);
break;
case COLUMN_NL2BR:
$content .= nl2br($columnValue);
break;
case COLUMN_HTMLENTITIES:
$content .= htmlentities($columnValue);
break;
case COLUMN_STRIPTAGS:
$content .= strip_tags($columnValue);
break;
case "bullet":
if ($columnValue === '') {
break;
......@@ -778,8 +791,16 @@ class Report {
default :
if ($flagControl) {
// Columnnames starting with '+' will wrap the content. EG "SELECT 'apple' AS '+h1 class=best'" >> <h1 class=best>apple</h1>
if (isset($columnName[0]) && $columnName[0] == COLUMN_WRAP_TOKEN && isset($columnName[1])) {
$content = Support::wrapTag('<' . substr($columnName, 1) . '>', $columnValue);
break;
}
$flagOutput = false;
} else {
// No special Columnname: just add the column value.
$content .= $columnValue;
}
break;
......
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