Project

General

Profile

Feature #84250 ยป typo3-cms-separately-enable-disable-add-media-by-url-and-select-upload-files.patch

Lorenz Ulrich, 2020-01-28 17:41

View differences:

typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php
* Wraps a text with an anchor and returns the HTML representation.
*
* @param string $text The text to be wrapped by an anchor
* @param string $link The link to be used in the anchor
* @param string $link The link to be used in the anchor
* @param array $attributes Array of attributes to be used in the anchor
* @return string The wrapped text as HTML representation
*/
......
$nameObject = $currentStructureDomObjectIdPrefix;
$mode = 'db';
$showUpload = false;
$showByUrl = false;
$elementBrowserEnabled = true;
if (!empty($inlineConfiguration['appearance']['createNewRelationLinkTitle'])) {
$createNewRelationText = htmlspecialchars($languageService->sL($inlineConfiguration['appearance']['createNewRelationLinkTitle']));
......
}
if ($mode === 'file') {
$showUpload = true;
$showByUrl = true;
}
if (isset($inlineConfiguration['appearance']['fileUploadAllowed'])) {
$showUpload = (bool)$inlineConfiguration['appearance']['fileUploadAllowed'];
}
if (isset($inlineConfiguration['appearance']['fileByUrlAllowed'])) {
$showByUrl = (bool)$inlineConfiguration['appearance']['fileByUrlAllowed'];
}
if (isset($groupFieldConfiguration['appearance']['elementBrowserAllowed'])) {
$allowed = $groupFieldConfiguration['appearance']['elementBrowserAllowed'];
}
......
if (!empty($allowedArray)) {
$onlineMediaAllowed = array_intersect($allowedArray, $onlineMediaAllowed);
}
if ($showUpload && $isDirectFileUploadEnabled) {
if (($showUpload || $showByUrl) && $isDirectFileUploadEnabled) {
$folder = $backendUser->getDefaultUploadFolder(
$this->data['parentPageRow']['uid'],
$this->data['tableName'],
......
$folder instanceof Folder
&& $folder->getStorage()->checkUserActionPermission('add', 'File')
) {
$maxFileSize = GeneralUtility::getMaxUploadFileSize() * 1024;
$item .= ' <a href="#" class="btn btn-default t3js-drag-uploader inlineNewFileUploadButton ' . $this->inlineData['config'][$nameObject]['md5'] . '"
' . $buttonStyle . '
data-dropzone-target="#' . htmlspecialchars(StringUtility::escapeCssSelector($currentStructureDomObjectIdPrefix)) . '"
data-insert-dropzone-before="1"
data-file-irre-object="' . htmlspecialchars($objectPrefix) . '"
data-file-allowed="' . htmlspecialchars($allowed) . '"
data-target-folder="' . htmlspecialchars($folder->getCombinedIdentifier()) . '"
data-max-file-size="' . htmlspecialchars($maxFileSize) . '"
>';
$item .= $this->iconFactory->getIcon('actions-upload', Icon::SIZE_SMALL)->render() . ' ';
$item .= htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_upload.select-and-submit'));
$item .= '</a>';
$this->requireJsModules[] = ['TYPO3/CMS/Backend/DragUploader' => 'function(dragUploader){dragUploader.initialize()}'];
if (!empty($onlineMediaAllowed)) {
if ($showUpload) {
$maxFileSize = GeneralUtility::getMaxUploadFileSize() * 1024;
$item .= ' <a href="#" class="btn btn-default t3js-drag-uploader inlineNewFileUploadButton ' . $this->inlineData['config'][$nameObject]['md5'] . '"
' . $buttonStyle . '
data-dropzone-target="#' . htmlspecialchars(StringUtility::escapeCssSelector($currentStructureDomObjectIdPrefix)) . '"
data-insert-dropzone-before="1"
data-file-irre-object="' . htmlspecialchars($objectPrefix) . '"
data-file-allowed="' . htmlspecialchars($allowed) . '"
data-target-folder="' . htmlspecialchars($folder->getCombinedIdentifier()) . '"
data-max-file-size="' . htmlspecialchars($maxFileSize) . '"
>';
$item .= $this->iconFactory->getIcon('actions-upload', Icon::SIZE_SMALL)->render() . ' ';
$item .= htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_upload.select-and-submit'));
$item .= '</a>';
$this->requireJsModules[] = ['TYPO3/CMS/Backend/DragUploader' => 'function(dragUploader){dragUploader.initialize()}'];
}
if (!empty($onlineMediaAllowed) && $showByUrl) {
$buttonStyle = '';
if (isset($inlineConfiguration['inline']['inlineOnlineMediaAddButtonStyle'])) {
$buttonStyle = ' style="' . $inlineConfiguration['inline']['inlineOnlineMediaAddButtonStyle'] . '"';
    (1-1/1)