Commit 2cfc2b4c authored by Carsten  Rose's avatar Carsten Rose
Browse files

Feature 5423: two new column names 'filesize', 'mimetype'

parent 7f6ce338
......@@ -5127,6 +5127,10 @@ Special column names
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _htmlentities |Characters will be encoded to their HTML entity representation. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _mimetype |Show mime type of a given file |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _filesize |Show file size of a given file |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _thumbnail |Create thumbnails on the fly. See `column-thumbnail`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _+??? |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>' |
......
......@@ -244,7 +244,7 @@ const ERROR_MISSING_TYPE_AHEAD_SQL_PREFETCH = 1604;
const ERROR_DOWNLOAD_CREATE_NEW_FILE = 1700;
const ERROR_DOWNLOAD_NO_FILES = 1701;
const ERROR_DOWNLOAD_NOTHING_TO_DO = 1702;
const ERROR_DOWNLOAD_UNEXPECTED_MIMETYPE = 1703;
const ERROR_DOWNLOAD_UNEXPECTED_MIME_TYPE = 1703;
const ERROR_DOWNLOAD_UNEXPECTED_NUMBER_OF_SOURCES = 1704;
// KeyValueParser
......@@ -1245,6 +1245,9 @@ const COLUMN_NL2BR = 'nl2br';
const COLUMN_HTMLENTITIES = 'htmlentities';
const COLUMN_STRIPTAGS = 'striptags';
const COLUMN_MIME_TYPE = 'mimetype';
const COLUMN_FILE_SIZE = 'filesize';
const COLUMN_WRAP_TOKEN = '+';
const FORM_NAME_FORM = 'form';
......
......@@ -110,7 +110,7 @@ class Download {
foreach ($files AS $filename) {
$mimetype = mime_content_type($filename);
if ($mimetype != 'application/pdf') {
throw new downloadException("Error concat file $filename. Mimetype 'application/pdf' expected, got: $mimetype", ERROR_DOWNLOAD_UNEXPECTED_MIMETYPE);
throw new downloadException("Error concat file $filename. Mimetype 'application/pdf' expected, got: $mimetype", ERROR_DOWNLOAD_UNEXPECTED_MIME_TYPE);
}
}
......
......@@ -725,6 +725,14 @@ class Report {
$content .= $this->thumbnail->process($columnValue);
break;
case COLUMN_MIME_TYPE:
$content .= HelperFile::getMimeType($columnValue);
break;
case COLUMN_FILE_SIZE:
$content .= filesize($columnValue);
break;
case COLUMN_NL2BR:
$content .= nl2br($columnValue);
break;
......
Markdown is supported
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