Added feature #5242: IRRE - Storage page for child records
authorOliver Hader <oliver.hader@typo3.org>
Mon, 4 Feb 2008 09:06:48 +0000 (09:06 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 4 Feb 2008 09:06:48 +0000 (09:06 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3047 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms_inline.php
t3lib/class.t3lib_tcemain.php

index bd09cbb..47d1a04 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-2008-02-02  Dmitry Dulepov  <dmitry@typo3.org>
+2008-02-04  Oliver Hader  <oh@inpublica.de>
+
+       * (feature) Added feature #5242: IRRE - Storage page for child records
+
+2008-02-03  Dmitry Dulepov  <dmitry@typo3.org>
 
        * MSIE fixes for #7336 (by Jeff Segars)
 
index 219bc59..8260913 100755 (executable)
@@ -1496,6 +1496,26 @@ class t3lib_TCEforms_inline {
 
 
        /**
+        * Determines the corrected pid to be used for a new record.
+        * The pid to be used can be defined by a Page TSconfig.
+        *
+        * @param       string          $table: The table name
+        * @param       integer         $parentPid: The pid of the parent record
+        * @return      integer         The corrected pid to be used for a new record
+        */
+       protected function getNewRecordPid($table, $parentPid=null) {
+               $newRecordPid = $this->inlineFirstPid; 
+               $pageTS = t3lib_beFunc::getPagesTSconfig($parentPid, true);
+               if (isset($pageTS['TCAdefaults.'][$table.'.']['pid']) && t3lib_div::testInt($pageTS['TCAdefaults.'][$table.'.']['pid'])) {
+                       $newRecordPid = $pageTS['TCAdefaults.'][$table.'.']['pid'];
+               } elseif (isset($parentPid) && t3lib_div::testInt($parentPid)) {
+                       $newRecordPid = $parentPid;
+               }
+               return $newRecordPid;
+       }
+
+
+       /**
         * Get a single record row for a TCA table from the database.
         * t3lib_transferData is used for "upgrading" the values, especially the relations.
         *
@@ -1508,15 +1528,12 @@ class t3lib_TCEforms_inline {
        function getRecord($pid, $table, $uid, $cmd='') {
                $trData = t3lib_div::makeInstance('t3lib_transferData');
                $trData->addRawData = TRUE;
-               # $trData->defVals = $this->defVals;
                $trData->lockRecords=1;
                $trData->disableRTE = $GLOBALS['SOBE']->MOD_SETTINGS['disableRTE'];
                        // if a new record should be created
                $trData->fetchRecord($table, $uid, ($cmd === 'new' ? 'new' : ''));
                reset($trData->regTableItems_data);
                $rec = current($trData->regTableItems_data);
-               $rec['uid'] = $cmd == 'new' ? uniqid('NEW') : $uid;
-               if ($cmd=='new') $rec['pid'] = $pid;
 
                return $rec;
        }
@@ -1530,7 +1547,10 @@ class t3lib_TCEforms_inline {
         * @return      array           A record row from the database post-processed by t3lib_transferData
         */
        function getNewRecord($pid, $table) {
-               return $this->getRecord($pid, $table, $pid, 'new');
+               $rec = $this->getRecord($pid, $table, $pid, 'new');
+               $rec['uid'] = uniqid('NEW');
+               $rec['pid'] = $this->getNewRecordPid($table, $pid);
+               return $rec;
        }
 
 
index c6da8b0..6bc82f1 100755 (executable)
@@ -3576,8 +3576,9 @@ class t3lib_TCEmain       {
 
                if ($conf['type'] == 'inline')  {
                        $foreign_table = $conf['foreign_table'];
+                       $moveChildrenWithParent = (!isset($conf['behaviour']['disableMovingChildrenWithParent']) || !$conf['behaviour']['disableMovingChildrenWithParent']);
 
-                       if ($foreign_table) {
+                       if ($foreign_table && $moveChildrenWithParent) {
                                $inlineType = $this->getInlineFieldType($conf);
                                if ($inlineType == 'list' || $inlineType == 'field') {
                                        $moveTable = $foreign_table;