diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php index c5495b85983a54bdad69617eb490e4bcd67fa2dd..ffdefd316e5aacd50e1ec221e54d2e6c4b4d563a 100644 --- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php +++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php @@ -729,7 +729,7 @@ class PageLayoutController $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', ' if (top.fsMod) { top.fsMod.recentIds["web"] = ' . (int)$this->id . '; - top.fsMod.navFrameHighlightedID["web"] = "pages' . (int)$this->id . '_"+top.fsMod.currentBank; + top.fsMod.navFrameHighlightedID["web"] = top.fsMod.currentBank + "_" + ' . (int)$this->id . '; } ' . ($this->popView ? BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id)) : '') . ' function deleteRecord(table,id,url) { // diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js index c53d3b99ecacea28607a4c0b545f4b65a4a6a7fd..fcfbac76039088a312757471b53ef2dc1c237bf9 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js @@ -55,6 +55,7 @@ define(['jquery', _this.dispatch.on('nodeRightClick.pageTree', _this.nodeRightClick); _this.dispatch.on('contextmenu.pageTree', _this.contextmenu); _this.dispatch.on('updateSvg.pageTree', _this.updateSvg); + _this.dispatch.on('prepareLoadedNode.pageTree', _this.prepareLoadedNode); _this.dragDrop = PageTreeDragDrop; _this.dragDrop.init(_this); @@ -186,12 +187,16 @@ define(['jquery', * @param {Node} node */ PageTree.prototype.nodeSelectedAfter = function(node) { + //remember the selected page in the global state + fsMod.recentIds.web = node.identifier; + fsMod.currentBank = node.stateIdentifier.split('_')[0]; + fsMod.navFrameHighlightedID.web = node.stateIdentifier; + var separator = '?'; if (currentSubScript.indexOf('?') !== -1) { separator = '&'; } - fsMod.recentIds.web = node.identifier; TYPO3.Backend.ContentContainer.setUrl( currentSubScript + separator + 'id=' + node.identifier ); @@ -233,6 +238,18 @@ define(['jquery', .attr('data-context', 'tree'); }; + /** + * Event listener called for each loaded node, + * here used to mark node remembered in fsMode as selected + * + * @param node + */ + PageTree.prototype.prepareLoadedNode = function(node) { + if (node.stateIdentifier === fsMod.navFrameHighlightedID.web) { + node.checked = true; + } + }; + PageTree.prototype.hideChildren = function(node) { _super_.hideChildren(node); Persistent.set('BackendComponents.States.Pagetree.stateHash.' + node.stateIdentifier, 0); @@ -274,6 +291,35 @@ define(['jquery', return nodes; }; + /** + * Node selection logic (triggered by different events) + * Page tree supports only one node to be selected at a time + * so the default function from SvgTree needs to be overriden + * + * @param {Node} node + */ + PageTree.prototype.selectNode = function (node) { + if (!this.isNodeSelectable(node)) { + return; + } + + var _this = this; + var checked = node.checked; + + var selectedNodes = this.getSelectedNodes(); + selectedNodes.forEach(function (node) { + if (node.checked === true) { + node.checked = false; + _this.dispatch.call('nodeSelectedAfter', _this, node); + } + }); + + node.checked = true; + + this.dispatch.call('nodeSelectedAfter', this, node); + this.update(); + }; + /** * Event handler for double click on a node's label * Changed text position if there is 'stop page tree' option diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js index dff70fc55381efa289effd73d3d40e669c6c8714..f468927d626b8c879c457e83b48b7b5beb729ea4 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js @@ -568,7 +568,6 @@ define( _this.nodeBgEvents().mouseOut(node, this); }) .on('click', function(node) { - _this.nodeBgEvents().click(node, this); _this.selectNode(node); }) .on('contextmenu', function(node) { @@ -612,25 +611,6 @@ define( } }; - self.click = function(node, element) { - var $nodeBg = $(element).closest('svg').find('.nodes-bg .node-bg[data-state-id=' + node.stateIdentifier + ']'); - - _this.nodes.forEach(function(node) { - if (node.selected === true) { - node.selected = false; - } - }); - - node.selected = true; - if ($nodeBg.length) { - $nodeBg.addClass('node-selected') - .parents('svg') - .find('.node-selected') - .not($nodeBg) - .removeClass('node-selected'); - } - }; - return self; }, @@ -882,7 +862,7 @@ define( nextNode = nodeBgClass.data()[i + 1]; } - if (node.selected) { + if (node.checked) { bgClass += ' node-selected'; } @@ -1113,7 +1093,6 @@ define( */ clickOnLabel: function(node, element) { this.selectNode(node); - this.nodeBgEvents().click(node, element); }, /** diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/backend.js b/typo3/sysext/backend/Resources/Public/JavaScript/backend.js index db65a90f79b6ac559eeb51c7535f67dd8b3b7fe1..64e214d9d73ad04fe7bea6aa776b702d4b652574 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/backend.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/backend.js @@ -97,7 +97,7 @@ function openUrlInWindow(url, windowName) { // */ function loadEditId(id, addGetVars) { // top.fsMod.recentIds.web = id; - top.fsMod.navFrameHighlightedID.web = "pages" + id + "_0"; // For highlighting + top.fsMod.navFrameHighlightedID.web = '0_' + id; // For highlighting if (top.nav_frame && top.nav_frame.refresh_nav) { top.nav_frame.refresh_nav(); diff --git a/typo3/sysext/recordlist/Classes/Controller/RecordListController.php b/typo3/sysext/recordlist/Classes/Controller/RecordListController.php index 42c519902f7e59507841b47cfe85260eee1b5550..84617ae8db532a12d44ba7ab4e786d3f2979ec39 100644 --- a/typo3/sysext/recordlist/Classes/Controller/RecordListController.php +++ b/typo3/sysext/recordlist/Classes/Controller/RecordListController.php @@ -390,12 +390,12 @@ class RecordListController $this->moduleTemplate->addJavaScriptCode( 'RecordListInlineJS', ' - function jumpExt(URL,anchor) { // + 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) { // + function jumpSelf(URL) { window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:""); return false; } @@ -404,9 +404,9 @@ class RecordListController return false; } - function setHighlight(id) { // - top.fsMod.recentIds["web"]=id; - top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting + function setHighlight(id) { + top.fsMod.recentIds["web"] = id; + top.fsMod.navFrameHighlightedID["web"] = top.fsMod.currentBank + "_" + id; // For highlighting if (top.nav_frame && top.nav_frame.refresh_nav) { top.nav_frame.refresh_nav(); @@ -414,10 +414,10 @@ class RecordListController } ' . $this->moduleTemplate->redirectUrls($listUrl) . ' ' . $dblist->CBfunctions() . ' - function editRecords(table,idList,addParams,CBflag) { // + function editRecords(table,idList,addParams,CBflag) { window.location.href="' . (string)$uriBuilder->buildUriFromRoute('record_edit', ['returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]) . '&edit["+table+"]["+idList+"]=edit"+addParams; } - function editList(table,idList) { // + function editList(table,idList) { var list=""; // Checking how many is checked, how many is not diff --git a/typo3/sysext/sys_action/Classes/ActionTask.php b/typo3/sysext/sys_action/Classes/ActionTask.php index 3d6ffee474b8b2484b30eeb5cff951e26a8aaaab..883b1583600503c13aeb3dd669bef3c12d701fa9 100644 --- a/typo3/sysext/sys_action/Classes/ActionTask.php +++ b/typo3/sysext/sys_action/Classes/ActionTask.php @@ -940,8 +940,8 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface } function setHighlight(id) { - top.fsMod.recentIds["web"]=id; - top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting + top.fsMod.recentIds["web"] = id; + top.fsMod.navFrameHighlightedID["web"] = top.fsMod.currentBank + "_" + id; // For highlighting if (top.nav_frame && top.nav_frame.refresh_nav) { top.nav_frame.refresh_nav();