[CLEANUP] Fix TCA tree the same as in TYPO3_4-5
authorHelmut Hummel <helmut.hummel@typo3.org>
Fri, 29 Apr 2011 15:37:06 +0000 (17:37 +0200)
committerHelmut Hummel <typo3@helmut-hummel.de>
Fri, 29 Apr 2011 16:06:24 +0000 (18:06 +0200)
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
t3lib/tceforms/class.t3lib_tceforms_tree.php

index b19cfdb..95ff4b2 100644 (file)
@@ -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');
index cb201bf..d20b389 100644 (file)
@@ -66,7 +66,7 @@ class t3lib_TCEforms_Tree {
                $valueArray = array();
                $selectedNodes = array();
 
-               if($PA['itemFormElValue'] != 0) {
+               if(!empty($PA['itemFormElValue'])) {
                        $valueArray = explode(',', $PA['itemFormElValue']);
                }