[BUGFIX] Check minitems for TCAtree
authorGeorg Ringer <mail@ringerge.org>
Tue, 3 Jan 2012 14:36:44 +0000 (15:36 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Tue, 14 Feb 2012 06:18:50 +0000 (07:18 +0100)
The TCAtree ignores currently the minitems.
This is however e.g. needed to require input for a relation field.

Change-Id: Id972b0e065adf7e0702a8d8f85c469c7fe9ac827
Resolves: #25003
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7662
Reviewed-by: Philipp Gampe
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/class.t3lib_tceforms.php
t3lib/tceforms/class.t3lib_tceforms_tree.php
typo3/jsfunc.tbe_editor.js

index 23054bc..e197b2b 100644 (file)
@@ -1465,6 +1465,10 @@ class t3lib_TCEforms {
                } elseif (!strcmp($config['renderMode'], 'tree')) { // Tree renderMode
                        $treeClass = t3lib_div::makeInstance('t3lib_TCEforms_Tree', $this);
                        $item = $treeClass->renderField($table, $field, $row, $PA, $config, $selItems, $nMV_label);
+
+                               // Register the required number of elements
+                       $minitems = t3lib_utility_Math::forceIntegerInRange($config['minitems'], 0);
+                       $this->registerRequiredProperty('range', $PA['itemFormElName'], array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field));
                } else { // Traditional multiple selector box:
                        $item = $this->getSingleField_typeSelect_multiple($table, $field, $row, $PA, $config, $selItems, $nMV_label);
                }
index 8e56214..aeef1c2 100644 (file)
@@ -214,7 +214,7 @@ class t3lib_TCEforms_Tree {
 
                $formField = '
                        <div class="typo3-tceforms-tree">
-                               <input type="hidden" name="' . htmlspecialchars($PA['itemFormElName']) . '" id="treeinput' . $id . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />
+                               <input class="treeRecord" type="hidden" name="' . htmlspecialchars($PA['itemFormElName']) . '" id="treeinput' . $id . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />
                        </div>
                        <div id="tree_' . $id . '">
 
@@ -229,4 +229,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['classes/t3lib/tceforms/class.t3lib_tceforms_tree.php']);
 }
 
-?>
\ No newline at end of file
+?>
index f3357bb..ab9ad1a 100644 (file)
@@ -220,7 +220,7 @@ var TBE_EDITOR = {
                                if (!form) {
                                                // special treatment for IRRE fields:
                                        var tempObj = document[TBE_EDITOR.formname][elementName];
-                                       if (tempObj && Element.hasClassName(tempObj, 'inlineRecord')) {
+                                       if (tempObj && (Element.hasClassName(tempObj, 'inlineRecord') || Element.hasClassName(tempObj, 'treeRecord'))) {
                                                form = tempObj.value ? tempObj.value.split(',') : [];
                                                numberOfElements = form.length;
                                        }