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

F4901: implement 'fileSplitOptions'

parent 0bf1ef67
Pipeline #1042 passed with stage
in 1 minute and 46 seconds
...@@ -3641,6 +3641,11 @@ file per PDF page. The split is done via http://www.cityinthesky.co.uk/opensourc ...@@ -3641,6 +3641,11 @@ file per PDF page. The split is done via http://www.cityinthesky.co.uk/opensourc
* *FormElement.parameter*: * *FormElement.parameter*:
* *fileSplit* = `<type>` - Activate the splitting process. Possible values: `svg` or `jpeg`. No default. * *fileSplit* = `<type>` - Activate the splitting process. Possible values: `svg` or `jpeg`. No default.
* *fileSplitOptions* = `<command line options>`.
* [svg] - no default
* [jpeg] - default: `-density 150 -quality 90`
* *fileDestinationSplit* = `<pathFileName (pattern)>` - Target directory and filename pattern for the created & * *fileDestinationSplit* = `<pathFileName (pattern)>` - Target directory and filename pattern for the created &
split'ed files. Default <fileDestination>.split/split.<nr>.<fileSplit> split'ed files. Default <fileDestination>.split/split.<nr>.<fileSplit>
If explicit given, respect that SVG needs a printf style for <nr>, whereas JPEG is numbered automatically. E.g. :: If explicit given, respect that SVG needs a printf style for <nr>, whereas JPEG is numbered automatically. E.g. ::
...@@ -3650,6 +3655,7 @@ file per PDF page. The split is done via http://www.cityinthesky.co.uk/opensourc ...@@ -3650,6 +3655,7 @@ file per PDF page. The split is done via http://www.cityinthesky.co.uk/opensourc
* *tableNameSplit* = `<tablename>` - Default: name of table of current form. This name will be saved in table `Split` * *tableNameSplit* = `<tablename>` - Default: name of table of current form. This name will be saved in table `Split`
The splitting happens immediately after the user pressed `save`. The splitting happens immediately after the user pressed `save`.
To easily access the split files via QFQ, per file one record is created in table 'Split'. To easily access the split files via QFQ, per file one record is created in table 'Split'.
...@@ -5280,24 +5286,31 @@ Special column names ...@@ -5280,24 +5286,31 @@ Special column names
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Reserved column name | Purpose | | Reserved column name | Purpose |
+========================+=============================================================================================================================================================================================+ +========================+=============================================================================================================================================================================================+
| _link |Easily create links with different features. | | _link | `column-link`_ - Build 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. | | _pageX or _PageX | `column_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.| | _download | `download`_ - single file (any type) or concatenate multiple files (PDF, 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 | `column_pdf`_ - 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 |
| _Pdf, _File, _Zip | | | _Pdf, _File, _Zip | to one PDF file. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _savePdf | `savePdf`_ - pre render PDF files |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _excel | `excel-export`_ - creates Excel exports based on QFQ Report queries, optional with pre uploaded Excel template files |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _yank | `copyToClipboard`_. Shortcut version of the link interface | | _yank | `copyToClipboard`_. Shortcut version of the link interface |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _sendmail |Send emails. | | _mailto | `column_mailto`_ - Build email links. A click on the link will open the default mailer. The address is encrypted via JS against email bots. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _sendmail | `sendmail`_ - Send emails. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _exec |Run batch files or executables on the webserver. | | _exec | `exec`_ - Run batch files or executables on the webserver. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _vertical |Render Text vertically. This is useful for tables with limited column width. | | _vertical | `vertical`_ - Render Text vertically. This is useful for tables with limited column width. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _img |Display images. | | _img | `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. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
...@@ -5313,9 +5326,9 @@ Special column names ...@@ -5313,9 +5326,9 @@ Special column names
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _mimeType |Show mime type of a given file | | _mimeType |Show mime type of a given file |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _thumbnail |Create thumbnails on the fly. See `column-thumbnail`_. | | _thumbnail | `thumbnail`_ - Create thumbnails on the fly. See `column-thumbnail`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _monitor |Constantly display a file. See `column-monitor`_. | | _monitor | `column-monitor`_ - Constantly display a file. See `column-monitor`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _XLS |Used for Excel export. Append a `newline` character at the end of the string. Token must be part of string. See `excel-export`_. | | _XLS |Used for Excel export. Append a `newline` character at the end of the string. Token must be part of string. See `excel-export`_. |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
......
...@@ -983,6 +983,8 @@ const FE_FILE_CAPTURE = 'capture'; // On a smartphone opens the camera ...@@ -983,6 +983,8 @@ const FE_FILE_CAPTURE = 'capture'; // On a smartphone opens the camera
const FE_FILE_SPLIT = 'fileSplit'; const FE_FILE_SPLIT = 'fileSplit';
const FE_FILE_SPLIT_SVG = 'svg'; const FE_FILE_SPLIT_SVG = 'svg';
const FE_FILE_SPLIT_JPEG = 'jpeg'; const FE_FILE_SPLIT_JPEG = 'jpeg';
const FE_FILE_SPLIT_OPTIONS = 'fileSplitOptions';
const FE_FILE_SPLIT_OPTIONS_JPEG = '-density 150 -quality 90';
const FE_FILE_SPLIT_TABLE_NAME = 'tableNameSplit'; const FE_FILE_SPLIT_TABLE_NAME = 'tableNameSplit';
const FE_FILE_DOWNLOAD_BUTTON = 'downloadButton'; const FE_FILE_DOWNLOAD_BUTTON = 'downloadButton';
const FE_FILE_AUTO_ORIENT = 'autoOrient'; const FE_FILE_AUTO_ORIENT = 'autoOrient';
......
...@@ -95,7 +95,7 @@ class Delete { ...@@ -95,7 +95,7 @@ class Delete {
/** /**
* Iterates over array $row and searches for column names with substring COLUMN_PATH_FILE_NAME. * Iterates over array $row and searches for column names with substring COLUMN_PATH_FILE_NAME.
* For any found, check if it references a writable file. * For any column found, check if it references a writable file.
* If yes: check if there are other records (same table, same column) which references the same file. * If yes: check if there are other records (same table, same column) which references the same file.
* If no: delete the file * If no: delete the file
* If yes: do nothing, continue with the next column. * If yes: do nothing, continue with the next column.
...@@ -112,6 +112,7 @@ class Delete { ...@@ -112,6 +112,7 @@ class Delete {
private function deleteReferencedFiles(array $row, $tableName, $primaryKey) { private function deleteReferencedFiles(array $row, $tableName, $primaryKey) {
foreach ($row AS $key => $file) { foreach ($row AS $key => $file) {
if (false === strpos($key, COLUMN_PATH_FILE_NAME)) { if (false === strpos($key, COLUMN_PATH_FILE_NAME)) {
continue; continue;
} }
......
...@@ -804,7 +804,7 @@ class Save { ...@@ -804,7 +804,7 @@ class Save {
/** /**
* If fe['autoOrient'] is given and the MimeType corresponds to fe['autoOrientMimeType']: the given {{pathFileName:V}} will be converted. * If fe['autoOrient'] is given and the MimeType corresponds to fe['autoOrientMimeType']: the given {{pathFileName:V}} will be converted.
* ImageMagick 'convert' seems to do a better job than GraficsMagick (Orientation is stable even if multiple applied). * ImageMagick 'convert' seems to do a better job than GraficsMagick (Orientation is stable even if multiple times applied).
* *
* @param array $formElement * @param array $formElement
* @param $pathFileName * @param $pathFileName
...@@ -862,6 +862,7 @@ class Save { ...@@ -862,6 +862,7 @@ class Save {
$fileDestinationSplit = $this->evaluate->parse($formElement[FE_FILE_DESTINATION_SPLIT]); $fileDestinationSplit = $this->evaluate->parse($formElement[FE_FILE_DESTINATION_SPLIT]);
$fileSplitType = $this->evaluate->parse($formElement[FE_FILE_SPLIT]); $fileSplitType = $this->evaluate->parse($formElement[FE_FILE_SPLIT]);
$fileSplitTypeOptions = $this->evaluate->parse($formElement[FE_FILE_SPLIT_OPTIONS]);
$fileSplitTableName = $this->evaluate->parse($formElement[FE_FILE_SPLIT_TABLE_NAME]); $fileSplitTableName = $this->evaluate->parse($formElement[FE_FILE_SPLIT_TABLE_NAME]);
if (empty($fileSplitTableName)) { if (empty($fileSplitTableName)) {
...@@ -899,7 +900,10 @@ class Save { ...@@ -899,7 +900,10 @@ class Save {
$cmd = 'pdf2svg "' . $newSrc . '" "' . $fileNameDest . '" all'; $cmd = 'pdf2svg "' . $newSrc . '" "' . $fileNameDest . '" all';
break; break;
case FE_FILE_SPLIT_JPEG: case FE_FILE_SPLIT_JPEG:
$cmd = 'convert -quality 90 -density 150 "' . $newSrc . '" "' . $fileNameDest . '"'; if ($fileSplitTypeOptions == '') {
$fileSplitTypeOptions = FE_FILE_SPLIT_OPTIONS_JPEG;
}
$cmd = "convert $fileSplitTypeOptions '$newSrc' '$fileNameDest'";
break; break;
default: default:
throw new UserFormException("Unknown 'fileSplit' type: " . $formElement[FE_FILE_SPLIT], ERROR_UNKNOWN_TOKEN); throw new UserFormException("Unknown 'fileSplit' type: " . $formElement[FE_FILE_SPLIT], ERROR_UNKNOWN_TOKEN);
......
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