Commit 237523a0 authored by Stephan Großberndt's avatar Stephan Großberndt Committed by Christian Kuhn
Browse files

[TASK] Replace IconUtility with IconFactory for TCA records

Implement replacement and replace all core usages of
IconUtility::getSpriteIconForRecord() with
IconFactory->getIconForRecord().

Register and fix several icon definitions for core tables.

Resolves: #69754
Releases: master
Change-Id: I5adf4f58a0331c77458049e19c7c8ca441b9e4cf
Reviewed-on: http://review.typo3.org/43272


Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 11079fe0
...@@ -186,7 +186,7 @@ module.exports = function(grunt) { ...@@ -186,7 +186,7 @@ module.exports = function(grunt) {
files: { files: {
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-compressed.svg': '<%= paths.icons %>Mimetype/mimetypes-compressed.svg', '<%= paths.backend %>Public/Icons/Mimetype/mimetypes-compressed.svg': '<%= paths.icons %>Mimetype/mimetypes-compressed.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-excel.svg': '<%= paths.icons %>Mimetype/mimetypes-excel.svg', '<%= paths.backend %>Public/Icons/Mimetype/mimetypes-excel.svg': '<%= paths.icons %>Mimetype/mimetypes-excel.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-executable-executable.svg': '<%= paths.icons %>Mimetype/mimetypes-executable-executable.svg', '<%= paths.backend %>Public/Icons/Mimetype/mimetypes-application.svg': '<%= paths.icons %>Mimetype/mimetypes-application.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-audio.svg': '<%= paths.icons %>Mimetype/mimetypes-media-audio.svg', '<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-audio.svg': '<%= paths.icons %>Mimetype/mimetypes-media-audio.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-flash.svg': '<%= paths.icons %>Mimetype/mimetypes-media-flash.svg', '<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-flash.svg': '<%= paths.icons %>Mimetype/mimetypes-media-flash.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-image.svg': '<%= paths.icons %>Mimetype/mimetypes-media-image.svg', '<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-image.svg': '<%= paths.icons %>Mimetype/mimetypes-media-image.svg',
......
...@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Backend\Backend\Avatar; ...@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Backend\Backend\Avatar;
*/ */
use TYPO3\CMS\Backend\Utility\IconUtility; use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Service\DependencyOrderingService; use TYPO3\CMS\Core\Service\DependencyOrderingService;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
...@@ -53,7 +55,8 @@ class Avatar { ...@@ -53,7 +55,8 @@ class Avatar {
// Icon // Icon
$icon = ''; $icon = '';
if ($showIcon) { if ($showIcon) {
$icon = '<span class="avatar-icon">' . IconUtility::getSpriteIconForRecord('be_users', $backendUser) . '</span>'; $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon = '<span class="avatar-icon">' . $iconFactory->getIconForRecord('be_users', $backendUser, Icon::SIZE_SMALL)->render() . '</span>';
} }
$image = $this->getImgTag($backendUser, $size); $image = $this->getImgTag($backendUser, $size);
......
...@@ -182,7 +182,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface { ...@@ -182,7 +182,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
// No shortcuts added yet, show a small help message how to add shortcuts // No shortcuts added yet, show a small help message how to add shortcuts
$title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE); $title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
$icon = '<span title="' . $title . '">' . $this->iconFactory->getIcon('actions-system-shortcut-new', Icon::SIZE_SMALL)->render() . '</span>'; $icon = '<span title="' . $title . '">' . $this->iconFactory->getIcon('actions-system-shortcut-new', Icon::SIZE_SMALL)->render() . '</span>';
$label = str_replace('%icon%', $icon, $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:bookmarkDescription')); $label = str_replace('%icon%', $icon, $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:bookmarkDescription', TRUE));
$compiledShortcutMenu = '<p>' . $label . '</p>'; $compiledShortcutMenu = '<p>' . $label . '</p>';
} else { } else {
$compiledShortcutMenu = implode(LF, $shortcutMenu); $compiledShortcutMenu = implode(LF, $shortcutMenu);
...@@ -756,9 +756,9 @@ class ShortcutToolbarItem implements ToolbarItemInterface { ...@@ -756,9 +756,9 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
); );
$result = $databaseConnection->exec_SELECT_queryArray($sqlQueryParts); $result = $databaseConnection->exec_SELECT_queryArray($sqlQueryParts);
$row = $databaseConnection->sql_fetch_assoc($result); $row = $databaseConnection->sql_fetch_assoc($result);
$icon = IconUtility::getSpriteIconForRecord($table, (array)$row, array('title' => $titleAttribute)); $icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, (array)$row, Icon::SIZE_SMALL)->render() . '</span>';
} elseif ($shortcut['type'] == 'new') { } elseif ($shortcut['type'] == 'new') {
$icon = IconUtility::getSpriteIconForRecord($table, array(), array('title' => $titleAttribute)); $icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . '</span>';
} }
break; break;
case 'file_edit': case 'file_edit':
......
...@@ -392,8 +392,9 @@ class ClickMenu { ...@@ -392,8 +392,9 @@ class ClickMenu {
if (!is_array($this->rec)) { if (!is_array($this->rec)) {
$this->rec = array(); $this->rec = array();
} }
// Return the printed elements: // Return the printed elements:
return $this->printItems($menuItems, $root ? $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($this->rec, $table)))) . BackendUtility::getRecordTitle($table, $this->rec, TRUE)); return $this->printItems($menuItems);
} }
/** /**
...@@ -453,7 +454,7 @@ class ClickMenu { ...@@ -453,7 +454,7 @@ class ClickMenu {
if (!is_array($menuItems)) { if (!is_array($menuItems)) {
$menuItems = array(); $menuItems = array();
} }
return $this->printItems($menuItems, $root ? $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($this->rec, $table)))) . BackendUtility::getRecordTitle($table, $this->rec, TRUE)); return $this->printItems($menuItems);
} }
/** /**
...@@ -1017,7 +1018,7 @@ class ClickMenu { ...@@ -1017,7 +1018,7 @@ class ClickMenu {
// Processing by external functions? // Processing by external functions?
$menuItems = $this->externalProcessingOfFileMenuItems($menuItems); $menuItems = $this->externalProcessingOfFileMenuItems($menuItems);
// Return the printed elements: // Return the printed elements:
return $this->printItems($menuItems, $icon . $fileObject->getName()); return $this->printItems($menuItems);
} }
/** /**
...@@ -1190,7 +1191,7 @@ class ClickMenu { ...@@ -1190,7 +1191,7 @@ class ClickMenu {
// Processing by external functions? // Processing by external functions?
$menuItems = $this->externalProcessingOfDBMenuItems($menuItems); $menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
// Return the printed elements: // Return the printed elements:
return $this->printItems($menuItems, IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => BackendUtility::getRecordTitle($table, $this->rec, TRUE)))); return $this->printItems($menuItems);
} }
/** /**
......
...@@ -415,7 +415,7 @@ class Clipboard { ...@@ -415,7 +415,7 @@ class Clipboard {
if (is_array($rec)) { if (is_array($rec)) {
$lines[] = ' $lines[] = '
<tr> <tr>
<td nowrap="nowrap" class="col-icon">' . $this->linkItemText(IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(BackendUtility::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td> <td nowrap="nowrap" class="col-icon">' . $this->linkItemText($this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render(), $rec, $table) . '</td>
<td nowrap="nowrap" width="95%">' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;</td> <td nowrap="nowrap" width="95%">' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;</td>
<td nowrap="nowrap" class="col-control"> <td nowrap="nowrap" class="col-control">
<div class="btn-group"> <div class="btn-group">
...@@ -486,7 +486,7 @@ class Clipboard { ...@@ -486,7 +486,7 @@ class Clipboard {
foreach ($rows as $rec) { foreach ($rows as $rec) {
$lines[] = ' $lines[] = '
<tr> <tr>
<td nowrap="nowrap" class="col-icon">' . IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin-left: 38px;')) . '</td> <td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td> <td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
<td nowrap="nowrap" class="col-control"></td> <td nowrap="nowrap" class="col-control"></td>
</tr>'; </tr>';
......
...@@ -679,7 +679,7 @@ class ElementInformationController { ...@@ -679,7 +679,7 @@ class ElementInformationController {
$parentRecordTitle = is_array($parentRecord) $parentRecordTitle = is_array($parentRecord)
? BackendUtility::getRecordTitle('pages', $parentRecord) ? BackendUtility::getRecordTitle('pages', $parentRecord)
: ''; : '';
$icon = IconUtility::getSpriteIconForRecord($row['tablename'], $record); $icon = $this->iconFactory->getIconForRecord($row['tablename'], $record, Icon::SIZE_SMALL)->render();
$actions = $this->getRecordActions($row['tablename'], $row['recuid']); $actions = $this->getRecordActions($row['tablename'], $row['recuid']);
$urlParameters = [ $urlParameters = [
'edit' => [ 'edit' => [
...@@ -779,7 +779,7 @@ class ElementInformationController { ...@@ -779,7 +779,7 @@ class ElementInformationController {
foreach ($rows as $row) { foreach ($rows as $row) {
$record = BackendUtility::getRecord($row['ref_table'], $row['ref_uid']); $record = BackendUtility::getRecord($row['ref_table'], $row['ref_uid']);
if ($record) { if ($record) {
$icon = IconUtility::getSpriteIconForRecord($row['tablename'], $record); $icon = $this->iconFactory->getIconForRecord($row['tablename'], $record, Icon::SIZE_SMALL)->render();
$actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']); $actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']);
$urlParameters = [ $urlParameters = [
......
...@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement; ...@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
...@@ -150,7 +149,7 @@ class MoveElementController { ...@@ -150,7 +149,7 @@ class MoveElementController {
// Get record for element: // Get record for element:
$elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid); $elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid);
// Headerline: Icon, record title: // Headerline: Icon, record title:
$headerLine = IconUtility::getSpriteIconForRecord($this->table, $elRow, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($elRow, $this->table)))); $headerLine = '<span title="' . BackendUtility::getRecordIconAltText($elRow, $this->table) . '">' . $this->iconFactory->getIconForRecord($this->table, $elRow, Icon::SIZE_SMALL)->render() . '</span>';
$headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, TRUE); $headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, TRUE);
// Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently): // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
$headerLine .= $this->doc->spacer(5); $headerLine .= $this->doc->spacer(5);
...@@ -177,7 +176,7 @@ class MoveElementController { ...@@ -177,7 +176,7 @@ class MoveElementController {
if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int)$pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />'; $code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int)$pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else { } else {
$code .= IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />'; $code .= $this->iconFactory->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
} }
} }
} }
...@@ -201,7 +200,7 @@ class MoveElementController { ...@@ -201,7 +200,7 @@ class MoveElementController {
$posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
$posMap->cur_sys_language = $this->sys_language; $posMap->cur_sys_language = $this->sys_language;
// Headerline for the parent page: Icon, record title: // Headerline for the parent page: Icon, record title:
$headerLine = IconUtility::getSpriteIconForRecord('pages', $pageInfo, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($pageInfo, 'pages')))); $headerLine = '<span title="' . BackendUtility::getRecordIconAltText($pageInfo, 'pages') . '">' . $this->iconFactory->getIconForRecord('pages', $pageInfo, Icon::SIZE_SMALL)->render() . '</span>';
$headerLine .= BackendUtility::getRecordTitle('pages', $pageInfo, TRUE); $headerLine .= BackendUtility::getRecordTitle('pages', $pageInfo, TRUE);
// Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
// SHARED page-TSconfig settings. // SHARED page-TSconfig settings.
...@@ -227,7 +226,7 @@ class MoveElementController { ...@@ -227,7 +226,7 @@ class MoveElementController {
'moveUid' => $this->moveUid 'moveUid' => $this->moveUid
))) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />'; ))) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else { } else {
$code .= IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />'; $code .= $this->iconFactory->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
} }
} }
} }
...@@ -270,7 +269,6 @@ class MoveElementController { ...@@ -270,7 +269,6 @@ class MoveElementController {
'csh' => '', 'csh' => '',
'back' => '' 'back' => ''
); );
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
if ($this->page_id) { if ($this->page_id) {
if ((string)$this->table == 'pages') { if ((string)$this->table == 'pages') {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_pages'); $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_pages');
...@@ -278,7 +276,7 @@ class MoveElementController { ...@@ -278,7 +276,7 @@ class MoveElementController {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_cs'); $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_cs');
} }
if ($this->R_URI) { if ($this->R_URI) {
$buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $this->getLanguageService()->getLL('goBack', TRUE) . '">' . $iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL) . '</a>'; $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $this->getLanguageService()->getLL('goBack', TRUE) . '">' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL) . '</a>';
} }
} }
return $buttons; return $buttons;
......
...@@ -268,7 +268,7 @@ class NewRecordController { ...@@ -268,7 +268,7 @@ class NewRecordController {
} }
// Set header-HTML and return_url // Set header-HTML and return_url
if (is_array($this->pageinfo) && $this->pageinfo['uid']) { if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
$iconImgTag = IconUtility::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath']))); $iconImgTag = '<span title="' . htmlspecialchars($this->pageinfo['_thePath']) . '">' . $this->iconFactory->getIconForRecord('pages', $this->pageinfo, Icon::SIZE_SMALL)->render() . '</span>';
$title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]); $title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]);
} else { } else {
$iconImgTag = '<span title="' . htmlspecialchars($this->pageinfo['_thePath']) . '">' . $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL) . '</span>'; $iconImgTag = '<span title="' . htmlspecialchars($this->pageinfo['_thePath']) . '">' . $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL) . '</span>';
...@@ -402,14 +402,14 @@ class NewRecordController { ...@@ -402,14 +402,14 @@ class NewRecordController {
// New Page // New Page
$table = 'pages'; $table = 'pages';
$v = $GLOBALS['TCA'][$table]; $v = $GLOBALS['TCA'][$table];
$pageIcon = IconUtility::getSpriteIconForRecord($table, array()); $pageIcon = $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render();
$newPageIcon = $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL); $newPageIcon = $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL);
$rowContent = ''; $rowContent = '';
// New pages INSIDE this pages // New pages INSIDE this pages
$newPageLinks = array(); $newPageLinks = array();
if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ?: $this->id), 'pages')) { if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ?: $this->id), 'pages')) {
// Create link to new page inside: // Create link to new page inside:
$newPageLinks[] = $this->linkWrap(IconUtility::getSpriteIconForRecord($table, array()) . $lang->sL($v['ctrl']['title'], TRUE) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', TRUE) . ')', $table, $this->id); $newPageLinks[] = $this->linkWrap($this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . $lang->sL($v['ctrl']['title'], TRUE) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', TRUE) . ')', $table, $this->id);
} }
// New pages AFTER this pages // New pages AFTER this pages
if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) { if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
...@@ -448,7 +448,7 @@ class NewRecordController { ...@@ -448,7 +448,7 @@ class NewRecordController {
&& (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1) && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1)
&& $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id), $table) && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id), $table)
) { ) {
$newRecordIcon = IconUtility::getSpriteIconForRecord($table, array()); $newRecordIcon = $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render();
$rowContent = ''; $rowContent = '';
$thisTitle = ''; $thisTitle = '';
// Create new link for record: // Create new link for record:
......
...@@ -18,25 +18,24 @@ use TYPO3\CMS\Backend\Form\Element\InlineElementHookInterface; ...@@ -18,25 +18,24 @@ use TYPO3\CMS\Backend\Form\Element\InlineElementHookInterface;
use TYPO3\CMS\Backend\Form\Exception\AccessDeniedContentEditException; use TYPO3\CMS\Backend\Form\Exception\AccessDeniedContentEditException;
use TYPO3\CMS\Backend\Form\FormDataCompiler; use TYPO3\CMS\Backend\Form\FormDataCompiler;
use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord; use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
use TYPO3\CMS\Backend\Form\InlineRelatedRecordResolver;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\NodeFactory; use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility; use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Resource\ProcessedFile; use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Lang\LanguageService; use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\InlineRelatedRecordResolver;
/** /**
* Render a single inline record relation. * Render a single inline record relation.
...@@ -422,15 +421,7 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -422,15 +421,7 @@ class InlineRecordContainer extends AbstractContainer {
$altText = BackendUtility::getRecordIconAltText($rec, $foreign_table); $altText = BackendUtility::getRecordIconAltText($rec, $foreign_table);
// @todo: Hack for getSpriteIconForRecord $iconImg = '<span title="' . $altText . '" id="' . htmlspecialchars($objectId) . '_icon' . '">' . $this->iconFactory->getIconForRecord($foreign_table, $rec, Icon::SIZE_SMALL)->render() . '</span>';
$recordForIconUtility = $rec;
if (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']) && is_array($rec[$GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']])) {
$recordForIconUtility[$GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']] = implode(
',',
$rec[$GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']]
);
}
$iconImg = IconUtility::getSpriteIconForRecord($foreign_table, $recordForIconUtility, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon'));
$label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>'; $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
$ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord); $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
$thumbnail = FALSE; $thumbnail = FALSE;
...@@ -458,10 +449,10 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -458,10 +449,10 @@ class InlineRecordContainer extends AbstractContainer {
if ($processedImage->getProperty('width')) { if ($processedImage->getProperty('width')) {
$imageUrl = $processedImage->getPublicUrl(TRUE); $imageUrl = $processedImage->getPublicUrl(TRUE);
$thumbnail = '<img src="' . $imageUrl . '" ' . $thumbnail = '<img src="' . $imageUrl . '" ' .
'width="' . $processedImage->getProperty('width') . '" ' . 'width="' . $processedImage->getProperty('width') . '" ' .
'height="' . $processedImage->getProperty('height') . '" ' . 'height="' . $processedImage->getProperty('height') . '" ' .
'alt="' . htmlspecialchars($altText) . '" ' . 'alt="' . htmlspecialchars($altText) . '" ' .
'title="' . htmlspecialchars($altText) . '">'; 'title="' . htmlspecialchars($altText) . '">';
} }
} }
} }
...@@ -543,7 +534,7 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -543,7 +534,7 @@ class InlineRecordContainer extends AbstractContainer {
} }
$cells['info'] = ' $cells['info'] = '
<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;')) . '" title="' . $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE) . '"> <a class="btn btn-default" href="#" onclick="' . htmlspecialchars(('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;')) . '" title="' . $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE) . '">
' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . ' ' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '
</a>'; </a>';
} }
// If the table is NOT a read-only table, then show these links: // If the table is NOT a read-only table, then show these links:
...@@ -558,7 +549,7 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -558,7 +549,7 @@ class InlineRecordContainer extends AbstractContainer {
} }
$cells['new'] = ' $cells['new'] = '
<a class="btn btn-default inlineNewButton ' . $this->inlineData['config'][$nameObject]['md5'] . '" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:new' . ($isPagesTable ? 'Page' : 'Record')), TRUE) . '" ' . $style . '> <a class="btn btn-default inlineNewButton ' . $this->inlineData['config'][$nameObject]['md5'] . '" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:new' . ($isPagesTable ? 'Page' : 'Record')), TRUE) . '" ' . $style . '>
' . $this->iconFactory->getIcon('actions-' . ($isPagesTable ? 'page' : 'document') . '-new', Icon::SIZE_SMALL)->render() . ' ' . $this->iconFactory->getIcon('actions-' . ($isPagesTable ? 'page' : 'document') . '-new', Icon::SIZE_SMALL)->render() . '
</a>'; </a>';
} }
} }
...@@ -596,8 +587,8 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -596,8 +587,8 @@ class InlineRecordContainer extends AbstractContainer {
)); ));
$editOnClick = 'if (top.content.list_frame) {' . $editOnClick = 'if (top.content.list_frame) {' .
'top.content.list_frame.location.href=' . 'top.content.list_frame.location.href=' .
GeneralUtility::quoteJSvalue($url . '&returnUrl=') . GeneralUtility::quoteJSvalue($url . '&returnUrl=') .
'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search)' . '+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search)' .
';' . ';' .
'}'; '}';
$title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'); $title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata');
...@@ -610,7 +601,8 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -610,7 +601,8 @@ class InlineRecordContainer extends AbstractContainer {
// "Delete" link: // "Delete" link:
if ($enabledControls['delete'] && ($isPagesTable && $localCalcPerms & Permission::PAGE_DELETE if ($enabledControls['delete'] && ($isPagesTable && $localCalcPerms & Permission::PAGE_DELETE
|| !$isPagesTable && $calcPerms & Permission::CONTENT_EDIT || !$isPagesTable && $calcPerms & Permission::CONTENT_EDIT
|| $isSysFileReferenceTable && $calcPerms & Permission::PAGE_EDIT)) { || $isSysFileReferenceTable && $calcPerms & Permission::PAGE_EDIT)
) {
$onClick = htmlspecialchars(('if (confirm(' $onClick = htmlspecialchars(('if (confirm('
. GeneralUtility::quoteJSvalue($languageService->getLL('deleteWarning')) . ')) { ' . GeneralUtility::quoteJSvalue($languageService->getLL('deleteWarning')) . ')) { '
. 'inline.deleteRecord(' . GeneralUtility::quoteJSvalue($nameObjectFtId) . ');' . 'inline.deleteRecord(' . GeneralUtility::quoteJSvalue($nameObjectFtId) . ');'
...@@ -630,15 +622,15 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -630,15 +622,15 @@ class InlineRecordContainer extends AbstractContainer {
$title = $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')), TRUE); $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 ' . $className . '" href="#" onclick="' <a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
. htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' . . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL) . ' $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); $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 ' . $className . '" href="#" onclick="' <a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
. htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' . . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . ' $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . '
</a>'; </a>';
} }
} }
...@@ -747,7 +739,7 @@ class InlineRecordContainer extends AbstractContainer { ...@@ -747,7 +739,7 @@ class InlineRecordContainer extends AbstractContainer {
} }
// Check internals regarding access // Check internals regarding access
$isRootLevelRestrictionIgnored = BackendUtility::isRootLevelRestrictionIgnored($table); $isRootLevelRestrictionIgnored = BackendUtility::isRootLevelRestrictionIgnored($table);
if ($hasAccess|| (int)$calcPRec['pid'] === 0 && $isRootLevelRestrictionIgnored) { if ($hasAccess || (int)$calcPRec['pid'] === 0 && $isRootLevelRestrictionIgnored) {
$hasAccess = (bool)$backendUser->recordEditAccessInternals($table, $calcPRec); $hasAccess = (bool)$backendUser->recordEditAccessInternals($table, $calcPRec);
} }
} }
......