Commit d957a3e5 authored by Jan Helke's avatar Jan Helke Committed by Frank Nägler
Browse files

[TASK] Add menu item to clear the clipboard

The make the clipboard more usable, this patch added another menu
item to clear the clipboard. Additionally the label and message
to delete elements is now more precise.
That duplicates the function of the red button with the X, but it
seems that this function was not clear for anyone.

Resolves: #18507
Releases: master
Change-Id: I6b06c6e6f1e45c61476c37b92fd52e1e7a9eae5d
Reviewed-on: https://review.typo3.org/44392

Reviewed-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Tested-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
parent 18b1c60e
......@@ -251,8 +251,6 @@ class Clipboard
{
$out = array();
$elementCount = count($this->elFromTable($this->fileMode ? '_FILE' : ''));
// Button/menu header:
$removeAllUrl = GeneralUtility::linkThisScript(array('CB' => array('removeAll' => $this->current)));
// Copymode Selector menu
$copymodeUrl = GeneralUtility::linkThisScript();
$moveLabel = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_misc.xlf:moveElements'));
......@@ -271,23 +269,24 @@ class Clipboard
</div>
';
// Selector menu + clear button
$optionArray = array();
// Import / Export link:
if ($elementCount && ExtensionManagementUtility::isLoaded('impexp')) {
$url = BackendUtility::getModuleUrl('xMOD_tximpexp', $this->exportClipElementParameters());
$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars(('window.location.href=' . GeneralUtility::quoteJSvalue($url) . ';')) . '">' . $this->clLabel('export', 'rm') . '</a></li>';
}
// Edit:
if (!$this->fileMode && $elementCount) {
$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars(('window.location.href=' . GeneralUtility::quoteJSvalue($this->editUrl() . '&returnUrl=') . '+top.rawurlencode(window.location.href);')) . '">' . $this->clLabel('edit', 'rm') . '</a></li>';
}
$deleteLink = '';
$menuSelector = '';
if ($elementCount) {
// Delete:
$deleteLink = '<a class="btn btn-danger" href="' . htmlspecialchars($removeAllUrl) . '#clip_head" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:buttons.clear', true) . '">' . $this->iconFactory->getIcon('actions-document-close', Icon::SIZE_SMALL)->render(SvgIconProvider::MARKUP_IDENTIFIER_INLINE) . '</a>';
$removeAllUrl = GeneralUtility::linkThisScript(array('CB' => array('removeAll' => $this->current)));
// Selector menu + clear button
$optionArray = array();
// Import / Export link:
if (ExtensionManagementUtility::isLoaded('impexp')) {
$url = BackendUtility::getModuleUrl('xMOD_tximpexp', $this->exportClipElementParameters());
$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars(('window.location.href=' . GeneralUtility::quoteJSvalue($url) . ';')) . '">' . $this->clLabel('export', 'rm') . '</a></li>';
}
// Edit:
if (!$this->fileMode) {
$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars(('window.location.href=' . GeneralUtility::quoteJSvalue($this->editUrl() . '&returnUrl=') . '+top.rawurlencode(window.location.href);')) . '">' . $this->clLabel('edit', 'rm') . '</a></li>';
}
// Delete referenced elements:
if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
$js = '
if (confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.deleteClip'), $elementCount)) . ')){
......@@ -297,7 +296,11 @@ class Clipboard
} else {
$js = ' window.location.href=' . GeneralUtility::quoteJSvalue($this->deleteUrl(0, ($this->fileMode ? 1 : 0)) . '&redirect=') . '+top.rawurlencode(window.location.href); ';
}
$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars($js) . '">' . $this->clLabel('delete', 'rm') . '</a></li>';
$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars($js) . '">' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.clipboard.delete_elements', true) . '</a></li>';
// Clear clipboard
$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue($removeAllUrl . '#clip_head')) . '">' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.clipboard.clear_clipboard', true) . '</a></li>';
$deleteLink = '<a class="btn btn-danger" href="' . htmlspecialchars($removeAllUrl) . '#clip_head" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:buttons.clear', true) . '">' . $this->iconFactory->getIcon('actions-document-close', Icon::SIZE_SMALL)->render(SvgIconProvider::MARKUP_IDENTIFIER_INLINE) . '</a>';
// menuSelector
$menuSelector = '
......
......@@ -301,6 +301,12 @@ Do you want to continue WITHOUT saving?</source>
<trans-unit id="labels.cliptabs-description">
<source>This clipboard allows to select and edit/copy/move multiple records at once. Choose it to show a checkbox by each record.</source>
</trans-unit>
<trans-unit id="labels.clipboard.delete_elements">
<source>Delete elements</source>
</trans-unit>
<trans-unit id="labels.clipboard.clear_clipboard">
<source>Clear clipboard</source>
</trans-unit>
<trans-unit id="labels.removeItem">
<source>Remove item</source>
</trans-unit>
......@@ -665,7 +671,7 @@ Do you want to continue WITHOUT saving?</source>
<source>Are you sure you want to delete "%s"?</source>
</trans-unit>
<trans-unit id="mess.deleteClip">
<source>Are you sure you want to delete ALL selected elements (%s) on the clipboard?</source>
<source>Are you sure you want to delete ALL referenced elements (%s) on the clipboard?</source>
</trans-unit>
<trans-unit id="mess.refresh_login" xml:space="preserve">
<source>Your login has probably expired.
......
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