Fixed bug #8148: IRRE - Expanded or collapsed state of new child records is not handl...
authorOliver Hader <oliver.hader@typo3.org>
Tue, 22 Apr 2008 15:27:30 +0000 (15:27 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 22 Apr 2008 15:27:30 +0000 (15:27 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3606 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms_inline.php
t3lib/jsfunc.inline.js

index 13dd76f..bcef014 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2008-04-22  Oliver Hader  <oliver@typo3.org>
 
        * Fixed bug #8182: Fatal error on calling sysLog() of lock object if locking method is unknown
+       * Fixed bug #8148: IRRE - Expanded or collapsed state of new child records is not handled correctly
 
 2008-04-22  Dmitry Dulepov  <dmitry@typo3.org>
 
index 635901f..3160d52 100755 (executable)
@@ -2267,7 +2267,7 @@ class t3lib_TCEforms_inline {
         * Update expanded/collapsed states on new inline records if any.
         *
         * @param       array           $uc: The uc array to be processed and saved (by reference)
-        * @param       object          $tce: Instance of TCEmain that saved data before (by reference)
+        * @param       t3lib_TCEmain   $tce: Instance of TCEmain that saved data before (by reference)
         * @return      void
         */
        function updateInlineView(&$uc, &$tce) {
@@ -2278,15 +2278,23 @@ class t3lib_TCEforms_inline {
                                foreach ($topRecords as $topUid => $childElements) {
                                        foreach ($childElements as $childTable => $childRecords) {
                                                $uids = array_keys($tce->substNEWwithIDs_table, $childTable);
-                                               $inlineViewCurrent =& $inlineView[$topTable][$topUid][$childTable];
                                                if (count($uids)) {
+                                                       $newExpandedChildren = array();
                                                        foreach ($childRecords as $childUid => $state) {
                                                                if ($state && in_array($childUid, $uids)) {
                                                                        $newChildUid = $tce->substNEWwithIDs[$childUid];
-                                                                       $inlineViewCurrent[] = $newChildUid;
+                                                                       $newExpandedChildren[] = $newChildUid;
+                                                               }
+                                                       }
+                                                               // Add new expanded child records to UC (if any):
+                                                       if (count($newExpandedChildren)) {
+                                                               $inlineViewCurrent =& $inlineView[$topTable][$topUid][$childTable];
+                                                               if (is_array($inlineViewCurrent)) {
+                                                                       $inlineViewCurrent = array_unique(array_merge($inlineViewCurrent, $newExpandedChildren));
+                                                               } else {
+                                                                       $inlineViewCurrent = $newExpandedChildren;
                                                                }
                                                        }
-                                                       $inlineViewCurrent = array_unique($inlineViewCurrent);
                                                }
                                        }
                                }
index bcb962e..0c43fcc 100755 (executable)
@@ -97,9 +97,11 @@ var inline = {
        },
 
        updateExpandedCollapsedStateLocally: function(objectId, value) {
-               var ucName = 'uc'+this.parseFormElementName('parts', objectId, 3, 2);
+               var ucName = 'uc[inlineView]'+this.parseFormElementName('parts', objectId, 3, 2);
                var ucFormObj = document.getElementsByName(ucName);
-               if (ucFormObj.length) ucFormObj[0].value = value;
+               if (ucFormObj.length) {
+                       ucFormObj[0].value = value;
+               }
        },
 
        createNewRecord: function(objectId, recordUid) {