Project

General

Profile

Feature #17500 » irre_Localized_2007-09-27.diff

Administrator Admin, 2007-09-27 01:10

View differences:

TYPO3core.irreLocalized/t3lib/class.t3lib_tceforms_inline.php 2007-09-27 00:18:20.890323871 +0200
*/
function getSingleField_typeInline($table,$field,$row,&$PA) {
// check the TCA configuration - if false is returned, something was wrong
if ($this->checkConfiguration($PA['fieldConf']['config']) === false) return false;
if ($this->checkConfiguration($PA['fieldConf']['config'], $row) === false) return false;
// count the number of processed inline elements
$this->inlineCount++;
......
// e.g. inline[<pid>][<table1>][<uid1>][<field1>][<table2>][<uid2>][<field2>]
$nameObject = $this->inlineNames['object'];
// get the records related to this inline record
$recordList = $this->getRelatedRecords($table,$field,$row,$PA,$config);
$parentLangField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
$langField = $GLOBALS['TCA'][$foreign_table]['ctrl']['languageField'];
$langParent = $GLOBALS['TCA'][$foreign_table]['ctrl']['transOrigPointerField'];
// When either "original" or "inherit" mode is set and we are processing an alternate
// language record ($row[$parentLangField] / $row['sys_languge_uid'] is set) we do not
// use the ID's of the records of the current IRRE container but rather those of it's
// language parent.
if (($config['languageMode']=='original'||$config['languageMode']=='inherit')&&$langField&&$parentLangField&&$row[$parentLangField]&&$row[$langParent]) {
// Fetch language parent
$parentRec = $this->getRecord(0, $table, $row[$langParent]);
if ($parentRec) {
$cpPA = $PA;
$cpPA['itemFormElValue'] = $parentRec[$field];
$recordList = $this->getRelatedRecords($table,$field,$row,$cpPA,$config);
// When inherit mode is set, set a flag in $config so the buttons for
// creating new, deleteing, and moving around IRRE records get disables
// The sort-order and everything else is defined in the main-language
if ($config['languageMode']=='inherit') {
$config['appearance']['isInherited'] = 1;
}
}
// How shall we handle the case when a translated record has a l18n_parent set but the referenced
// record is not available any more ???
} else {
$recordList = $this->getRelatedRecords($table,$field,$row,$PA,$config);
}
// set the first and last record to the config array
$config['inline']['first'] = $recordList[0]['uid'];
$config['inline']['last'] = $recordList[count($recordList)-1]['uid'];
......
$isPagesTable = $foreign_table == 'pages' ? true : false;
$isOnSymmetricSide = t3lib_loadDBGroup::isOnSymmetricSide($parentUid, $config, $rec);
$enableManualSorting = $tcaTableCtrl['sortby'] || $config['MM'] || (!$isOnSymmetricSide && $config['foreign_sortby']) || ($isOnSymmetricSide && $config['symmetric_sortby']) ? true : false;
$enableManualSorting &= !$config['appearance']['isInherited'];
$nameObjectFt = $this->inlineNames['object'].'['.$foreign_table.']';
$nameObjectFtId = $nameObjectFt.'['.$rec['uid'].']';
......
// "Hide/Unhide" links:
$hiddenField = $tcaTableCtrl['enablecolumns']['disabled'];
if ($permsEdit && $hiddenField && $tcaTableCols[$hiddenField] && (!$tcaTableCols[$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$foreign_table.':'.$hiddenField))) {
if (!$config['appearance']['isInherited'] && $permsEdit && $hiddenField && $tcaTableCols[$hiddenField] && (!$tcaTableCols[$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$foreign_table.':'.$hiddenField))) {
$onClick = "return inline.enableDisableRecord('".$nameObjectFtId."')";
if ($rec[$hiddenField]) {
$cells[]='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
......
}
// "Delete" link:
if (
($isPagesTable && ($localCalcPerms&4)) || (!$isPagesTable && ($calcPerms&16))
) {
if ( !$config['appearance']['isInherited'] && (($isPagesTable && ($localCalcPerms&4)) || (!$isPagesTable && ($calcPerms&16)))) {
$onClick = "inline.deleteRecord('".$nameObjectFtId."');";
$cells[]='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')).')) { '.$onClick.' } return false;').'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:delete',1).'" alt="" />'.
......
$record[$config['foreign_selector']] .= $foreignUid;
}
// Get some values into local variables
$parentLangField = $GLOBALS['TCA'][$parent['table']]['ctrl']['languageField'];
$langField = $GLOBALS['TCA'][$current['table']]['ctrl']['languageField'];
$langMode = $config['languageMode'];
// When records get created in "separate" mode additionally set the languagePointer fields
// (usualy "sys_language_uid") of the newly created record to the correct langauge.
if ($langField && ($langMode=='separate') && $parentLangField) {
$parentRec = $this->getRecord(0, $parent['table'], $parent['uid']);
$record[$langField] = $parentRec[$parentLangField];
}
// We will never create records this way when IRRE records are set to be inherited - they
// get created by the "localize" method of TCEmain
if ($langField && ($langMode=='inherit') && $parentLangField) {
$parentRec = $this->getRecord(0, $parent['table'], $parent['uid']);
if ($parentRec[$parentLangField]) {
$jsonArray = array(
'data' => 'Access denied',
'scriptCall' => array(
"alert('Access denied');",
)
);
return t3lib_div::array2json($jsonArray);
}
}
// the HTML-object-id's prefix of the dynamically created record
$objectPrefix = $this->inlineNames['object'].'['.$current['table'].']';
$objectId = $objectPrefix.'['.$record['uid'].']';
......
// Perform modification of the selected items array:
$itemArray = t3lib_div::trimExplode(',',$PA['itemFormElValue'],1);
$ftable = $config['foreign_table'];
$parentLangField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
$langField = $GLOBALS['TCA'][$ftable]['ctrl']['languageField'];
$langParent = $GLOBALS['TCA'][$ftable]['ctrl']['transOrigPointerField'];
$langMode = $config['languageMode'];
foreach($itemArray as $tk => $tv) {
$tvP = explode('|',$tv,2);
// get the records for this uid using t3lib_transferdata
$records[] = $this->getRecord($row['pid'], $config['foreign_table'], $tvP[0]);
$rec = $this->getRecord($row['pid'], $ftable, $tvP[0]);
if (!($langField && $langMode && $parentLangField)) {
// No translation at all
$records[] = $rec;
} else {
switch ($langMode) {
case 'original':
// Return the record if it is default language or for ALL
if ($rec[$langField]<=0) {
$records[] = $rec;
}
break;
case 'inherit':
if ($rec[$langField]==-1) {
// Return the record if it is for ALL
$records[] = $rec;
} elseif ($rec[$langField]==0) {
if ($row[$parentLangField]==0) {
// Return the record if it is for default languge
// and its container is also default language
$records[] = $rec;
} else {
// When the container is an alternative language
// then fetch the translated record for the current one
list($transRec) = t3lib_BEfunc::getRecordsByField($ftable, $langParent, $rec['uid']);
if (is_array($transRec)) {
$records[] = $transRec;
} else {
// When there is no translated record for the current one - then
// localize it from the current one.
$cmd = array();
$cmd[$ftable][$rec['uid']]['localize'] = $row['sys_language_uid'];
$tcemain = t3lib_div::makeInstance('t3lib_TCEmain');
$tcemain->start(array(), $cmd);
$tcemain->process_cmdmap();
list($transRec) = t3lib_BEfunc::getRecordsByField($ftable, $langParent, $rec['uid']);
if (is_array($transRec)) {
$records[] = $transRec;
}
}
}
}
break;
case 'separate':
default:
// Return IRRE record Only if the currently prcesses records language is
// the same as the language of the container it is in
if (($rec[$langField]==$row[$parentLangField])||($rec[$langField]==-1)) {
$records[] = $rec;
}
break;
}
}
}
return $records;
......
* @param array $config: Reference to the TCA field configuration
* @return boolean If critical configuration errors were found, false is returned
*/
function checkConfiguration(&$config) {
function checkConfiguration(&$config, $row) {
$foreign_table = $config['foreign_table'];
// An inline field must have a foreign_table, if not, stop all further inline actions for this field:
......
$config['appearance'] = array();
}
// Set the position/appearance of the "Create new record" link:
if ($config['foreign_selector'] && !$config['appearance']['useCombination']) {
if (($row['sys_language_uid'] && $config['languageMode']=='inherit') || ($config['foreign_selector'] && !$config['appearance']['useCombination'])) {
$config['appearance']['newRecordLinkPosition'] = 'none';
} elseif (!in_array($config['appearance']['newRecordLinkPosition'], array('top', 'bottom', 'both', 'none'))) {
$config['appearance']['newRecordLinkPosition'] = 'top';
TYPO3core.irreLocalized/t3lib/class.t3lib_tceforms.php 2007-09-26 22:08:26.262133324 +0200
foreach ($out_array as $idx => $sheetContent) {
$resstr = implode('', $sheetContent);
if ($resstr) {
$parts[] = array(
$parts[$idx] = array(
'label' => $out_array_meta[$idx]['title'],
'content' => '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.
$resstr.
TYPO3core.irreLocalized/t3lib/class.t3lib_tcemain.php 2007-09-27 00:14:38.741664340 +0200
if ($tcaFieldConf['foreign_field']) {
// if the record was imported, sorting was also imported, so skip this
$skipSorting = $this->callFromImpExp ? true : false;
// When IRRE langugae mode is set to "original" and we have a translated
// container then set the ID to the UID of the containers l18n_parent.
if ($tcaFieldConf['languageMode']=='original') {
$langField = $GLOBALS['TCA'][$currentTable]['ctrl']['languageField'];
$langParent = $GLOBALS['TCA'][$currentTable]['ctrl']['transOrigPointerField'];
$origRec = t3lib_BEfunc::getRecordWSOL($currentTable, $id);
if ($origRec[$langField]&&$origRec[$langParent]) {
$id = $origRec[$langParent];
}
}
// update record in intermediate table (sorting & pointer uid to parent record)
$dbAnalysis->writeForeignField($tcaFieldConf, $id, 0, $skipSorting);
$valueArray = $dbAnalysis->countItems();
(1-1/4)