From 06711c2cce8ff87397b373810b1ac6fd13aa6e2c Mon Sep 17 00:00:00 2001 From: Helmut Hummel Date: Fri, 29 Apr 2011 17:37:06 +0200 Subject: [PATCH] [CLEANUP] Fix TCA tree the same as in TYPO3_4-5 The TCA tree feature did not work when setting maxitems=1 in the TCA. This bug has been fixed in master in 290529a75647fe2bf6847638763e50348631e906 and in TYPO3_4-5 branch 3019ca92f55faf650ad5981a001e323a2e91eab6 but the solution is different. Use the same solution as is TYPO3_4-5 because it is cleaner: * Check for empty() value instead of comparing with 0 in t3lib/tceforms/class.t3lib_tceforms_tree.php * Do not recalculate the number of checked items only if a new item is checked and the maximum item count is reached instead of always recalculating the item count in t3lib/js/extjs/tree/tree.js Resolves: #25347 Releases: 4.6 Change-Id: I1b55960f9c26f57aa05d6a95a9980798c06e8316 Reviewed-on: http://review.typo3.org/1804 Reviewed-by: Helmut Hummel Tested-by: Helmut Hummel --- t3lib/js/extjs/tree/tree.js | 5 +++-- t3lib/tceforms/class.t3lib_tceforms_tree.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/t3lib/js/extjs/tree/tree.js b/t3lib/js/extjs/tree/tree.js index b19cfdb671c1..95ff4b24bb4e 100644 --- a/t3lib/js/extjs/tree/tree.js +++ b/t3lib/js/extjs/tree/tree.js @@ -211,10 +211,11 @@ TYPO3.Components.Tree.TcaCheckChangeHandler = function(checkedNode, checked) { } } - if (this.countSelectedNodes >= this.tcaMaxItems) { + if (checked === true && this.countSelectedNodes >= this.tcaMaxItems) { checkedNode.attributes.checked = false; checkedNode.getUI().toggleCheck(false); - checked = false; + this.resumeEvents(); + return false; } if (checked) { checkedNode.getUI().addClass('complete'); diff --git a/t3lib/tceforms/class.t3lib_tceforms_tree.php b/t3lib/tceforms/class.t3lib_tceforms_tree.php index cb201bfdd660..d20b3893e8a4 100644 --- a/t3lib/tceforms/class.t3lib_tceforms_tree.php +++ b/t3lib/tceforms/class.t3lib_tceforms_tree.php @@ -66,7 +66,7 @@ class t3lib_TCEforms_Tree { $valueArray = array(); $selectedNodes = array(); - if($PA['itemFormElValue'] != 0) { + if(!empty($PA['itemFormElValue'])) { $valueArray = explode(',', $PA['itemFormElValue']); } -- 2.20.1