From 133d167cbc0c243068a3e64b44d8402095cb3dfe Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Mon, 22 Jun 2015 11:18:27 +0200 Subject: [PATCH] Revert "[TASK] Port toolbar dropdowns to Fluid" This reverts commit 13d0fcc0c27ff27f3498ebda2cbd2f22f12492ab. Moving these tiny html snippets to fluid gives no real benefit. Change-Id: I0f186028bd9bdb5b22ac5a3a325ca844a9d40beb Reverts: #67537 Reviewed-on: http://review.typo3.org/40521 Reviewed-by: Benjamin Mack <benni@typo3.org> Tested-by: Benjamin Mack <benni@typo3.org> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Markus Klein <markus.klein@typo3.org> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Andreas Fernandez <typo3@scripting-base.de> Tested-by: Andreas Fernandez <typo3@scripting-base.de> --- .../ToolbarItems/AbstractToolbarItem.php | 36 ++---- .../ToolbarItems/ClearCacheToolbarItem.php | 29 ++--- .../Backend/ToolbarItems/HelpToolbarItem.php | 42 +++---- .../ToolbarItems/ShortcutToolbarItem.php | 104 +++++++----------- .../SystemInformationToolbarItem.php | 9 +- .../Backend/ToolbarItems/UserToolbarItem.php | 55 +++++---- .../Templates/ToolbarMenu/ClearCache.html | 9 -- .../Private/Templates/ToolbarMenu/Help.html | 10 -- .../Templates/ToolbarMenu/Shortcut.html | 30 ----- .../Private/Templates/ToolbarMenu/User.html | 16 --- .../ToolbarItems/OpendocsToolbarItem.php | 78 +++++-------- .../Templates/ToolbarMenu/Opendocs.html | 45 -------- .../WorkspaceSelectorToolbarItem.php | 57 ++++------ .../ToolbarMenu/WorkspaceSelector.html | 32 ------ 14 files changed, 155 insertions(+), 397 deletions(-) delete mode 100644 typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/ClearCache.html delete mode 100644 typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Help.html delete mode 100644 typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Shortcut.html delete mode 100644 typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/User.html delete mode 100644 typo3/sysext/opendocs/Resources/Private/Templates/ToolbarMenu/Opendocs.html delete mode 100644 typo3/sysext/workspaces/Resources/Private/Templates/ToolbarMenu/WorkspaceSelector.html diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/AbstractToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/AbstractToolbarItem.php index 98f9f2acd36e..9ddf47e0b906 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/AbstractToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/AbstractToolbarItem.php @@ -23,47 +23,27 @@ use TYPO3\CMS\Fluid\View\StandaloneView; */ abstract class AbstractToolbarItem { - /** - * @var string Extension context - */ - protected $extension = 'backend'; - - /** - * @var string Template file for the dropdown menu - */ - protected $templateFile = ''; - /** * @var StandaloneView */ protected $standaloneView = NULL; - /** - * Constructor - * - * @throws \InvalidArgumentException - */ public function __construct() { - if (empty($this->templateFile)) { - throw new \InvalidArgumentException('The template file for class "' . get_class($this) . '" is not set.', 1434530382); - } - - $extPath = ExtensionManagementUtility::extPath($this->extension); + $extPath = ExtensionManagementUtility::extPath('backend'); /* @var $view StandaloneView */ $this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class); - $this->standaloneView->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/ToolbarMenu/' . $this->templateFile); - $this->standaloneView->setPartialRootPaths(array( - $extPath . 'Resources/Private/Partials/ToolbarMenu/' - )); + $this->standaloneView->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/ToolbarMenu/' . static::TOOLBAR_MENU_TEMPLATE); } /** + * @param string $extension Set the extension context (required for shorthand locallang.xlf references) * @return StandaloneView */ - protected function getStandaloneView() { - $request = $this->standaloneView->getRequest(); - $request->setControllerExtensionName($this->extension); - + protected function getStandaloneView($extension = NULL) { + if (!empty($extension)) { + $request = $this->standaloneView->getRequest(); + $request->setControllerExtensionName($extension); + } return $this->standaloneView; } } diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php index f0311868cf4f..658a1c6ee9a1 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php @@ -25,12 +25,7 @@ use TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface; * * @author Ingo Renner <ingo@typo3.org> */ -class ClearCacheToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface { - - /** - * @var string Template file for the dropdown menu - */ - protected $templateFile = 'ClearCache.html'; +class ClearCacheToolbarItem implements ToolbarItemInterface { /** * @var array @@ -48,8 +43,6 @@ class ClearCacheToolbarItem extends AbstractToolbarItem implements ToolbarItemIn * @throws \UnexpectedValueException */ public function __construct() { - parent::__construct(); - $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); @@ -143,20 +136,18 @@ class ClearCacheToolbarItem extends AbstractToolbarItem implements ToolbarItemIn * @return string Drop down HTML */ public function getDropDown() { - $items = array(); + $result = array(); + $result[] = '<ul class="dropdown-list">'; foreach ($this->cacheActions as $cacheAction) { $title = $cacheAction['description'] ?: $cacheAction['title']; - $items[] = array( - 'title' => $title, - 'label' => $cacheAction['title'], - 'href' => $cacheAction['href'], - 'icon' => $cacheAction['icon'] - ); + $result[] = '<li>'; + $result[] = '<a class="dropdown-list-link" href="' . htmlspecialchars($cacheAction['href']) . '" title="' . htmlspecialchars($title) . '">'; + $result[] = $cacheAction['icon'] . ' ' . htmlspecialchars($cacheAction['title']); + $result[] = '</a>'; + $result[] = '</li>'; } - - $standaloneView = $this->getStandaloneView(); - $standaloneView->assign('items', $items); - return $standaloneView->render(); + $result[] = '</ul>'; + return implode(LF, $result); } /** diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/HelpToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/HelpToolbarItem.php index e3134c93b981..e86af44381c4 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/HelpToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/HelpToolbarItem.php @@ -22,12 +22,7 @@ use TYPO3\CMS\Backend\Domain\Model\Module\BackendModule; /** * Help toolbar item */ -class HelpToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface { - - /** - * @var string Template file for the dropdown menu - */ - protected $templateFile = 'Help.html'; +class HelpToolbarItem implements ToolbarItemInterface { /** * @var \SplObjectStorage<BackendModule> @@ -38,8 +33,6 @@ class HelpToolbarItem extends AbstractToolbarItem implements ToolbarItemInterfac * Constructor */ public function __construct() { - parent::__construct(); - /** @var BackendModuleRepository $backendModuleRepository */ $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class); /** @var \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule $userModuleMenu */ @@ -75,25 +68,26 @@ class HelpToolbarItem extends AbstractToolbarItem implements ToolbarItemInterfac */ public function getDropDown() { $dropdown = array(); + $dropdown[] = '<ul class="dropdown-list">'; foreach ($this->helpModuleMenu->getChildren() as $module) { /** @var BackendModule $module */ - $dropdown[] = array( - 'id' => $module->getName(), - 'navigation' => array( - 'componentId' => $module->getNavigationComponentId(), - 'frameScript' => $module->getNavigationFrameScript(), - 'frameScriptParameters' => $module->getNavigationFrameScriptParameters(), - ), - 'href' => $module->getLink(), - 'description' => $module->getDescription(), - 'icon' => $module->getIcon(), - 'label' => $module->getTitle() - ); + $moduleIcon = $module->getIcon(); + $dropdown[] ='<li' + . ' id="' . htmlspecialchars($module->getName()) . '"' + . ' class="typo3-module-menu-item submodule mod-' . htmlspecialchars($module->getName()) . '" ' + . ' data-modulename="' . htmlspecialchars($module->getName()) . '"' + . ' data-navigationcomponentid="' . htmlspecialchars($module->getNavigationComponentId()) . '"' + . ' data-navigationframescript="' . htmlspecialchars($module->getNavigationFrameScript()) . '"' + . ' data-navigationframescriptparameters="' . htmlspecialchars($module->getNavigationFrameScriptParameters()) . '"' + . '>'; + $dropdown[] = '<a title="' . htmlspecialchars($module->getDescription()) . '" href="' . htmlspecialchars($module->getLink()) . '" class="dropdown-list-link modlink">'; + $dropdown[] = '<span class="submodule-icon typo3-app-icon"><span><span>' . $moduleIcon . '</span></span></span>'; + $dropdown[] = '<span class="submodule-label">' . htmlspecialchars($module->getTitle()) . '</span>'; + $dropdown[] = '</a>'; + $dropdown[] = '</li>'; } - - $standaloneView = $this->getStandaloneView(); - $standaloneView->assign('dropdown', $dropdown); - return $standaloneView->render(); + $dropdown[] = '</ul>'; + return implode(LF, $dropdown); } /** diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php index d9a82d6787a6..da5374d5f4d7 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php @@ -28,28 +28,13 @@ use TYPO3\CMS\Core\Utility\PathUtility; * * @author Ingo Renner <ingo@typo3.org> */ -class ShortcutToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface { +class ShortcutToolbarItem implements ToolbarItemInterface { /** - * @const int Number of super global group + * @const integer Number of super global group */ const SUPERGLOBAL_GROUP = -100; - /** - * @const string Type of shortcut groups - */ - const TYPE_GROUP = 'group'; - - /** - * @const string Type of shortcut items - */ - const TYPE_ITEM = 'item'; - - /** - * @var string Template file for the dropdown menu - */ - protected $templateFile = 'Shortcut.html'; - /** * @var string */ @@ -91,8 +76,6 @@ class ShortcutToolbarItem extends AbstractToolbarItem implements ToolbarItemInte $loadModules->load($GLOBALS['TBE_MODULES']); } - parent::__construct(); - // By default, 5 groups are set $this->shortcutGroups = array( 1 => '1', @@ -143,70 +126,65 @@ class ShortcutToolbarItem extends AbstractToolbarItem implements ToolbarItemInte $editIcon = '<a href="#" class="dropdown-list-link-edit shortcut-edit">' . IconUtility::getSpriteIcon('actions-document-open', array('title' => $shortcutEdit)) . '</a>'; $deleteIcon = '<a href="#" class="dropdown-list-link-delete shortcut-delete">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $shortcutDelete)) . '</a>'; - $shortcutMenu = array(); + $shortcutMenu[] = '<ul class="dropdown-list">'; // Render shortcuts with no group (group id = 0) first $noGroupShortcuts = $this->getShortcutsByGroup(0); foreach ($noGroupShortcuts as $shortcut) { - $shortcutMenu[] = array( - 'uid' => (int)$shortcut['raw']['uid'], - 'groupid' => static::SUPERGLOBAL_GROUP, - 'type' => static::TYPE_ITEM, - 'action' => $shortcut['action'], - 'icon' => $shortcut['icon'], - 'label' => $shortcut['label'] - ); + + $shortcutMenu[] = ' + <li class="shortcut" data-shortcutid="' . (int)$shortcut['raw']['uid'] . '"> + <a class="dropdown-list-link dropdown-link-list-add-editdelete" href="#" onclick="' . htmlspecialchars($shortcut['action']) . ' return false;">' . + $shortcut['icon'] . ' ' . + htmlspecialchars($shortcut['label']) . + '</a> + ' . $editIcon . $deleteIcon . ' + </li>'; } // Now render groups and the contained shortcuts $groups = $this->getGroupsFromShortcuts(); krsort($groups, SORT_NUMERIC); foreach ($groups as $groupId => $groupLabel) { - $groupId = (int)$groupId; - if ($groupId === 0) { - continue; - } - - $shortcutMenu[] = array( - 'uid' => $groupId, - 'type' => static::TYPE_GROUP, - 'label' => $groupLabel - ); - - $shortcuts = $this->getShortcutsByGroup($groupId); - $i = 0; - foreach ($shortcuts as $shortcut) { - $i++; - $shortcutMenu[] = array( - 'uid' => (int)$shortcut['raw']['uid'], - 'groupid' => (int)$groupId, - 'type' => static::TYPE_ITEM, - 'action' => $shortcut['action'], - 'icon' => $shortcut['icon'], - 'label' => $shortcut['label'] - ); + if ($groupId != 0) { + $shortcutGroup = ''; + if (count($shortcutMenu) > 1) { + $shortcutGroup .= '<li class="divider"></li>'; + } + $shortcutGroup .= ' + <li class="dropdown-header" id="shortcut-group-' . (int)$groupId . '"> + ' . $groupLabel . ' + </li>'; + $shortcuts = $this->getShortcutsByGroup($groupId); + $i = 0; + foreach ($shortcuts as $shortcut) { + $i++; + $shortcutGroup .= ' + <li class="shortcut" data-shortcutid="' . (int)$shortcut['raw']['uid'] . '" data-shortcutgroup="' . (int)$groupId . '"> + <a class="dropdown-list-link dropdown-link-list-add-editdelete" href="#" onclick="' . htmlspecialchars($shortcut['action']) . ' return false;">' . + $shortcut['icon'] . ' ' . + htmlspecialchars($shortcut['label']) . + '</a> + ' . $editIcon . $deleteIcon . ' + </li>'; + } + $shortcutMenu[] = $shortcutGroup; } } + $shortcutMenu[] = '</ul>'; - $standaloneView = $this->getStandaloneView(); - $standaloneView->assignMultiple(array( - 'hasEntries' => !empty($shortcutMenu), - 'shortcutMenu' => $shortcutMenu, - 'editIcon' => $editIcon, - 'deleteIcon' => $deleteIcon, - )); - - if (empty($shortcutMenu)) { + if (count($shortcutMenu) == 2) { // 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); $icon = IconUtility::getSpriteIcon('actions-system-shortcut-new', array( 'title' => $title )); $label = str_replace('%icon%', $icon, $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:bookmarkDescription')); - - $standaloneView->assign('introduction', $label); + $compiledShortcutMenu = '<p>' . $label . '</p>'; + } else { + $compiledShortcutMenu = implode(LF, $shortcutMenu); } - return $standaloneView->render(); + return $compiledShortcutMenu; } /** diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/SystemInformationToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/SystemInformationToolbarItem.php index f01b6243ae12..f2e86857ce05 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/SystemInformationToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/SystemInformationToolbarItem.php @@ -29,9 +29,9 @@ use TYPO3\CMS\Core\Utility\StringUtility; class SystemInformationToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface { /** - * @var string Template file for the dropdown menu + * Template file for the dropdown menu */ - protected $templateFile = 'SystemInformation.html'; + const TOOLBAR_MENU_TEMPLATE = 'SystemInformation.html'; /** * Number displayed as badge on the dropdown trigger @@ -280,15 +280,14 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba return ''; } - $standaloneView = $this->getStandaloneView(); - $standaloneView->assignMultiple(array( + $this->getStandaloneView('backend')->assignMultiple(array( 'installToolUrl' => BackendUtility::getModuleUrl('system_InstallInstall'), 'messages' => $this->systemMessages, 'count' => $this->totalCount, 'severityBadgeClass' => $this->severityBadgeClass, 'systemInformation' => $this->systemInformation )); - return $standaloneView->render(); + return $this->getStandaloneView()->render(); } /** diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/UserToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/UserToolbarItem.php index 271fa26f28bb..406ac7394de0 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/UserToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/UserToolbarItem.php @@ -24,12 +24,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; /** * User toolbar item */ -class UserToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface { - - /** - * @var string Template file for the dropdown menu - */ - protected $templateFile = 'User.html'; +class UserToolbarItem implements ToolbarItemInterface { /** * Item is always enabled @@ -80,6 +75,7 @@ class UserToolbarItem extends AbstractToolbarItem implements ToolbarItemInterfac $languageService = $this->getLanguageService(); $dropdown = array(); + $dropdown[] = '<ul class="dropdown-list">'; /** @var BackendModuleRepository $backendModuleRepository */ $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class); @@ -88,33 +84,34 @@ class UserToolbarItem extends AbstractToolbarItem implements ToolbarItemInterfac if ($userModuleMenu != FALSE && $userModuleMenu->getChildren()->count() > 0) { foreach ($userModuleMenu->getChildren() as $module) { /** @var BackendModule $module */ - $dropdown[] = array( - 'id' => $module->getName(), - 'navigation' => array( - 'componentId' => $module->getNavigationComponentId(), - 'frameScript' => $module->getNavigationFrameScript(), - 'frameScriptParameters' => $module->getNavigationFrameScriptParameters(), - ), - 'href' => $module->getLink(), - 'description' => $module->getDescription(), - 'icon' => $module->getIcon(), - 'label' => $module->getTitle() - ); + $dropdown[] ='<li' + . ' id="' . htmlspecialchars($module->getName()) . '"' + . ' class="typo3-module-menu-item submodule mod-' . htmlspecialchars($module->getName()) . '" ' + . ' data-modulename="' . htmlspecialchars($module->getName()) . '"' + . ' data-navigationcomponentid="' . htmlspecialchars($module->getNavigationComponentId()) . '"' + . ' data-navigationframescript="' . htmlspecialchars($module->getNavigationFrameScript()) . '"' + . ' data-navigationframescriptparameters="' . htmlspecialchars($module->getNavigationFrameScriptParameters()) . '"' + . '>'; + $dropdown[] = '<a title="' . htmlspecialchars($module->getDescription()) . '" href="' . htmlspecialchars($module->getLink()) . '" class="dropdown-list-link modlink">'; + $dropdown[] = '<span class="submodule-icon typo3-app-icon"><span><span>' . $module->getIcon() . '</span></span></span>'; + $dropdown[] = '<span class="submodule-label">' . htmlspecialchars($module->getTitle()) . '</span>'; + $dropdown[] = '</a>'; + $dropdown[] = '</li>'; } + $dropdown[] = '<li class="divider"></li>'; } // Logout button - $logoutButton = array( - 'label' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:' . ($backendUser->user['ses_backuserid'] ? 'buttons.exit' : 'buttons.logout')), - 'href' => htmlspecialchars(BackendUtility::getModuleUrl('logout')), - ); - - $standaloneView = $this->getStandaloneView(); - $standaloneView->assignMultiple(array( - 'dropdown' => $dropdown, - 'logoutButton' => $logoutButton - )); - return $standaloneView->render(); + $buttonLabel = 'LLL:EXT:lang/locallang_core.xlf:' . ($backendUser->user['ses_backuserid'] ? 'buttons.exit' : 'buttons.logout'); + $dropdown[] = '<li class="reset-dropdown">'; + $dropdown[] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('logout')) . '" class="btn btn-danger pull-right" target="_top"><i class="fa fa-power-off"></i> '; + $dropdown[] = $languageService->sL($buttonLabel, TRUE); + $dropdown[] = '</a>'; + $dropdown[] = '</li>'; + + $dropdown[] = '</ul>'; + + return implode(LF, $dropdown); } /** diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/ClearCache.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/ClearCache.html deleted file mode 100644 index e1a59d0b5bf1..000000000000 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/ClearCache.html +++ /dev/null @@ -1,9 +0,0 @@ -<ul class="dropdown-list"> - <f:for each="{items}" as="item"> - <li> - <a class="dropdown-list-link" href="{item.href}" title="{item.title}"> - <f:format.raw>{item.icon}</f:format.raw> {item.label} - </a> - </li> - </f:for> -</ul> \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Help.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Help.html deleted file mode 100644 index a2b3450ac290..000000000000 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Help.html +++ /dev/null @@ -1,10 +0,0 @@ -<ul class="dropdown-list"> - <f:for each="{dropdown}" as="item"> - <li class="typo3-module-menu-item submodule mod-{item.id}" id="{item.id}" data-modulename="{item.id}" data-navigationcomponentid="{item.navigation.componentId}" data-navigationframescript="{item.navigation.frameScript}" data-navigationframescriptparameters="{item.navigation.frameScriptParameters}"> - <a class="dropdown-list-link modlink" href="{item.href}" title="{item.description}"> - <span class="submodule-icon typo3-app-icon"><span><span><f:format.raw>{item.icon}</f:format.raw></span></span></span> - <span class="submodule-label">{item.label}</span> - </a> - </li> - </f:for> -</ul> \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Shortcut.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Shortcut.html deleted file mode 100644 index 3470370b29e6..000000000000 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/Shortcut.html +++ /dev/null @@ -1,30 +0,0 @@ -<f:if condition="{hasEntries}"> - <f:then> - <ul class="dropdown-list"> - <f:for each="{shortcutMenu}" as="shortcut" iteration="iteration"> - <f:if condition="{shortcut.type} == 'group'"> - <f:if condition="{iteration.isFirst}"> - <f:then></f:then> - <f:else><li class="divider"></li></f:else> - </f:if> - <li class="dropdown-header" id="shortcut-group-{shortcut.uid}"> - {shortcut.label} - </li> - </f:if> - - <f:if condition="{shortcut.type} == 'item'"> - <li class="shortcut" data-shortcutid="{shortcut.uid}"> - <a class="dropdown-list-link dropdown-link-list-add-editdelete" href="#" onclick="{shortcut.action} return false;"> - <f:format.raw>{shortcut.icon}</f:format.raw> {shortcut.label} - </a> - <f:format.raw>{editIcon}</f:format.raw> - <f:format.raw>{deleteIcon}</f:format.raw> - </li> - </f:if> - </f:for> - </ul> - </f:then> - <f:else> - <f:format.raw>{introduction}</f:format.raw> - </f:else> -</f:if> \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/User.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/User.html deleted file mode 100644 index 616add699967..000000000000 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarMenu/User.html +++ /dev/null @@ -1,16 +0,0 @@ -<ul class="dropdown-list"> - <f:for each="{dropdown}" as="item"> - <li class="typo3-module-menu-item submodule mod-{item.id}" id="{item.id}" data-modulename="{item.id}" data-navigationcomponentid="{item.navigation.componentId}" data-navigationframescript="{item.navigation.frameScript}" data-navigationframescriptparameters="{item.navigation.frameScriptParameters}"> - <a class="dropdown-list-link modlink" href="{item.href}" title="{item.description}"> - <span class="submodule-icon typo3-app-icon"><span><span><f:format.raw>{item.icon}</f:format.raw></span></span></span> - <span class="submodule-label">{item.label}</span> - </a> - </li> - </f:for> - <li class="divider"></li> - <li class="reset-dropdown"> - <a href="{logoutButton.href}" class="btn btn-danger pull-right" target="_top"> - <i class="fa fa-power-off"></i> {logoutButton.label} - </a> - </li> -</ul> \ No newline at end of file diff --git a/typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php b/typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php index 67efa84f67c0..97f307b9de78 100644 --- a/typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php +++ b/typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php @@ -15,27 +15,16 @@ namespace TYPO3\CMS\Opendocs\Backend\ToolbarItems; */ use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface; -use TYPO3\CMS\Backend\Backend\ToolbarItems\AbstractToolbarItem; use TYPO3\CMS\Backend\Utility\IconUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; /** - * A list of all open documents + * Alist of all open documents * * @author Benjamin Mack <benni@typo3.org> * @author Ingo Renner <ingo@typo3.org> */ -class OpendocsToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface { - - /** - * @var string Extension context - */ - protected $extension = 'opendocs'; - - /** - * @var string Template file for the dropdown menu - */ - protected $templateFile = 'Opendocs.html'; +class OpendocsToolbarItem implements ToolbarItemInterface { /** * @var array @@ -51,8 +40,7 @@ class OpendocsToolbarItem extends AbstractToolbarItem implements ToolbarItemInte * Constructor */ public function __construct() { - parent::__construct(); - + $this->getLanguageService()->includeLLFile('EXT:opendocs/Resources/Private/Language/locallang.xlf'); $this->loadDocsFromUserSession(); $pageRenderer = $this->getPageRenderer(); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Opendocs/Toolbar/OpendocsMenu'); @@ -101,40 +89,34 @@ class OpendocsToolbarItem extends AbstractToolbarItem implements ToolbarItemInte * @return string HTML */ public function getDropDown() { + $languageService = $this->getLanguageService(); $openDocuments = $this->openDocs; $recentDocuments = $this->recentDocs; - $entries = array( - 'open' => array(), - 'recent' => array() - ); - if (!empty($openDocuments)) { + $entries = array(); + if (count($openDocuments)) { + $entries[] = '<li class="dropdown-header">' . $languageService->getLL('open_docs', TRUE) . '</li>'; $i = 0; foreach ($openDocuments as $md5sum => $openDocument) { $i++; - $entry = $this->renderMenuEntry($openDocument, $md5sum, FALSE, $i === 1); - if (!empty($entry)) { - $entries['open'][] = $entry; - } + $entries[] = $this->renderMenuEntry($openDocument, $md5sum, FALSE, $i == 1); } + $entries[] = '<li class="divider"></li>'; } // If there are "recent documents" in the list, add them - if (!empty($recentDocuments)) { + if (count($recentDocuments)) { + $entries[] = '<li class="dropdown-header">' . $languageService->getLL('recent_docs', TRUE) . '</li>'; $i = 0; foreach ($recentDocuments as $md5sum => $recentDocument) { $i++; - $entry = $this->renderMenuEntry($recentDocument, $md5sum, TRUE, $i === 1); - if (!empty($entry)) { - $entries['recent'][] = $entry; - } + $entries[] = $this->renderMenuEntry($recentDocument, $md5sum, TRUE, $i == 1); } } - - $standaloneView = $this->getStandaloneView(); - $standaloneView->assignMultiple(array( - 'entries' => $entries, - 'hasEntries' => !empty($entries['open']) || !empty($entries['recent']) - )); - return $standaloneView->render(); + if (count($entries)) { + $content = '<ul class="dropdown-list">' . implode('', $entries) . '</ul>'; + } else { + $content = '<p>' . $languageService->getLL('no_docs', TRUE) . '</p>'; + } + return $content; } /** @@ -154,7 +136,7 @@ class OpendocsToolbarItem extends AbstractToolbarItem implements ToolbarItemInte // Record seems to be deleted return ''; } - $label = strip_tags(htmlspecialchars_decode($document[0])); + $label = htmlspecialchars(strip_tags(htmlspecialchars_decode($document[0]))); $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $record); $link = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('record_edit') . '&' . $document[2]; $pageId = (int)$document[3]['uid']; @@ -166,21 +148,17 @@ class OpendocsToolbarItem extends AbstractToolbarItem implements ToolbarItemInte $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE); // Open document $closeIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close'); - $entry = array( - 'onclick' => $onClickCode, - 'icon' => $icon, - 'label' => $label, - 'md5sum' => $md5sum, - 'title' => $title, - 'closeIcon' => $closeIcon - ); + $entry = ' + <li class="opendoc"> + <a href="#" class="dropdown-list-link dropdown-link-list-add-close" onclick="' . htmlspecialchars($onClickCode) . '" target="content">' . $icon . ' ' . $label . '</a> + <a href="#" class="dropdown-list-link-close" data-opendocsidentifier="' . $md5sum . '" title="' . $title . '">' . $closeIcon . '</a> + </li>'; } else { // Recently used document - $entry = array( - 'onclick' => $onClickCode, - 'icon' => $icon, - 'label' => $label - ); + $entry = ' + <li> + <a href="#" class="dropdown-list-link" onclick="' . htmlspecialchars($onClickCode) . '" target="content">' . $icon . ' ' . $label . '</a> + </li>'; } return $entry; } diff --git a/typo3/sysext/opendocs/Resources/Private/Templates/ToolbarMenu/Opendocs.html b/typo3/sysext/opendocs/Resources/Private/Templates/ToolbarMenu/Opendocs.html deleted file mode 100644 index cd7398144fbb..000000000000 --- a/typo3/sysext/opendocs/Resources/Private/Templates/ToolbarMenu/Opendocs.html +++ /dev/null @@ -1,45 +0,0 @@ -<f:if condition="{hasEntries}"> - <f:then> - <ul class="dropdown-list"> - <f:for each="{entries.open}" as="entry" iteration="iteration"> - <f:if condition="{iteration.isFirst}"> - <li class="dropdown-header"><f:translate key="open_docs" /></li> - </f:if> - <li class="opendoc"> - <a href="#" class="dropdown-list-link dropdown-link-list-add-close" onclick="{entry.onclick}" target="content"> - <f:format.raw>{entry.icon}</f:format.raw> {entry.label} - </a> - <a href="#" class="dropdown-list-link-close" data-opendocsidentifier="{entry.md5sum}" title="{entry.title}"> - <f:format.raw>{entry.closeIcon}</f:format.raw> - </a> - </li> - <f:if condition="isLast"> - <f:then></f:then> - <f:else> - <li class="divider"></li> - </f:else> - </f:if> - </f:for> - - <f:for each="{entries.recent}" as="entry" iteration="iteration"> - <f:if condition="{iteration.isFirst}"> - <li class="dropdown-header"><f:translate key="recent_docs" /></li> - </f:if> - <li> - <a href="#" class="dropdown-list-link" onclick="{entry.onclick}" target="content"> - <f:format.raw>{entry.icon}</f:format.raw> {entry.label} - </a> - </li> - <f:if condition="isLast"> - <f:then></f:then> - <f:else> - <li class="divider"></li> - </f:else> - </f:if> - </f:for> - </ul> - </f:then> - <f:else> - <p><f:translate key="no_docs" /></p> - </f:else> -</f:if> diff --git a/typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php b/typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php index fb79c3b50fcb..64d734312fba 100644 --- a/typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php +++ b/typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php @@ -16,7 +16,6 @@ namespace TYPO3\CMS\Workspaces\Backend\ToolbarItems; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface; -use TYPO3\CMS\Backend\Backend\ToolbarItems\AbstractToolbarItem; use TYPO3\CMS\Workspaces\Service\WorkspaceService; use TYPO3\CMS\Backend\Utility\IconUtility; @@ -25,17 +24,7 @@ use TYPO3\CMS\Backend\Utility\IconUtility; * * @author Ingo Renner <ingo@typo3.org> */ -class WorkspaceSelectorToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface { - - /** - * @var string Extension context - */ - protected $extension = 'workspaces'; - - /** - * @var string Template file for the dropdown menu - */ - protected $templateFile = 'WorkspaceSelector.html'; +class WorkspaceSelectorToolbarItem implements ToolbarItemInterface { /** * @var array @@ -46,9 +35,7 @@ class WorkspaceSelectorToolbarItem extends AbstractToolbarItem implements Toolba * Constructor */ public function __construct() { - parent::__construct(); - - /** @var WorkspaceService $wsService */ + /** @var \TYPO3\CMS\Workspaces\Service\WorkspaceService $wsService */ $wsService = GeneralUtility::makeInstance(WorkspaceService::class); $this->availableWorkspaces = $wsService->getAvailableWorkspaces(); @@ -108,40 +95,36 @@ class WorkspaceSelectorToolbarItem extends AbstractToolbarItem implements Toolba foreach ($this->availableWorkspaces as $workspaceId => $label) { $workspaceId = (int)$workspaceId; $iconState = ($workspaceId === $activeWorkspace ? $stateCheckedIcon : $stateUncheckedIcon); - $classValue = ($workspaceId === $activeWorkspace ? 'selected' : ''); + $classValue = ($workspaceId === $activeWorkspace ? ' class="selected"' : ''); $sectionName = ($index++ === 0 ? 'top' : 'items'); - $workspaceSections[$sectionName][] = array( - 'href' => 'backend.php?changeWorkspace=' . $workspaceId, - 'class' => $classValue, - 'wsid' => $workspaceId, - 'icon' => $iconState, - 'label' => $label - ); + $workspaceSections[$sectionName][] = '<li' . $classValue . '>' + . '<a href="backend.php?changeWorkspace=' . $workspaceId . '" data-workspaceid="' . $workspaceId . '" class="dropdown-list-link tx-workspaces-switchlink">' + . $iconState . ' ' . htmlspecialchars($label) + . '</a></li>'; } if (!empty($workspaceSections['top'])) { // Add the "Go to workspace module" link // if there is at least one icon on top and if the access rights are there if ($backendUser->check('modules', 'web_WorkspacesWorkspaces')) { - $workspaceSections['top'][] = array( - 'module' => 'web_WorkspacesWorkspaces', - 'icon' => $stateUncheckedIcon, - 'label' => $languageService->getLL('bookmark_workspace', TRUE) - ); + $workspaceSections['top'][] = '<li><a target="content" data-module="web_WorkspacesWorkspaces" class="dropdown-list-link tx-workspaces-modulelink">' + . $stateUncheckedIcon . ' ' . $languageService->getLL('bookmark_workspace', TRUE) + . '</a></li>'; } } else { // no items on top (= no workspace to work in) - $workspaceSections['top'][] = array( - 'icon' => $stateUncheckedIcon, - 'label' => $languageService->getLL('bookmark_noWSfound', TRUE) - ); + $workspaceSections['top'][] = '<li>' . $stateUncheckedIcon . ' ' . $languageService->getLL('bookmark_noWSfound', TRUE) . '</li>'; } - $standaloneView = $this->getStandaloneView(); - $standaloneView->assignMultiple(array( - 'workspaceSections' => $workspaceSections - )); - return $standaloneView->render(); + $workspaceMenu = array( + '<ul class="dropdown-list">' , + implode(LF, $workspaceSections['top']), + (!empty($workspaceSections['items']) ? '<li class="divider"></li>' : ''), + implode(LF, $workspaceSections['items']), + '</ul>' + ); + + return implode(LF, $workspaceMenu); } /** diff --git a/typo3/sysext/workspaces/Resources/Private/Templates/ToolbarMenu/WorkspaceSelector.html b/typo3/sysext/workspaces/Resources/Private/Templates/ToolbarMenu/WorkspaceSelector.html deleted file mode 100644 index d1b82c0bbfd0..000000000000 --- a/typo3/sysext/workspaces/Resources/Private/Templates/ToolbarMenu/WorkspaceSelector.html +++ /dev/null @@ -1,32 +0,0 @@ -<ul class="dropdown-list"> - <f:for each="{workspaceSections}" key="sectionKey" as="section"> - <f:for each="{section}" as="item" iteration="iteration"> - <f:if condition="{sectionKey} == 'items'"> - <f:if condition="{iteration.isFirst}"> - <li class="divider"></li> - </f:if> - </f:if> - <li class="{item.class}"> - <f:if condition="{item.href}"> - <f:then> - <a href="{item.href}" data-workspaceid="{item.wsid}" class="dropdown-list-link tx-workspaces-switchlink"> - <f:format.raw>{item.icon}</f:format.raw> {item.label} - </a> - </f:then> - <f:else> - <f:if condition="{item.module}"> - <f:then> - <a target="content" data-module="{item.module}" class="dropdown-list-link tx-workspaces-modulelink"> - <f:format.raw>{item.icon}</f:format.raw> {item.label} - </a> - </f:then> - <f:else> - <f:format.raw>{item.icon}</f:format.raw> {item.label} - </f:else> - </f:if> - </f:else> - </f:if> - </li> - </f:for> - </f:for> -</ul> \ No newline at end of file -- GitLab