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

Fixes #7849. New option 'fileTrash' and 'fileTrashText'.

parent af5e6844
Pipeline #2327 passed with stages
in 2 minutes and 53 seconds
......@@ -2998,6 +2998,8 @@ See also at specific *FormElement* definitions.
| accept, | | |
| maxFileSize, | | |
| fileDestination, | | |
| fileTrash, | | |
| fileTrashText, | | |
| fileReplace, | | |
| autoOrient, | | |
| autoOrientCmd, | | |
......@@ -3826,6 +3828,11 @@ See also `downloadButton`_ to offer a download of an uploaded file.
* *maxFileSize* = `<size>` - max filesize in bytes (no unit), kilobytes (k/K) or megabytes (m/M) for an uploaded file.
If empty or not given, take value from Form, System or System default.
* *fileTrash* = [0|1] - Default: '1'. This option en-/disables the trash button right beside the file chooser. By default
the trash is visible. The trash is only visible if a) there is already a file uploaded or b) a new file has been chosen.
* *fileTrashText* = `<string>` - Default: ''. Will be shown right beside the trash glyph-icon.
* *fileDestination* = `<pathFileName>` - Destination where to copy the file. A good practice is to specify a relative `fileDestination` -
such an installation (filesystem and database) are moveable.
......
......@@ -3129,7 +3129,10 @@ abstract class AbstractBuildForm {
$disabled = ($formElement[FE_MODE] == FE_MODE_READONLY) ? 'disabled' : '';
$deleteButton = Support::wrapTag("<button type='button' class='btn btn-default delete-file $disabled' $disabled data-sip='$sipUpload' name='delete-$htmlFormElementName'>", $this->symbol[SYMBOL_DELETE]);
if (!empty($formElement[FE_FILE_TRASH_TEXT])) {
$formElement[FE_FILE_TRASH_TEXT] = ' ' . $formElement[FE_FILE_TRASH_TEXT];
}
$deleteButton = Support::wrapTag("<button type='button' class='btn btn-default delete-file $disabled' $disabled data-sip='$sipUpload' name='delete-$htmlFormElementName'>", $this->symbol[SYMBOL_DELETE] . $formElement[FE_FILE_TRASH_TEXT]);
if (Support::isEnabled($formElement, FE_FILE_DOWNLOAD_BUTTON)) {
if (is_readable($value)) {
......@@ -3147,7 +3150,11 @@ abstract class AbstractBuildForm {
}
$htmlFilename = Support::wrapTag("<span class='uploaded-file-name'>", $value, false);
$htmlTextDelete = Support::wrapTag("<div class='uploaded-file $textDeleteClass'>", $htmlFilename . ' ' . $deleteButton);
if (($formElement[FE_FILE_TRASH] ?? '1') == '1') {
$htmlTextDelete = Support::wrapTag("<div class='uploaded-file $textDeleteClass'>", $htmlFilename . ' ' . $deleteButton);
} else {
$htmlTextDelete = $htmlFilename;
}
// <button type="button" class="file-delete" data-sip="571d1fc9e6974"><span class="glyphicon glyphicon-trash"></span></button>
$formElement = HelperFormElement::prepareExtraButton($formElement, false);
......
......@@ -1119,6 +1119,8 @@ const FE_FILE_CHMOD_FILE = 'chmodFile';
const FE_FILE_CHMOD_DIR = 'chmodDir';
const FE_TRIM = 'trim'; // 'none' | list of characters
const FE_TRIM_NONE = 'none';
const FE_FILE_TRASH = 'fileTrash';
const FE_FILE_TRASH_TEXT = 'fileTrashText';
// Excel Import
const FE_IMPORT_TO_TABLE = 'importToTable';
......
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