Project

General

Profile

Feature #17606 » PageTS_LOCALLANG_v1.patch

Administrator Admin, 2007-10-09 21:02

View differences:

D:/workspace-typo3/typo3/typo3_src-svn/t3lib/class.t3lib_tceforms.php (working copy)
var $defaultLanguageData = array(); // Array where records in the default language is stored. (processed by transferdata)
var $defaultLanguageData_diff = array(); // Array where records in the default language is stored (raw without any processing. used for making diff)
var $additionalPreviewLanguageData = array();
var $LLLconf; //Saves all LOCALLANG-Configurations
// EXTERNAL, static
var $backPath=''; // Set this to the 'backPath' pointing back to the typo3 admin directory from the script where this form is displayed.
var $returnUrl=''; // Alternative return URL path (default is t3lib_div::linkThisScript())
......
function getMainFields($table,$row,$depth=0) {
global $TCA, $TYPO3_CONF_VARS;
$this->renderDepth=$depth;
$this->renderDepth=$depth;
$this->registerLLL($table,$row);
// Init vars:
$out_array = array(array());
$out_array_meta = array(array(
......
* @return string The value of the label, fetched for the current backend language.
*/
function sL($str) {
return $GLOBALS['LANG']->sL($str);
$postProcess = false;
if (count($this->LLLconf) > 0 && is_array($this->LLLconf)) {
$tempStr = explode(":",$str);
$LLfile = $tempStr[0].":".$tempStr[1].":".$tempStr[2];
if (array_key_exists($LLfile,$this->LLLconf)) {
$postProcess = true;
foreach($this->LLLconf[$LLfile] AS $action => $properties) {
$str = $this->preProcessLLL($LLfile,$str,$properties,$action);
}
}
}
$str = $GLOBALS['LANG']->sL($str);
if ($postProcess) {
foreach($this->LLLconf[$LLfile] AS $action => $properties) {
$str = $this->postProcessLLL($LLfile,$str,$properties,$action);
}
}
return $str;
}
/**
......
return $content;
}
/**
* Registers the Locallang-Configurations.
*
* @param String $table
* @param Array $row
*/
function registerLLL($table,$row) {
if (empty($this->LLLconf)) {
$this->LLLconf = array();
list($TScID,$cPid) = t3lib_BEfunc::getTSCpid($table,$row['uid'],$row['pid']);
$rootLine = t3lib_BEfunc::BEgetRootLine($TScID,'',TRUE);
if ($TScID >= 0) {
$tempTSconfig = t3lib_BEfunc::getPagesTSconfig($TScID,$rootLine);
$tempConf = $GLOBALS['BE_USER']->getTSConfig('TCEFORM.LOCALLANG',$tempTSconfig);
if (count($tempConf["properties"]) > 0 && is_array($tempConf["properties"])) {
foreach (array_keys($tempConf["properties"]) AS $key) {
if (preg_match('|^[0-9+]$|',$key)) {
$TSConfig = $GLOBALS['BE_USER']->getTSConfig("TCEFORM.LOCALLANG.{$key}",$tempTSconfig);
if ($this->isLLLformat($TSConfig["value"])) {
$this->LLLconf[$TSConfig["value"]] = $TSConfig["properties"];
}
}
}
}
}
}
}
/**
* Function for checking a String for the LLL-Format
*
* @param String $value
* @return Boolean
*/
function isLLLformat($value) {
return preg_match('|^LLL\:EXT\:(.+)\/locallang(.*)\.([a-z]{3})(.*)$|',$value);
}
/**
* PreProcessing Actions for the Locallang
*
* @param String $LLfile
* @param String $str
* @param Mixed $properties
* @param String $action
* @return String
*/
function preProcessLLL($LLfile,$str,$properties,$action) {
switch ($action) {
case 'replace':
return $this->preProcessLLL_replace($LLfile,$str,$properties);
}
return $str;
}
/**
* PostProcessing Actions for the Locallang
*
* @param String $LLfile
* @param String $str
* @param Mixed $properties
* @param String $action
* @return String
*/
function postProcessLLL($LLfile,$str,$properties,$action) {
return $str;
}
/**
* The Function replaces a LL-File with a new one
*
* @param String $LLfile
* @param String $str
* @param Mixed $properties
* @return String
*/
function preProcessLLL_replace($LLfile,$str,$properties) {
if ($this->isLLLformat($properties)) {
$newstr = $properties.":".substr($str,strlen($LLfile)+1);
$newstr_sL = parent::sL($newstr);
$str = (empty($newstr_sL) ? $str : $newstr);
}
return $str;
}
/**
* Returns true, if the palette, $palette, is collapsed (not shown, but found in top-frame) for the table.
*
* @param string The table name
(3-3/4)