Commit 20ade491 authored by Benni Mack's avatar Benni Mack
Browse files

[TASK] Streamline File List and Clipboard Selection Options

This change moves the "Display Thumbnails" selection above the
File List table, which then unifies this selection with the File Selector
(IRRE File Selection).

In addition, the only leftover option (Show clipboard) is now also
a switch checkbox, and also applied in the view for the RecordList.

All docheader buttons in the File Listing now show the appropriate
text to make it easier to understand what the user clicks.

Resolves: #94517
Releases: master
Change-Id: I4ef02ba4aba008ae86b7452695a5590f2846a296
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69770


Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent f30b32cd
......@@ -26,7 +26,3 @@ div.typo3-localizationLink,
div.typo3-synchronizationLink {
display: inline;
}
div.typo3-listOptions {
margin: 0 0 24px;
}
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Filelist\Configuration;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\SingletonInterface;
/**
* @internal this is a concrete TYPO3 implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
*/
class ThumbnailConfiguration implements SingletonInterface
{
/**
* @var int
*/
protected $width = 64;
/**
* @var int
*/
protected $height = 64;
public function __construct()
{
$userTsConfig = $this->getBackendUser()->getTSConfig();
$this->width = (int)($userTsConfig['options.']['file_list.']['thumbnail.']['width'] ?? 64);
$this->height = (int)($userTsConfig['options.']['file_list.']['thumbnail.']['height'] ?? 64);
}
/**
* @return int
*/
public function getWidth(): int
{
return $this->width;
}
/**
* @return int
*/
public function getHeight(): int
{
return $this->height;
}
/**
* @return BackendUserAuthentication
*/
protected function getBackendUser()
{
return $GLOBALS['BE_USER'];
}
}
......@@ -435,31 +435,29 @@ class FileListController implements LoggerAwareInterface
$addParams .= '&pointer=' . $this->pointer;
}
$this->view->assign('checkboxes', [
'displayThumbs' => [
'enabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] === 'selectable',
'label' => htmlspecialchars($lang->sL('LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:displayThumbs')),
'html' => BackendUtility::getFuncCheck(
$this->id,
'SET[displayThumbs]',
$this->MOD_SETTINGS['displayThumbs'] ?? '',
'',
$addParams,
'id="checkDisplayThumbs"'
),
],
'enableClipBoard' => [
'enabled' => $userTsConfig['options.']['file_list.']['enableClipBoard'] === 'selectable',
'label' => htmlspecialchars($lang->sL('LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:clipBoard')),
'html' => BackendUtility::getFuncCheck(
$this->id,
'SET[clipBoard]',
$this->MOD_SETTINGS['clipBoard'] ?? '',
'',
$addParams,
'id="checkClipBoard"'
),
]
$this->view->assign('displayThumbs', [
'enabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] === 'selectable',
'label' => htmlspecialchars($lang->sL('LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:displayThumbs')),
'html' => BackendUtility::getFuncCheck(
$this->id,
'SET[displayThumbs]',
$this->MOD_SETTINGS['displayThumbs'] ?? '',
'',
$addParams,
'id="checkDisplayThumbs"'
)
]);
$this->view->assign('enableClipBoard', [
'enabled' => $userTsConfig['options.']['file_list.']['enableClipBoard'] === 'selectable',
'label' => htmlspecialchars($lang->sL('LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:clipBoard')),
'html' => BackendUtility::getFuncCheck(
$this->id,
'SET[clipBoard]',
$this->MOD_SETTINGS['clipBoard'] ?? '',
'',
$addParams,
'id="checkClipBoard"'
),
]);
}
......@@ -495,6 +493,7 @@ class FileListController implements LoggerAwareInterface
['id' => $parentFolder->getCombinedIdentifier()]
)
)
->setShowLabelText(true)
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.upOneLevel'))
->setIcon($this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL));
$buttonBar->addButton($levelUpButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
......@@ -530,9 +529,10 @@ class FileListController implements LoggerAwareInterface
]
))
->setClasses('t3js-drag-uploader-trigger')
->setShowLabelText(true)
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.upload'))
->setIcon($this->iconFactory->getIcon('actions-edit-upload', Icon::SIZE_SMALL));
$buttonBar->addButton($uploadButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
$buttonBar->addButton($uploadButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
}
// New folder button
......@@ -550,9 +550,10 @@ class FileListController implements LoggerAwareInterface
'returnUrl' => $this->filelist->listURL(),
]
))
->setShowLabelText(true)
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.new'))
->setIcon($this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL));
$buttonBar->addButton($newButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
$buttonBar->addButton($newButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
}
// Add paste button if clipboard is initialized
......@@ -585,9 +586,10 @@ class FileListController implements LoggerAwareInterface
'bs-content' => $confirmText,
'title' => $pastButtonTitle
])
->setShowLabelText(true)
->setTitle($pastButtonTitle)
->setIcon($this->iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL));
$buttonBar->addButton($pasteButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
$buttonBar->addButton($pasteButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
}
}
}
......
......@@ -41,7 +41,6 @@ use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Filelist\Configuration\ThumbnailConfiguration;
/**
* Class for rendering of File>Filelist (basically used in FileListController)
......@@ -170,11 +169,6 @@ class FileList
*/
protected $id = 0;
/**
* @var ThumbnailConfiguration
*/
protected $thumbnailConfiguration;
/**
* @var UriBuilder
*/
......@@ -188,7 +182,6 @@ class FileList
$this->fixedL = max($this->fixedL, $this->getBackendUser()->uc['titleLen'] ?? 1);
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$this->translateTools = GeneralUtility::makeInstance(TranslationConfigurationProvider::class);
$this->thumbnailConfiguration = GeneralUtility::makeInstance(ThumbnailConfiguration::class);
$this->iLimit = MathUtility::forceIntegerInRange(
$this->getBackendUser()->getTSConfig()['options.']['file_list.']['filesPerPage'] ?? $this->iLimit,
1
......@@ -373,7 +366,7 @@ class FileList
}
return '
<div class="mb-4 mt-4">
<div class="mb-4 mt-2">
<div class="table-fit mb-0">
<table class="table table-striped table-hover" id="typo3-filelist">
<thead>' . $this->addElement('', $theData, 'th') . '</thead>
......@@ -820,8 +813,8 @@ class FileList
$processedFile = $fileObject->process(
ProcessedFile::CONTEXT_IMAGEPREVIEW,
[
'width' => $this->thumbnailConfiguration->getWidth(),
'height' => $this->thumbnailConfiguration->getHeight(),
'width' => (int)($this->getBackendUser()->getTSConfig()['options.']['file_list.']['thumbnail.']['width'] ?? 64),
'height' => (int)($this->getBackendUser()->getTSConfig()['options.']['file_list.']['thumbnail.']['height'] ?? 64),
]
);
$theData[$field] .= '<br /><img src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($processedFile->getPublicUrl() ?? '')) . '" ' .
......
<!--
Listing options for extended view, clipboard and thumbnails
-->
<div class="typo3-listOptions">
<f:if condition="{checkboxes.displayThumbs.enabled}">
<div class="form-check">
{checkboxes.displayThumbs.html -> f:format.raw()}
<label for="checkDisplayThumbs" class="form-check-label">
{checkboxes.displayThumbs.label}
</label>
</div>
</f:if>
<f:if condition="{checkboxes.enableClipBoard.enabled}">
<div class="form-check">
{checkboxes.enableClipBoard.html -> f:format.raw()}
<label for="checkClipBoard" class="form-check-label">
{checkboxes.enableClipBoard.label}
</label>
</div>
</f:if>
</div>
......@@ -29,7 +29,7 @@
<f:section name="content">
<form method="post" name="fileListForm">
<div class="row mb-4">
<div class="row">
<div class="col-6">
<div class="input-group">
<input type="hidden" name="pointer" value="0" />
......@@ -43,13 +43,35 @@
</div>
</div>
</div>
<div class="row justify-content-end">
<f:if condition="{listHtml} && {displayThumbs.enabled}">
<div class="col-6">
<div class="float-end">
<div class="form-check form-switch">
{displayThumbs.html -> f:format.raw()}
<label for="checkDisplayThumbs" class="form-check-label">
{displayThumbs.label}
</label>
</div>
</div>
</div>
</f:if>
</div>
{listHtml -> f:format.raw()}
<input type="hidden" name="cmd"/>
</form>
<f:if condition="{listHtml}">
<f:render partial="ListOptions" arguments="{checkboxes:checkboxes}" />
<div class="mb-3">
<f:if condition="{enableClipBoard.enabled}">
<div class="form-check form-switch">
{enableClipBoard.html -> f:format.raw()}
<label for="checkClipBoard" class="form-check-label">
{enableClipBoard.label}
</label>
</div>
</f:if>
</div>
<f:if condition="{clipBoardHtml}">
{clipBoardHtml -> f:format.raw()}
<f:be.buttons.csh table="xMOD_csh_corebe" field="filelist_clipboard" wrap="<span class='btn btn-sm btn-default'>|</span>" />
......
......@@ -318,20 +318,16 @@ class RecordListController
$body .= '<div class="row">' . $beforeOutput . '</div>';
}
$body .= $output;
// If a listing was produced, create the page footer with search form etc:
// If a listing was produced, create the page footer
if ($tableOutput) {
// Adding checkbox options for extended listing and clipboard display:
// Adding checkbox option for clipboard display
$body .= '
<!--
Listing options for extended view and clipboard view
-->
<div class="typo3-listOptions">
<div class="mb-3">
<form action="" method="post">';
// Add "clipboard" checkbox:
if ($this->modTSconfig['enableClipBoard'] === 'selectable') {
$body .= '<div class="form-check">' .
$body .= '<div class="form-check form-switch">' .
BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', ($MOD_SETTINGS['clipBoard'] ?? ''), '', $table ? '&table=' . $table : '', 'id="checkShowClipBoard"') .
'<label class="form-check-label" for="checkShowClipBoard">' .
BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', htmlspecialchars($lang->getLL('showClipBoard'))) .
......
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