Commit 8b9c30b6 authored by Markus Guenther's avatar Markus Guenther Committed by Frank Nägler
Browse files

[TASK] Replace sprite icon for visibility with IconFactory

Replaces all IconUtility::getSpriteIcon calls for the icon
actions-edit-hide and actions-edit-unhide with the new IconFactory.

Change-Id: If3deb6fb4c6f867c21aaff34796515d933fa90c3
Resolves: #68925
Releases: master
Reviewed-on: http://review.typo3.org/42499

Reviewed-by: default avatarDaniel Goerz <ervaude@gmail.com>
Tested-by: default avatarDaniel Goerz <ervaude@gmail.com>
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 3194169a
...@@ -830,7 +830,7 @@ class ClickMenu { ...@@ -830,7 +830,7 @@ class ClickMenu {
if ($table === 'pages') { if ($table === 'pages') {
$editOnClick .= 'top.nav.refresh.defer(500, top.nav);'; $editOnClick .= 'top.nav.refresh.defer(500, top.nav);';
} }
return $this->linkItem($title, IconUtility::getSpriteIcon('actions-edit-' . ($rec[$flagField] ? 'un' : '') . 'hide'), $editOnClick . 'return false;', 1); return $this->linkItem($title, $this->iconFactory->getIcon('actions-edit-' . ($rec[$flagField] ? 'un' : '') . 'hide', Icon::SIZE_SMALL), $editOnClick . 'return false;', 1);
} }
/*************************************** /***************************************
......
...@@ -568,15 +568,20 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -568,15 +568,20 @@ class InlineRecordContainer extends AbstractContainer {
$hiddenField = $tcaTableCtrl['enablecolumns']['disabled']; $hiddenField = $tcaTableCtrl['enablecolumns']['disabled'];
if ($enabledControls['hide'] && $permsEdit && $hiddenField && $tcaTableCols[$hiddenField] && (!$tcaTableCols[$hiddenField]['exclude'] || $backendUser->check('non_exclude_fields', $foreign_table . ':' . $hiddenField))) { if ($enabledControls['hide'] && $permsEdit && $hiddenField && $tcaTableCols[$hiddenField] && (!$tcaTableCols[$hiddenField]['exclude'] || $backendUser->check('non_exclude_fields', $foreign_table . ':' . $hiddenField))) {
$onClick = 'return inline.enableDisableRecord(' . GeneralUtility::quoteJSvalue($nameObjectFtId) . ')'; $onClick = 'return inline.enableDisableRecord(' . GeneralUtility::quoteJSvalue($nameObjectFtId) . ')';
$className = 't3js-' . $nameObjectFtId . '_disabled';
if ($rec[$hiddenField]) { if ($rec[$hiddenField]) {
$title = $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')), TRUE);
$cells['hide.unhide'] = ' $cells['hide.unhide'] = '
<a class="btn btn-default hiddenHandle" href="#" onclick="' . htmlspecialchars($onClick) . '"> <a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
' . IconUtility::getSpriteIcon('actions-edit-unhide', array('title' => $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')), TRUE), 'id' => ($nameObjectFtId . '_disabled'))) . ' . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL) . '
</a>'; </a>';
} else { } else {
$title = $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : '')), TRUE);
$cells['hide.hide'] = ' $cells['hide.hide'] = '
<a class="btn btn-default hiddenHandle" href="#" onclick="' . htmlspecialchars($onClick) . '"> <a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
' . IconUtility::getSpriteIcon('actions-edit-hide', array('title' => $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : '')), TRUE), 'id' => ($nameObjectFtId . '_disabled'))) . ' . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . '
</a>'; </a>';
} }
} }
......
...@@ -38,10 +38,9 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi ...@@ -38,10 +38,9 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi
$(document).on('click', '.t3js-record-hide', function(evt) { $(document).on('click', '.t3js-record-hide', function(evt) {
evt.preventDefault(); evt.preventDefault();
var $anchorElement = $(this); var $anchorElement = $(this);
var $iconElement = $anchorElement.find('span'); var $iconElement = $anchorElement.find('i');
var $rowElement = $anchorElement.closest('tr[data-uid]'); var $rowElement = $anchorElement.closest('tr[data-uid]');
var params = $anchorElement.data('params'); var params = $anchorElement.data('params');
var removeClass = $anchorElement.data('state') === 'visible' ? 'fa-toggle-on' : 'fa-toggle-off'; var removeClass = $anchorElement.data('state') === 'visible' ? 'fa-toggle-on' : 'fa-toggle-off';
// add a spinner // add a spinner
...@@ -112,7 +111,7 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi ...@@ -112,7 +111,7 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi
} }
$anchorElement.data('state', nextState).data('params', nextParams); $anchorElement.data('state', nextState).data('params', nextParams);
var $iconElement = $anchorElement.find('span'); var $iconElement = $anchorElement.find('i');
$iconElement.addClass(className); $iconElement.addClass(className);
var $icon = $rowElement.find('td.col-icon span.t3-icon'); var $icon = $rowElement.find('td.col-icon span.t3-icon');
......
...@@ -909,14 +909,13 @@ var inline = { ...@@ -909,14 +909,13 @@ var inline = {
} }
}, },
enableDisableRecord: function (objectId) { enableDisableRecord: function (objectIdentifier) {
var elName = this.parseObjectId('full', objectId, 2, 0, true) + '[hidden]'; var elName = this.parseObjectId('full', objectIdentifier, 2, 0, true) + '[hidden]';
var formObj = document.getElementsByName(elName + '_0'); var formObj = document.getElementsByName(elName + '_0');
var valueObj = document.getElementsByName(elName); var valueObj = document.getElementsByName(elName);
var escapedObjectId = this.escapeObjectId(objectId); var escapedObjectIdentifier = this.escapeObjectId(objectIdentifier);
var $icon = TYPO3.jQuery('#' + escapedObjectId + '_disabled'); var $container = TYPO3.jQuery('#' + escapedObjectIdentifier + '_div');
var $icon = $container.find('.t3js-' + escapedObjectIdentifier + '_disabled i');
var $container = TYPO3.jQuery('#' + escapedObjectId + '_div');
// It might be the case that there's no hidden field // It might be the case that there's no hidden field
if (formObj.length && valueObj.length) { if (formObj.length && valueObj.length) {
......
...@@ -153,6 +153,12 @@ ...@@ -153,6 +153,12 @@
<trans-unit id="online"> <trans-unit id="online">
<source>online</source> <source>online</source>
</trans-unit> </trans-unit>
<trans-unit id="visibility.hide">
<source>hide</source>
</trans-unit>
<trans-unit id="visibility.unhide">
<source>unhide</source>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
<f:else> <f:else>
<f:if condition="{backendUser.isDisabled} == 1"> <f:if condition="{backendUser.isDisabled} == 1">
<f:then> <f:then>
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{backendUser.uid}][disable]=0', redirectUrl: redirectUrl)}"><be:spriteManagerIcon iconName="actions-edit-unhide" options="{title: 'unhide'}" /></a> <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{backendUser.uid}][disable]=0', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.unhide')}"><core:icon identifier="actions-edit-unhide" size="small"/></a>
</f:then> </f:then>
<f:else> <f:else>
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{backendUser.uid}][disable]=1', redirectUrl: redirectUrl)}"><be:spriteManagerIcon iconName="actions-edit-hide" options="{title: 'hide'}" /></a> <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{backendUser.uid}][disable]=1', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.hide')}"><core:icon identifier="actions-edit-hide" size="small"/></a>
</f:else> </f:else>
</f:if> </f:if>
</f:else> </f:else>
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
<a class="btn btn-default" href="{bu:editRecord(parameters: 'edit[be_groups][{backendUserGroup.uid}]=edit&returnUrl={returnUrl}')}"><be:spriteManagerIcon iconName="actions-document-open" /></a> <a class="btn btn-default" href="{bu:editRecord(parameters: 'edit[be_groups][{backendUserGroup.uid}]=edit&returnUrl={returnUrl}')}"><be:spriteManagerIcon iconName="actions-document-open" /></a>
<f:if condition="{backendUserGroup.hidden}"> <f:if condition="{backendUserGroup.hidden}">
<f:then> <f:then>
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=0', redirectUrl: redirectUrl)}"><be:spriteManagerIcon iconName="actions-edit-unhide" options="{title: 'unhide'}" /></a> <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=0', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.unhide')}"><core:icon identifier="actions-edit-unhide" size="small"/></a>
</f:then> </f:then>
<f:else> <f:else>
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=1', redirectUrl: redirectUrl)}"><be:spriteManagerIcon iconName="actions-edit-hide" options="{title: 'hide'}" /></a> <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=1', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.hide')}"><core:icon identifier="actions-edit-hide" size="small"/></a>
</f:else> </f:else>
</f:if> </f:if>
</div> </div>
......
{namespace be = TYPO3\CMS\Backend\ViewHelpers} {namespace be = TYPO3\CMS\Backend\ViewHelpers}
{namespace bu = TYPO3\CMS\Beuser\ViewHelpers} {namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
{namespace core = TYPO3\CMS\Core\ViewHelpers}
<f:layout name="Default" /> <f:layout name="Default" />
...@@ -66,13 +67,13 @@ ...@@ -66,13 +67,13 @@
<td> <td>
<f:if condition="{compareUser.isDisabled} == 1"> <f:if condition="{compareUser.isDisabled} == 1">
<f:then> <f:then>
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=0', redirectUrl: redirectUrl)}"> <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=0', redirectUrl: redirectUrl)}" title="{f:translate(key: 'visibility.unhide')}">
<be:spriteManagerIcon iconName="actions-edit-unhide" options="{title: 'unhide'}" /> <core:icon identifier="actions-edit-unhide" size="small"/>
</a> </a>
</f:then> </f:then>
<f:else> <f:else>
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=1', redirectUrl: redirectUrl)}"> <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=1', redirectUrl: redirectUrl)}" title="{f:translate(key: 'visibility.hide')}">
<be:spriteManagerIcon iconName="actions-edit-hide" options="{title: 'hide'}" /> <core:icon identifier="actions-edit-hide" size="small"/>
</a> </a>
</f:else> </f:else>
</f:if> </f:if>
......
...@@ -196,6 +196,12 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface { ...@@ -196,6 +196,12 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
'name' => 'quote-right', 'name' => 'quote-right',
) )
), ),
'actions-edit-hide' => array(
'provider' => FontawesomeIconProvider::class,
'options' => array(
'name' => 'toggle-on',
)
),
'actions-edit-replace' => array( 'actions-edit-replace' => array(
'provider' => FontawesomeIconProvider::class, 'provider' => FontawesomeIconProvider::class,
'options' => array( 'options' => array(
...@@ -208,6 +214,12 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface { ...@@ -208,6 +214,12 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
'name' => 'undo', 'name' => 'undo',
) )
), ),
'actions-edit-unhide' => array(
'provider' => FontawesomeIconProvider::class,
'options' => array(
'name' => 'toggle-off',
)
),
'actions-edit-upload' => array( 'actions-edit-upload' => array(
'provider' => FontawesomeIconProvider::class, 'provider' => FontawesomeIconProvider::class,
'options' => array( 'options' => array(
......
...@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; ...@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility; use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Backend\FrontendBackendUserAuthentication; use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
use TYPO3\CMS\Core\Database\DatabaseConnection; use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation; use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\MathUtility;
...@@ -55,6 +56,11 @@ class FrontendEditPanel { ...@@ -55,6 +56,11 @@ class FrontendEditPanel {
*/ */
protected $backendUser; protected $backendUser;
/**
* @var \TYPO3\CMS\Core\Imaging\IconFactory
*/
protected $iconFactory;
/** /**
* Constructor for the edit panel * Constructor for the edit panel
* *
...@@ -68,6 +74,7 @@ class FrontendEditPanel { ...@@ -68,6 +74,7 @@ class FrontendEditPanel {
$this->backendUser = $backendUser ?: $GLOBALS['BE_USER']; $this->backendUser = $backendUser ?: $GLOBALS['BE_USER'];
$this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
$this->cObj->start(array()); $this->cObj->start(array());
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
} }
/** /**
...@@ -116,10 +123,10 @@ class FrontendEditPanel { ...@@ -116,10 +123,10 @@ class FrontendEditPanel {
// Hiding for localizations because it is unknown what should be the function in that case // Hiding for localizations because it is unknown what should be the function in that case
if (isset($allow['hide']) && $hideField && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) { if (isset($allow['hide']) && $hideField && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
if ($dataArr[$hideField]) { if ($dataArr[$hideField]) {
$icon = IconUtility::getSpriteIcon('actions-edit-unhide', array('title' => $this->backendUser->extGetLL('p_unhide'))); $icon = $this->iconFactory->getIcon('actions-edit-unhide');
$panel .= $this->editPanelLinkWrap($icon, $formName, 'unhide'); $panel .= $this->editPanelLinkWrap($icon, $formName, 'unhide');
} else { } else {
$icon = IconUtility::getSpriteIcon('actions-edit-hide', array('title' => $this->backendUser->extGetLL('p_hide'))); $icon = $this->iconFactory->getIcon('actions-edit-hide');
$panel .= $this->editPanelLinkWrap($icon, $formName, 'hide', '', $this->backendUser->extGetLL('p_hideConfirm')); $panel .= $this->editPanelLinkWrap($icon, $formName, 'hide', '', $this->backendUser->extGetLL('p_hideConfirm'));
} }
} }
......
...@@ -1349,13 +1349,13 @@ class DatabaseRecordList extends AbstractDatabaseRecordList { ...@@ -1349,13 +1349,13 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
$hideAction = '<a class="btn btn-default t3js-record-hide" data-state="hidden" href="#"' $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="hidden" href="#"'
. ' data-params="' . htmlspecialchars($params) . '"' . ' data-params="' . htmlspecialchars($params) . '"'
. ' title="' . $this->getLanguageService()->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . ' title="' . $this->getLanguageService()->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">'
. IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>'; . $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL) . '</a>';
} else { } else {
$params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1'; $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
$hideAction = '<a class="btn btn-default t3js-record-hide" data-state="visible" href="#"' $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="visible" href="#"'
. ' data-params="' . htmlspecialchars($params) . '"' . ' data-params="' . htmlspecialchars($params) . '"'
. ' title="' . $this->getLanguageService()->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . ' title="' . $this->getLanguageService()->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">'
. IconUtility::getSpriteIcon('actions-edit-hide') . '</a>'; . $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . '</a>';
} }
} }
$this->addActionToCellGroup($cells, $hideAction, 'hide'); $this->addActionToCellGroup($cells, $hideAction, 'hide');
......
...@@ -958,13 +958,15 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas ...@@ -958,13 +958,15 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
IconUtility::getSpriteIcon('actions-document-open') . '</a>'; IconUtility::getSpriteIcon('actions-document-open') . '</a>';
if ((int)$schedulerRecord['disable'] === 1) { if ((int)$schedulerRecord['disable'] === 1) {
$translationKey = 'enable'; $translationKey = 'enable';
$spriteIcon = 'actions-edit-unhide'; $icon = $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL);
} else { } else {
$translationKey = 'disable'; $translationKey = 'disable';
$spriteIcon = 'actions-edit-hide'; $icon = $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL);
} }
$toggleHiddenAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&CMD=toggleHidden&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:' . $translationKey, TRUE) . '" class="icon">' . $toggleHiddenAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri
IconUtility::getSpriteIcon($spriteIcon) . '</a>'; . '&CMD=toggleHidden&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" title="'
. $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:' . $translationKey, TRUE)
. '" class="icon">' . $icon . '</a>';
$deleteAction = '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->moduleUri . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" ' $deleteAction = '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->moduleUri . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" '
. ' data-severity="warning"' . ' data-severity="warning"'
. ' data-title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '"' . ' data-title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '"'
......
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