diff --git a/Classes/ViewHelpers/Backend/ControlViewHelper.php b/Classes/ViewHelpers/Backend/ControlViewHelper.php index c6a3fadcd87889ed0c87256ee1299a5cfadd3b64..63cbf47bdb96b5fce815f4b37c62b96efc8ccb0f 100644 --- a/Classes/ViewHelpers/Backend/ControlViewHelper.php +++ b/Classes/ViewHelpers/Backend/ControlViewHelper.php @@ -32,6 +32,8 @@ use TYPO3\CMS\Backend\Clipboard\Clipboard; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Localization\LanguageService; +use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList; @@ -72,6 +74,12 @@ class ControlViewHelper extends AbstractViewHelper { $backendUser = $GLOBALS['BE_USER']; $pageInfo = BackendUtility::readPageAccess($row['pid'], $backendUser->getPagePermsClause(1)); $databaseRecordList->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageInfo); + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); + $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/AjaxDataHandler'); + $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf'); + $languageService = GeneralUtility::makeInstance(LanguageService::class); + $languageService->includeLLFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf'); + $databaseRecordList->currentTable = $sortingData; if ($table === 'pages') { $databaseRecordList->searchLevels = 1; @@ -87,16 +95,9 @@ class ControlViewHelper extends AbstractViewHelper { } if ($table === 'pages' && LicensingService::checkKey()) { - $rootline = BackendUtility::BEgetRootLine($row['uid'], '', TRUE); - ksort($rootline); - $path = '/root'; - foreach ($rootline as $page) { - $path .= '/p' . dechex($page['uid']); - } - $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $buttonLabel = LocalizationUtility::translate('backend.button.editPageContent', 'SgNews'); - $onclick = 'return sgNewsGoToPageModule(' . $row['uid'] . ', \'' . $path . '\');'; + $onclick = 'return TYPO3.SgNewsModule.sgNewsGoToPageModule(' . $row['uid'] . ');'; $icon = $iconFactory->getIcon('actions-document-open-white', Icon::SIZE_SMALL)->render(); $wrap = ' <div class="btn-group" role="group">%s</div>'; $link = '<a href="#" onclick="' . $onclick . '" class="btn btn-primary" title="' . $buttonLabel . '">%s</a>'; diff --git a/Resources/Private/Layouts/Backend.html b/Resources/Private/Layouts/Backend.html index a97ecad22e05f11bdb74c78cfb024cd7ba9c57a6..f7ba56b6bd7cff88ca9da8de2dab905416eb49e6 100644 --- a/Resources/Private/Layouts/Backend.html +++ b/Resources/Private/Layouts/Backend.html @@ -3,12 +3,9 @@ <f:be.container includeRequireJsModules="{ - 0: 'TYPO3/CMS/Backend/AjaxDataHandler', - 1: 'TYPO3/CMS/Backend/ContextMenu', - 2: 'TYPO3/CMS/Backend/Tooltip', - 3: 'TYPO3/CMS/Recordlist/Tooltip', - 4: 'TYPO3/CMS/SgNews/Backend'}" - includeJsFiles="{0: '{f:uri.resource(path: \'Scripts/Backend.js\')}'}"> + 0: 'TYPO3/CMS/Backend/ContextMenu', + 1: 'TYPO3/CMS/Backend/Tooltip', + 2: 'TYPO3/CMS/SgNews/Backend'}"> <div class="module" data-module-id="" data-module-name=""> <div class="module-docheader t3js-module-docheader"> <div class="module-docheader-bar module-docheader-bar-navigation t3js-module-docheader-bar t3js-module-docheader-bar-navigation"> diff --git a/Resources/Public/JavaScript/Backend.js b/Resources/Public/JavaScript/Backend.js index 512a7758c62e584aea12e911bbcbce99c1880389..06ea6e87c109f4a39dce0e653c096bcc68f6eb0b 100644 --- a/Resources/Public/JavaScript/Backend.js +++ b/Resources/Public/JavaScript/Backend.js @@ -22,7 +22,11 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -define(['jquery'], function($) { +define([ + 'jquery', + 'TYPO3/CMS/Backend/ModuleMenu', + 'TYPO3/CMS/Backend/Viewport' +], function($, ModuleMenu, Viewport) { 'use strict'; var SgNewsModule = { init: function() { @@ -35,83 +39,15 @@ define(['jquery'], function($) { this.form.submit(); }); }, - // functions for backend docheader functionality - jumpExt: function(URL, anchor) { - var anc = anchor ? anchor : ""; - window.location.href = URL + (T3_THIS_LOCATION ? "&returnUrl=" + T3_THIS_LOCATION : "") + anc; - return false; - }, - jumpSelf: function(URL) { - window.location.href = URL + (T3_RETURN_URL ? "&returnUrl=" + T3_RETURN_URL : ""); - return false; - }, - jumpToUrl: function(URL) { - window.location.href = URL; - return false; - }, - setHighlight: function(id) { - top.fsMod.recentIds["web"] = id; - top.fsMod.navFrameHighlightedID["web"] = "pages" + id + "_" + top.fsMod.currentBank; // For highlighting - if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { - top.content.nav_frame.refresh_nav(); - } - }, - /** - * Switches to the spefied page in the BE - * - * @param {number} uid - * @param {string} path - */ - sgNewsGoToPage: function(uid, path, selectOnly) { - parent.fsMod.recentIds['web'] = uid; - if (typeof selectOnly === 'undefined') { - selectOnly = false; - } - selectOnly = Boolean(selectOnly); - if (top.nav) { - if (selectOnly) { - top.nav.invokePageId(uid, SgNewsModule.gotToPageCallbackNoFollow); - } else { - top.nav.invokePageId(uid, SgNewsModule.gotToPageCallback); - } - } else { - var tree = top.Ext.getCmp('typo3-pagetree'); - if (tree) { - tree.activeTree.selectPath(path); + sgNewsGoToPageModule: function(uid) { + ModuleMenu.App.showModule('web_layout', 'id=' + uid); + var pageTreeNodes = Viewport.NavigationContainer.PageTree.instance.nodes; + for (var nodeIndex in pageTreeNodes) { + if (pageTreeNodes[nodeIndex].identifier === uid) { + Viewport.NavigationContainer.PageTree.selectNode(pageTreeNodes[nodeIndex]); + break; } - if (selectOnly) { - return; - } - var separator = '?'; - if (top.currentSubScript.indexOf('?') !== -1) { - separator = '&'; - } - top.TYPO3.Backend.ContentContainer.setUrl( - top.currentSubScript + separator + 'id=' + uid - ); - } - }, - /** - * Callback for page selection in the pagetree without follow - */ - gotToPageCallbackNoFollow: function(path) { - var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree); - callback.apply(this, arguments); - }, - /** - * Callback for page selection in the pagetree - */ - gotToPageCallback: function(path) { - var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree); - callback.apply(this, arguments); - var node = top.nav.getSelected(); - if (node) { - top.TYPO3.Components.PageTree.Actions.singleClick(node, top.TYPO3.Components.PageTree.Tree); } - }, - sgNewsGoToPageModule: function(uid, path) { - SgNewsModule.sgNewsGoToPage(uid, path, true); - parent.TYPO3.ModuleMenu.App.showModule('web_layout'); return false; } }; @@ -121,3 +57,28 @@ define(['jquery'], function($) { SgNewsModule.init(); return SgNewsModule; }); + +// functions for backend docheader functionality +function jumpExt(URL, anchor) { + var anc = anchor ? anchor : ""; + window.location.href = URL + (T3_THIS_LOCATION ? "&returnUrl=" + T3_THIS_LOCATION : "") + anc; + return false; +} + +function jumpSelf(URL) { + window.location.href = URL + (T3_RETURN_URL ? "&returnUrl=" + T3_RETURN_URL : ""); + return false; +} + +function jumpToUrl(URL) { + window.location.href = URL; + return false; +} + +function setHighlight(id) { + top.fsMod.recentIds["web"] = id; + top.fsMod.navFrameHighlightedID["web"] = "pages" + id + "_" + top.fsMod.currentBank; // For highlighting + if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { + top.content.nav_frame.refresh_nav(); + } +} diff --git a/ext_tables.php b/ext_tables.php index 8b9a4f60a6621be434eb87d8ebeb34ca33c6fbad..07f142cb89c3046d970de33b41160f2e2914cd76 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -41,6 +41,7 @@ if (TYPO3_MODE === 'BE') { 'access' => 'user,group', 'icon' => 'EXT:sg_news/Resources/Public/Icons/module-sgnews.svg', 'labels' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang.xlf', + 'navigationComponentId' => 'TYPO3/CMS/Backend/PageTree/PageTreeElement' ] ); }