[TASK] Replace sprite icons with the new IconFactory 45/42445/6
authorMarkus Guenther <mail@markus-guenther.de>
Sun, 9 Aug 2015 08:38:49 +0000 (10:38 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 10 Aug 2015 14:57:29 +0000 (16:57 +0200)
Replaces all IconUtility::getSpriteIcon calls for the icon
actions-edit-copy, actions-edit-cut, actions-edit-cut-release and
actions-edit-copy-release with the new IconFactory.

Change-Id: I446feb7b736761ee7e7d52001fe8dc238bd56e6c
Resolves: #68878
Releases: master
Reviewed-on: http://review.typo3.org/42445
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Classes/Imaging/IconRegistry.php
typo3/sysext/filelist/Classes/FileList.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index f120a1e..3201b68 100644 (file)
@@ -105,6 +105,30 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
                                'name' => 'desktop',
                        )
                ),
+               'actions-edit-copy' => array(
+                       'provider' => FontawesomeIconProvider::class,
+                       'options' => array(
+                               'name' => 'copy',
+                       )
+               ),
+               'actions-edit-copy-release' => array(
+                       'provider' => FontawesomeIconProvider::class,
+                       'options' => array(
+                               'name' => 'copy text-danger',
+                       )
+               ),
+               'actions-edit-cut' => array(
+                       'provider' => FontawesomeIconProvider::class,
+                       'options' => array(
+                               'name' => 'scissors',
+                       )
+               ),
+               'actions-edit-cut-release' => array(
+                       'provider' => FontawesomeIconProvider::class,
+                       'options' => array(
+                               'name' => 'scissors text-danger',
+                       )
+               ),
 
                // OVERLAYS
                'overlay-read-only' => array(
index 3a636a9..aeed317 100644 (file)
@@ -182,7 +182,7 @@ class FileList extends AbstractRecordList {
        protected $iconFactory;
 
        /**
-        * Constructor
+        * Construct
         */
        public function __construct() {
                $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
@@ -830,12 +830,23 @@ class FileList extends AbstractRecordList {
                $fullName = $fileOrFolderObject->getName();
                $md5 = GeneralUtility::shortmd5($fullIdentifier);
                // For normal clipboard, add copy/cut buttons:
-               if ($this->clipObj->current == 'normal') {
+               if ($this->clipObj->current === 'normal') {
                        $isSel = $this->clipObj->isSelected('_FILE', $md5);
-                       $cells[] = '<a class="btn btn-default"" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, ($isSel == 'copy'))) . '">' . IconUtility::getSpriteIcon(('actions-edit-copy' . ($isSel == 'copy' ? '-release' : '')), array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE))) . '</a>';
+                       $copyTitle = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE);
+                       $cutTitle = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE);
+                       $copyIcon = $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL);
+                       $cutIcon = $this->iconFactory->getIcon('actions-edit-cut', Icon::SIZE_SMALL);
+
+                       if ($isSel === 'copy') {
+                               $copyIcon = $this->iconFactory->getIcon('actions-edit-copy-release', Icon::SIZE_SMALL);
+                       } elseif ($isSel === 'cut') {
+                               $cutIcon = $this->iconFactory->getIcon('actions-edit-cut-release', Icon::SIZE_SMALL);
+                       }
+
+                       $cells[] = '<a class="btn btn-default"" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, ($isSel === 'copy'))) . '" title="' . $copyTitle . '">' . $copyIcon . '</a>';
                        // we can only cut if file can be moved
                        if ($fileOrFolderObject->checkActionPermission('move')) {
-                               $cells[] = '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, ($isSel == 'cut'))) . '">' . IconUtility::getSpriteIcon(('actions-edit-cut' . ($isSel == 'cut' ? '-release' : '')), array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE))) . '</a>';
+                               $cells[] = '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, ($isSel === 'cut'))) . '" title="' . $cutTitle . '">' . $cutIcon . '</a>';
                        } else {
                                $cells[] = $this->spaceIcon;
                        }
index 6b59dbe..1e6a86e 100644 (file)
@@ -1510,22 +1510,31 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                // Return blank, if disabled:
                // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
                // For the "Normal" pad:
-               if ($this->clipObj->current == 'normal') {
+               if ($this->clipObj->current === 'normal') {
                        // Show copy/cut icons:
                        $isSel = (string)$this->clipObj->isSelected($table, $row['uid']);
                        if ($isL10nOverlay || !$this->overlayEditLockPermissions($table, $row)) {
                                $cells['copy'] = $this->spaceIcon;
                                $cells['cut'] = $this->spaceIcon;
                        } else {
+                               $copyIcon = $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL);
+                               $cutIcon = $this->iconFactory->getIcon('actions-edit-cut', Icon::SIZE_SMALL);
+
+                               if ($isSel === 'copy') {
+                                       $copyIcon = $this->iconFactory->getIcon('actions-edit-copy-release', Icon::SIZE_SMALL);
+                               } elseif ($isSel === 'cut') {
+                                       $cutIcon = $this->iconFactory->getIcon('actions-edit-cut-release', Icon::SIZE_SMALL);
+                               }
+
                                $cells['copy'] = '<a class="btn btn-default" href="#" onclick="'
-                                       . htmlspecialchars('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 1, ($isSel == 'copy'), array('returnUrl' => '')) . '\');')
+                                       . htmlspecialchars('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 1, ($isSel === 'copy'), array('returnUrl' => '')) . '\');')
                                        . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE) . '">'
-                                       . (!$isSel == 'copy' ? IconUtility::getSpriteIcon('actions-edit-copy') : IconUtility::getSpriteIcon('actions-edit-copy-release')) . '</a>';
+                                       . $copyIcon . '</a>';
                                if (TRUE) {
                                        $cells['cut'] = '<a class="btn btn-default" href="#" onclick="'
-                                               . htmlspecialchars('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 0, ($isSel == 'cut'), array('returnUrl' => '')) . '\');')
+                                               . htmlspecialchars('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 0, ($isSel === 'cut'), array('returnUrl' => '')) . '\');')
                                                . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE) . '">'
-                                               . (!$isSel == 'cut' ? IconUtility::getSpriteIcon('actions-edit-cut') : IconUtility::getSpriteIcon('actions-edit-cut-release')) . '</a>';
+                                               . $cutIcon . '</a>';
                                } else {
                                        $cells['cut'] = $this->spaceIcon;
                                }