0005704_v4_trunk.patch

Administrator Admin, 2007-07-06 08:21

Download (6.4 KB)

View differences:

t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie)
157 157
				$inlineView = unserialize($GLOBALS['BE_USER']->uc['inlineView']);
158 158
				$this->inlineView = $inlineView[$table][$row['uid']];
159 159
			}
160
				// if pid is negative, fetch the previous record and take its pid
161
			if ($row['pid'] < 0) {
160
				// If the parent is a page, use the uid(!) of the (new?) page as pid for the child records:
161
			if ($table == 'pages') {
162
				$this->inlineFirstPid = $row['uid'];
163
				// If pid is negative, fetch the previous record and take its pid:
164
			} elseif ($row['pid'] < 0) {
162 165
				$prevRec = t3lib_BEfunc::getRecord($table, abs($row['pid']));
163 166
				$this->inlineFirstPid = $prevRec['pid'];
164
				// take the pid as it is
167
				// Take the pid as it is:
165 168
			} else {
166 169
				$this->inlineFirstPid = $row['pid'];
167 170
			}
......
1294 1297

  
1295 1298
			// If the command is to create a NEW record...:
1296 1299
		if ($cmd=='new') {
1297
			$calcPRec = t3lib_BEfunc::getRecord('pages',$this->inlineFirstPid);
1298
			if(!is_array($calcPRec)) {
1299
				return false;
1300
			}
1301
			$CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);	// Permissions for the parent page
1302
			if ($table=='pages')	{	// If pages:
1303
				$hasAccess = $CALC_PERMS&8 ? 1 : 0; // Are we allowed to create new subpages?
1300
				// If the pid is numerical, check if it's possible to write to this page:
1301
			if (t3lib_div::testInt($this->inlineFirstPid)) {
1302
				$calcPRec = t3lib_BEfunc::getRecord('pages', $this->inlineFirstPid);
1303
				if(!is_array($calcPRec)) {
1304
					return false;
1305
				}
1306
				$CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);	// Permissions for the parent page
1307
				if ($table=='pages')	{	// If pages:
1308
					$hasAccess = $CALC_PERMS&8 ? 1 : 0; // Are we allowed to create new subpages?
1309
				} else {
1310
					$hasAccess = $CALC_PERMS&16 ? 1 : 0; // Are we allowed to edit content on this page?
1311
				}
1312
				// If the pid is a NEW... value, the access will be checked on creating the page:
1313
				// (if the page with the same NEW... value could be created in TCEmain, this child record can neither)
1304 1314
			} else {
1305
				$hasAccess = $CALC_PERMS&16 ? 1 : 0; // Are we allowed to edit content on this page?
1315
				$hasAccess = 1;
1306 1316
			}
1307 1317
		} else {	// Edit:
1308 1318
			$calcPRec = t3lib_BEfunc::getRecord($table,$theUid);
t3lib/class.t3lib_tcemain.php (Arbeitskopie)
333 333
	var $removeFilesStore=array();				// For accumulation of files which must be deleted after processing of all input content
334 334
	var $uploadedFileArray = array();			// Uploaded files, set by process_uploads()
335 335
	var $registerDBList=array();				// Used for tracking references that might need correction after operations
336
	var $registerDBPids=array();				// Used for tracking references that might need correction in pid field after operations (e.g. IRRE)
336 337
	var $copyMappingArray = Array();			// Used by the copy action to track the ids of new pages so subpages are correctly inserted! THIS is internally cleared for each executed copy operation! DO NOT USE THIS FROM OUTSIDE! Read from copyMappingArray_merged instead which is accumulating this information.
337 338
	var $remapStack = array();					// array used for remapping uids and values at the end of process_datamap
338 339
	var $remapStackRecords = array();			// array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)
......
2867 2868
				} else {
2868 2869
					$newId = $this->copyRecord_raw($v['table'], $v['id'], $realDestPid);
2869 2870
				}
2871

  
2872
					// If the current field is set on a page record, update the pid of related child records:
2873
				if ($table == 'pages') {
2874
					$this->registerDBPids[$v['table']][$v['id']] = $uid;
2875
					// If the current field has ancestors that have a field on a page record, update the pid of related child records:
2876
				} elseif (isset($this->registerDBPids[$table][$uid])) {
2877
					$this->registerDBPids[$v['table']][$v['id']] = $this->registerDBPids[$table][$uid];
2878
				}
2879

  
2870 2880
				$dbAnalysis->itemArray[$k]['id'] = $newId;
2871 2881
			}
2872 2882

  
......
4380 4390
	 * @param	string		$value: Field value
4381 4391
	 * @param	integer		$uid: The uid of the ORIGINAL record
4382 4392
	 * @param	string		$table: Table name
4383
	 * @return	string		The value to be updated on the table field in the database
4393
	 * @return	void
4384 4394
	 */
4385 4395
	function remapListedDBRecords_procInline($conf, $value, $uid, $table) {
4386 4396
		$theUidToUpdate = $this->copyMappingArray_merged[$table][$uid];
......
4388 4398
		if ($conf['foreign_table']) {
4389 4399
			$inlineType = $this->getInlineFieldType($conf);
4390 4400

  
4391
			if ($inlineType == 'field') {
4401
			if ($inlineType == 'mm') {
4402
				$this->remapListedDBRecords_procDBRefs($conf, $value, $theUidToUpdate, $table);
4403

  
4404
			} elseif ($inlineType !== false) {
4392 4405
				$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
4393
				$dbAnalysis->start($value, $conf['foreign_table'], $conf['MM'], 0, $table, $conf);
4406
				$dbAnalysis->start($value, $conf['foreign_table'], '', 0, $table, $conf);
4394 4407

  
4395
				$dbAnalysis->writeForeignField($conf, $uid, $theUidToUpdate);
4396
			} elseif ($inlineType == 'mm') {
4397
				$vArray = $this->remapListedDBRecords_procDBRefs($conf, $value, $theUidToUpdate, $table);
4398
			}
4408
					// If the current field is set on a page record, update the pid of related child records:
4409
				if ($table == 'pages') {
4410
					$thePidToUpdate = $theUidToUpdate;
4411
					// If the current field has ancestors that have a field on a page record, update the pid of related child records:
4412
				} elseif (isset($this->registerDBPids[$table][$uid])) {
4413
					$thePidToUpdate = $this->registerDBPids[$table][$uid];
4414
					$thePidToUpdate = $this->copyMappingArray_merged['pages'][$thePidToUpdate];
4415
				}
4416

  
4417
					// Update child records if using pointer fields ('foreign_field'):
4418
				if ($inlineType == 'field') {
4419
					$dbAnalysis->writeForeignField($conf, $uid, $theUidToUpdate);
4420
				}
4421

  
4422
					// Update child records if change to pid is required: 
4423
				if ($thePidToUpdate) {
4424
					$updateValues = array('pid' => $thePidToUpdate);
4425
					foreach ($dbAnalysis->itemArray as $v) {
4426
						if ($v['id'] && $v['table']) {
4427
							$GLOBALS['TYPO3_DB']->exec_UPDATEquery($v['table'], 'uid='.intval($v['id']), $updateValues);
4428
						}
4429
					}
4430
				}
4431
			}			
4399 4432
		}
4400 4433
	}
4401 4434