[TASK] Replace sprite icon for visibility with IconFactory 99/42499/7
authorMarkus Guenther <mail@markus-guenther.de>
Tue, 11 Aug 2015 08:29:55 +0000 (10:29 +0200)
committerFrank Nägler <frank.naegler@typo3.org>
Wed, 2 Sep 2015 20:22:38 +0000 (22:22 +0200)
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: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
12 files changed:
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js
typo3/sysext/beuser/Resources/Private/Language/locallang.xlf
typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html
typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/IndexListRow.html
typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
typo3/sysext/core/Classes/Imaging/IconRegistry.php
typo3/sysext/feedit/Classes/FrontendEditPanel.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php

index 876db34..8643fb8 100644 (file)
@@ -830,7 +830,7 @@ class ClickMenu {
                if ($table === 'pages') {
                        $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);
        }
 
        /***************************************
index 18b612d..158d91c 100644 (file)
@@ -568,15 +568,20 @@ class InlineRecordContainer extends AbstractContainer {
                        $hiddenField = $tcaTableCtrl['enablecolumns']['disabled'];
                        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) . ')';
+                               $className = 't3js-' . $nameObjectFtId . '_disabled';
                                if ($rec[$hiddenField]) {
+                                       $title = $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')), TRUE);
                                        $cells['hide.unhide'] = '
-                                               <a class="btn btn-default hiddenHandle" href="#" onclick="' . htmlspecialchars($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'))) . '
+                                               <a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
+                                                       . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
+                                                       $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL) . '
                                                </a>';
                                } else {
+                                       $title = $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : '')), TRUE);
                                        $cells['hide.hide'] = '
-                                               <a class="btn btn-default hiddenHandle" href="#" onclick="' . htmlspecialchars($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'))) . '
+                                               <a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
+                                                       . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
+                                                       $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . '
                                                </a>';
                                }
                        }
index d3fd9cc..e837709 100644 (file)
@@ -38,10 +38,9 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi
                $(document).on('click', '.t3js-record-hide', function(evt) {
                        evt.preventDefault();
                        var $anchorElement   = $(this);
-                       var $iconElement     = $anchorElement.find('span');
+                       var $iconElement     = $anchorElement.find('i');
                        var $rowElement      = $anchorElement.closest('tr[data-uid]');
                        var params           = $anchorElement.data('params');
-
                        var removeClass      = $anchorElement.data('state') === 'visible' ? 'fa-toggle-on' : 'fa-toggle-off';
 
                        // add a spinner
@@ -112,7 +111,7 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi
                }
                $anchorElement.data('state', nextState).data('params', nextParams);
 
-               var $iconElement = $anchorElement.find('span');
+               var $iconElement = $anchorElement.find('i');
                $iconElement.addClass(className);
 
                var $icon = $rowElement.find('td.col-icon span.t3-icon');
index 89ed858..96c470a 100644 (file)
@@ -909,14 +909,13 @@ var inline = {
                }
        },
 
-       enableDisableRecord: function (objectId) {
-               var elName = this.parseObjectId('full', objectId, 2, 0, true) + '[hidden]';
+       enableDisableRecord: function (objectIdentifier) {
+               var elName = this.parseObjectId('full', objectIdentifier, 2, 0, true) + '[hidden]';
                var formObj = document.getElementsByName(elName + '_0');
                var valueObj = document.getElementsByName(elName);
-               var escapedObjectId = this.escapeObjectId(objectId);
-               var $icon = TYPO3.jQuery('#' + escapedObjectId + '_disabled');
-
-               var $container = TYPO3.jQuery('#' + escapedObjectId + '_div');
+               var escapedObjectIdentifier = this.escapeObjectId(objectIdentifier);
+               var $container = TYPO3.jQuery('#' + escapedObjectIdentifier + '_div');
+               var $icon = $container.find('.t3js-' + escapedObjectIdentifier + '_disabled i');
 
                // It might be the case that there's no hidden field
                if (formObj.length && valueObj.length) {
index 842cfbe..a63ca2b 100644 (file)
                        <trans-unit id="online">
                                <source>online</source>
                        </trans-unit>
+                       <trans-unit id="visibility.hide">
+                               <source>hide</source>
+                       </trans-unit>
+                       <trans-unit id="visibility.unhide">
+                               <source>unhide</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
index 1c688b8..48c3fd7 100644 (file)
                                <f:else>
                                        <f:if condition="{backendUser.isDisabled} == 1">
                                                <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: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:if>
                                </f:else>
index abe3e10..2954228 100644 (file)
                        <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: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: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:if>
                </div>
index f340568..4da4a4f 100644 (file)
@@ -1,5 +1,6 @@
 {namespace be = TYPO3\CMS\Backend\ViewHelpers}
 {namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
+{namespace core = TYPO3\CMS\Core\ViewHelpers}
 
 <f:layout name="Default" />
 
                                                <td>
                                                        <f:if condition="{compareUser.isDisabled} == 1">
                                                                <f:then>
-                                                                       <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=0', redirectUrl: redirectUrl)}">
-                                                                               <be:spriteManagerIcon iconName="actions-edit-unhide" options="{title: 'unhide'}" />
+                                                                       <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=0', redirectUrl: redirectUrl)}" title="{f:translate(key: 'visibility.unhide')}">
+                                                                               <core:icon identifier="actions-edit-unhide" size="small"/>
                                                                        </a>
                                                                </f:then>
                                                                <f:else>
-                                                                       <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=1', redirectUrl: redirectUrl)}">
-                                                                               <be:spriteManagerIcon iconName="actions-edit-hide" options="{title: 'hide'}" />
+                                                                       <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=1', redirectUrl: redirectUrl)}" title="{f:translate(key: 'visibility.hide')}">
+                                                                               <core:icon identifier="actions-edit-hide" size="small"/>
                                                                        </a>
                                                                </f:else>
                                                        </f:if>
index 2e31c1c..d547958 100644 (file)
@@ -196,6 +196,12 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
                                'name' => 'quote-right',
                        )
                ),
+               'actions-edit-hide' => array(
+                       'provider' => FontawesomeIconProvider::class,
+                       'options' => array(
+                               'name' => 'toggle-on',
+                       )
+               ),
                'actions-edit-replace' => array(
                        'provider' => FontawesomeIconProvider::class,
                        'options' => array(
@@ -208,6 +214,12 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
                                'name' => 'undo',
                        )
                ),
+               'actions-edit-unhide' => array(
+                       'provider' => FontawesomeIconProvider::class,
+                       'options' => array(
+                               'name' => 'toggle-off',
+                       )
+               ),
                'actions-edit-upload' => array(
                        'provider' => FontawesomeIconProvider::class,
                        'options' => array(
index 3ee431c..3f6b022 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
@@ -56,6 +57,11 @@ class FrontendEditPanel {
        protected $backendUser;
 
        /**
+        * @var \TYPO3\CMS\Core\Imaging\IconFactory
+        */
+       protected $iconFactory;
+
+       /**
         * Constructor for the edit panel
         *
         * @param DatabaseConnection $databaseConnection
@@ -68,6 +74,7 @@ class FrontendEditPanel {
                $this->backendUser = $backendUser ?: $GLOBALS['BE_USER'];
                $this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
                $this->cObj->start(array());
+               $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
        }
 
        /**
@@ -116,10 +123,10 @@ class FrontendEditPanel {
                // 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 ($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');
                        } 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'));
                        }
                }
index 7274dae..874a3c9 100644 (file)
@@ -1349,13 +1349,13 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                                                $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="hidden" href="#"'
                                                                          . ' data-params="' . htmlspecialchars($params) . '"'
                                                                          . ' 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 {
                                                $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
                                                $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="visible" href="#"'
                                                                          . ' data-params="' . htmlspecialchars($params) . '"'
                                                                          . ' 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');
index e855f28..b6010f5 100644 (file)
@@ -958,13 +958,15 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                                IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                                        if ((int)$schedulerRecord['disable'] === 1) {
                                                $translationKey = 'enable';
-                                               $spriteIcon = 'actions-edit-unhide';
+                                               $icon = $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL);
                                        } else {
                                                $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">' .
-                                               IconUtility::getSpriteIcon($spriteIcon) . '</a>';
+                                       $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">' . $icon . '</a>';
                                        $deleteAction = '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->moduleUri . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" '
                                                . ' data-severity="warning"'
                                                . ' data-title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '"'