git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1817 709f56b5-9817-0410-a4d7...
authorKasper Skårhøj <kasper@typo3.org>
Tue, 28 Nov 2006 17:27:00 +0000 (17:27 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Tue, 28 Nov 2006 17:27:00 +0000 (17:27 +0000)
t3lib/class.t3lib_div.php
t3lib/class.t3lib_recordlist.php
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tcemain.php
t3lib/class.t3lib_transl8tools.php [new file with mode: 0755]
typo3/class.db_list_extra.inc
typo3/install/index.php
typo3/sysext/cms/ext_tables.php
typo3/sysext/cms/web_info/class.tx_cms_webinfo_lang.php

index ef926dc..0c11a0a 100755 (executable)
@@ -2767,7 +2767,11 @@ class t3lib_div {
                        }
                        $result.= '</table>';
                } else  {
-                       $result  = false;
+                       $result  = '<table border="1" cellpadding="1" cellspacing="0" bgcolor="white">
+                               <tr>
+                                       <td><font face="Verdana,Arial" size="1" color="red">'.nl2br(htmlspecialchars((string)$array_in)).'<br /></font></td>
+                               </tr>
+                       </table>';      // Output it as a string.
                }
                return $result;
        }
@@ -3847,7 +3851,7 @@ class t3lib_div {
                if (strstr($funcName,':'))      {
                        list($file,$funcRef) = t3lib_div::revExplode(':',$funcName,2);
                        $requireFile = t3lib_div::getFileAbsFileName($file);
-                       if ($requireFile) require_once($requireFile);
+                       if ($requireFile) t3lib_div::requireOnce($requireFile);
                } else {
                        $funcRef = $funcName;
                }
@@ -3938,7 +3942,7 @@ class t3lib_div {
                        if (strstr($classRef,':'))      {
                                list($file,$class) = t3lib_div::revExplode(':',$classRef,2);
                                $requireFile = t3lib_div::getFileAbsFileName($file);
-                               if ($requireFile)       require_once($requireFile);
+                               if ($requireFile)       t3lib_div::requireOnce($requireFile);
                        } else {
                                $class = $classRef;
                        }
@@ -3986,6 +3990,15 @@ class t3lib_div {
         * @return      object          The object
         */
        function &makeInstance($className)      {
+
+                       // Load class file if not found:
+               if (!class_exists($className))  {
+                       if (substr($className,0,6)=='t3lib_')   {
+                               t3lib_div::requireOnce(PATH_t3lib.'class.'.$className.'.php');
+                       }
+               }
+               
+                       // Return object.
                return class_exists('ux_'.$className) ? t3lib_div::makeInstance('ux_'.$className) : new $className;
        }
 
@@ -4031,7 +4044,7 @@ class t3lib_div {
                        } else {
                                $requireFile = t3lib_div::getFileAbsFileName($info['classFile']);
                                if (@is_file($requireFile)) {
-                                       require_once ($requireFile);
+                                       t3lib_div::requireOnce ($requireFile);
                                        $obj = t3lib_div::makeInstance($info['className']);
                                        if (is_object($obj)) {
                                                if(!@is_callable(array($obj,'init')))   {
@@ -4059,6 +4072,16 @@ class t3lib_div {
                }
                return $error;
        }
+       
+       /**
+        * Require a class for TYPO3
+        * Useful to require classes from inside other classes (not global scope). A limited set of global variables are available (see function)
+        */
+       function requireOnce($requireFile)      {
+               global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;
+               
+               require_once ($requireFile);
+       }       
 
        /**
         * Simple substitute for the PHP function mail() which allows you to specify encoding and character set
index 3d5df90..526911e 100755 (executable)
@@ -356,50 +356,9 @@ class t3lib_recordList {
                        '',
                        'sys_language_uid'
                );
-
-                       // icons and language titles:
-               t3lib_div::loadTCA ('sys_language');
-               $flagAbsPath = t3lib_div::getFileAbsFileName($TCA['sys_language']['columns']['flag']['config']['fileFolder']);
-               $flagIconPath = $this->backPath.'../'.substr($flagAbsPath, strlen(PATH_site));
-
-               $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
-               $this->languageIconTitles = array();
-
-                       // Set default:
-               $this->languageIconTitles[0]=array(
-                       'uid' => 0,
-                       'title' => strlen ($this->modSharedTSconfig['properties']['defaultLanguageLabel']) ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'].' ('.$LANG->getLL('defaultLanguage').')' : $LANG->getLL('defaultLanguage'),
-                       'ISOcode' => 'DEF',
-                       'flagIcon' => strlen($this->modSharedTSconfig['properties']['defaultLanguageFlag']) && @is_file($flagAbsPath.$this->modSharedTSconfig['properties']['defaultLanguageFlag']) ? $flagIconPath.$this->modSharedTSconfig['properties']['defaultLanguageFlag'] : null,
-               );
-
-                       // Set "All" language:
-               $this->languageIconTitles[-1]=array(
-                       'uid' => -1,
-                       'title' => $LANG->getLL ('multipleLanguages'),
-                       'ISOcode' => 'DEF',
-                       'flagIcon' => $flagIconPath.'multi-language.gif',
-               );
-
-                       // Find all system languages:
-               $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       '*',
-                       'sys_language',
-                       ''
-               );
-               foreach($sys_languages as $row)         {
-                       $this->languageIconTitles[$row['uid']] = $row;
-
-                       if ($row['static_lang_isocode'])        {
-                               $staticLangRow = t3lib_BEfunc::getRecord('static_languages',$row['static_lang_isocode'],'lg_iso_2');
-                               if ($staticLangRow['lg_iso_2']) {
-                                       $this->languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
-                               }
-                       }
-                       if (strlen ($row['flag'])) {
-                               $this->languageIconTitles[$row['uid']]['flagIcon'] = @is_file($flagAbsPath.$row['flag']) ? $flagIconPath.$row['flag'] : '';
-                       }
-               }
+               
+               $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
+               $this->languageIconTitles = $t8Tools->getSystemLanguages($this->id, $this->backPath);
        }
 
        /**
index 3416b86..40acd6f 100755 (executable)
@@ -203,6 +203,8 @@ class t3lib_TCEforms        {
        var $defStyle = ''; // 'font-family:Verdana;font-size:10px;';
        var $cachedTSconfig = array();
        var $cachedTSconfig_fieldLevel = array();
+       var $cachedLanguageFlag = array();
+       var $cachedAdditionalPreviewLanguages = NULL;
        var $transformedRow = array();
        var $extJSCODE = '';
        var $printNeededJS = array();
@@ -214,6 +216,7 @@ class t3lib_TCEforms        {
        var $titleLen=15;                                       // $BE_USER->uc['titleLen'] but what is default??
        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();
 
 
                // EXTERNAL, static
@@ -2142,7 +2145,7 @@ class t3lib_TCEforms      {
 
                        foreach ($rotateLang as $lKey)  {
                                if (!$langChildren && !$langDisabled)   {
-                                       $item.= '<b>'.$lKey.':</b>';
+                                       $item.= '<b>'.$this->getLanguageIcon($table,$row,'v'.$lKey).$lKey.':</b>';
                                }
 
                                $tabParts = array();
@@ -2421,14 +2424,21 @@ class t3lib_TCEforms    {
                                                                $rowCells['title']= htmlspecialchars($fakePA['fieldConf']['label']);
 
                                                                if (!in_array('DEF',$rotateLang))       {
-                                                                       $defInfo = '<div class="typo3-TCEforms-originalLanguageValue">'.nl2br(htmlspecialchars($editData[$key]['vDEF'])).'&nbsp;</div>';
+                                                                       $defInfo = '<div class="typo3-TCEforms-originalLanguageValue">'.$this->getLanguageIcon($table,$row,0).$this->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf']).'&nbsp;</div>';
                                                                } else {
                                                                        $defInfo = '';
                                                                }
+                                                               
+                                                               if (!$PA['_noEditDEF']) {
+                                                                       $prLang = $this->getAdditionalPreviewLanguages();
+                                                                       foreach($prLang as $prL)        {
+                                                                               $defInfo.= '<div class="typo3-TCEforms-originalLanguageValue">'.$this->getLanguageIcon($table,$row,'v'.$prL['ISOcode']).$this->previewFieldValue($editData[$key]['v'.$prL['ISOcode']], $fakePA['fieldConf']).'&nbsp;</div>';
+                                                                       }
+                                                               }
 
                                                                        // Put row together
                                                                $tRows[]='<tr>
-                                                                       <td nowrap="nowrap" valign="top" class="bgColor5">'.$rowCells['title'].($vDEFkey=='vDEF' ? '' : ' ('.$vDEFkey.')').'</td>
+                                                                       <td nowrap="nowrap" valign="top" class="bgColor5">'.($vDEFkey=='vDEF' ? '' : $this->getLanguageIcon($table,$row,$vDEFkey)).$rowCells['title'].'</td>
                                                                        <td class="bgColor4">'.$rowCells['formEl'].$defInfo.'</td>
                                                                </tr>';
                                                        }
@@ -2836,6 +2846,16 @@ class t3lib_TCEforms     {
                        if ($TCA[$table]['ctrl']['transOrigDiffSourceField'])   {
                                $this->defaultLanguageData_diff[$table.':'.$rec['uid']] = unserialize($rec[$TCA[$table]['ctrl']['transOrigDiffSourceField']]);
                        }
+
+                               // If there are additional preview languages, load information for them also:
+                       $prLang = $this->getAdditionalPreviewLanguages();
+                       foreach($prLang as $prL)        {
+                               $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
+                               $tInfo = $t8Tools->translationInfo($lookUpTable,intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]),$prL['uid']);
+                               if (is_array($tInfo['translations'][$prL['uid']]))      {
+                                       $this->additionalPreviewLanguageData[$table.':'.$rec['uid']][$prL['uid']] = t3lib_BEfunc::getRecordWSOL($lookUpTable, intval($tInfo['translations'][$prL['uid']]['uid']));
+                               }
+                       }
                }
        }
 
@@ -2881,10 +2901,18 @@ class t3lib_TCEforms    {
        function renderDefaultLanguageContent($table,$field,$row,$item) {
                if (is_array($this->defaultLanguageData[$table.':'.$row['uid']]))       {
                        $dLVal = t3lib_BEfunc::getProcessedValue($table,$field,$this->defaultLanguageData[$table.':'.$row['uid']][$field],0,1);
+                       $fCfg = $GLOBALS['TCA'][$table]['columns'][$field];
 
                        if (strcmp($dLVal,''))  {
-                               $item.='<div class="typo3-TCEforms-originalLanguageValue">'.nl2br(htmlspecialchars($dLVal)).'&nbsp;</div>';
+                               $item.='<div class="typo3-TCEforms-originalLanguageValue">'.$this->getLanguageIcon($table,$row,0).$this->previewFieldValue($dLVal,$fCfg).'&nbsp;</div>';
+                       }
+                       
+                       $prLang = $this->getAdditionalPreviewLanguages();
+                       foreach($prLang as $prL)        {
+                               $dlVal = t3lib_BEfunc::getProcessedValue($table,$field,$this->additionalPreviewLanguageData[$table.':'.$row['uid']][$prL['uid']][$field],0,1);
+                               $item.= '<div class="typo3-TCEforms-originalLanguageValue">'.$this->getLanguageIcon($table,$row,'v'.$prL['ISOcode']).$this->previewFieldValue($dlVal, $fCfg).'&nbsp;</div>';
                        }
+                       
                }
 
                return $item;
@@ -5404,6 +5432,116 @@ class t3lib_TCEforms    {
                }
                return $output;
        }
+       
+       /**
+        * Initializes language icons etc.
+        *
+        * param        string  Table name
+        * param        array   Record
+        * param        string  Sys language uid OR ISO language code prefixed with "v", eg. "vDA" 
+        * @return      void
+        */
+       function getLanguageIcon($table,$row,$sys_language_uid) {
+               global $TCA,$LANG;
+
+               $mainKey = $table.':'.$row['uid'];
+
+               if (!isset($this->cachedLanguageFlag[$mainKey]))        {
+                       t3lib_BEfunc::fixVersioningPid($table,$row);
+                       list($tscPID,$thePidValue) = $this->getTSCpid($table,$row['uid'],$row['pid']);
+
+                       $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
+                       $this->cachedLanguageFlag[$mainKey] = $t8Tools->getSystemLanguages($tscPID, $this->backPath);
+               }
+
+                       // Convert sys_language_uid to sys_language_uid if input was in fact a string (ISO code expected then)
+               if (!t3lib_div::testInt($sys_language_uid))     {
+                       foreach($this->cachedLanguageFlag[$mainKey] as $rUid => $cD)    {
+                               if ('v'.$cD['ISOcode']===$sys_language_uid)     {
+                                       $sys_language_uid = $rUid;
+                               }
+                       }
+               }
+
+               return ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] ? '<img src="'.$this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'].'" class="absmiddle" alt="" />' : ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'] ? '['.$this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'].']' : '[LangCode: '.$sys_language_uid.' ?]')).'&nbsp;';
+       }
+
+       /**
+        * Rendering preview output of a field value which is not shown as a form field but just outputted.
+        *
+        * @param       string          The value to output
+        * @param       array           Configuration for field.
+        * @return      string          HTML formatted output
+        */
+       function previewFieldValue($value, $config)     {
+               if ($config['config']['type']==='group' && $config['config']['internal_type'] === 'file')       {
+                       $show_thumbs = TRUE;
+                       $table = 'tt_content';
+
+                               // Making the array of file items:
+                       $itemArray = t3lib_div::trimExplode(',',$value,1);
+
+                               // Showing thumbnails:
+                       $thumbsnail = '';
+                       if ($show_thumbs)       {
+                               $imgs = array();
+                               foreach($itemArray as $imgRead) {
+                                       $imgP = explode('|',$imgRead);
+                                       $imgPath = rawurldecode($imgP[0]);
+
+                                       $rowCopy = array();
+                                       $rowCopy[$field] = $imgPath;
+
+                                               // Icon + clickmenu:
+                                       $absFilePath = t3lib_div::getFileAbsFileName($config['config']['uploadfolder'].'/'.$imgPath);
+
+                                       $fI = pathinfo($imgPath);
+                                       $fileIcon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
+                                       $fileIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/fileicons/'.$fileIcon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].($absFilePath && @is_file($absFilePath) ? ' ('.t3lib_div::formatSize(filesize($absFilePath)).'bytes)' : ' - FILE NOT FOUND!')).'" alt="" />';
+
+                                       $imgs[] = '<span class="nobr">'.t3lib_BEfunc::thumbCode($rowCopy,$table,$field,$this->backPath,'thumbs.php',$config['config']['uploadfolder'],0,' align="middle"').
+                                                               ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon).
+                                                               $imgPath.
+                                                               '</span>';
+                               }
+                               $thumbsnail = implode('<br />',$imgs);
+                       }
+
+                       return $thumbsnail;
+               } else {
+                       return nl2br(htmlspecialchars($value));
+               }
+       }
+
+       /**
+        * Generates and return information about which languages the current user should see in preview, configured by options.additionalPreviewLanguages
+        *
+        * return array Array of additional languages to preview
+        */
+       function getAdditionalPreviewLanguages()        {
+               if (!isset($this->cachedAdditionalPreviewLanguages))    {
+                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.additionalPreviewLanguages'))  {
+                               $uids = t3lib_div::intExplode(',',$GLOBALS['BE_USER']->getTSConfigVal('options.additionalPreviewLanguages'));
+                               foreach($uids as $uid)  {
+                                       if ($sys_language_rec = t3lib_BEfunc::getRecord('sys_language',$uid))   {
+                                               $this->cachedAdditionalPreviewLanguages[$uid] = array('uid' => $uid);
+
+                                               if ($sys_language_rec['static_lang_isocode'] && t3lib_extMgm::isLoaded('static_info_tables'))   {
+                                                       $staticLangRow = t3lib_BEfunc::getRecord('static_languages',$sys_language_rec['static_lang_isocode'],'lg_iso_2');
+                                                       if ($staticLangRow['lg_iso_2']) {
+                                                               $this->cachedAdditionalPreviewLanguages[$uid]['uid'] = $uid;
+                                                               $this->cachedAdditionalPreviewLanguages[$uid]['ISOcode'] = $staticLangRow['lg_iso_2'];
+                                                       }
+                                               }
+                                       }
+                               }
+                       } else {
+                                       // None:
+                               $this->cachedAdditionalPreviewLanguages = array();
+                       }
+               }
+               return $this->cachedAdditionalPreviewLanguages;
+       }
 }
 
 
index 6cf54d6..123fd09 100755 (executable)
@@ -3138,6 +3138,7 @@ class t3lib_TCEmain       {
 
        /**
         * Localizes a record to another system language
+        * In reality it only works if transOrigPointerTable is not set. And it doesn't work for "pages" table either.
         *
         * @param       string          Table name
         * @param       integer         Record uid (to be localized)
@@ -3152,7 +3153,7 @@ class t3lib_TCEmain       {
                if ($TCA[$table] && $uid)       {
                        t3lib_div::loadTCA($table);
 
-                       if ($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'])     {
+                       if ($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'])   {
                                if ($langRec = t3lib_BEfunc::getRecord('sys_language',intval($language),'uid,title'))   {
                                        if ($this->doesRecordExist($table,$uid,'show')) {
 
diff --git a/t3lib/class.t3lib_transl8tools.php b/t3lib/class.t3lib_transl8tools.php
new file mode 100755 (executable)
index 0000000..b637863
--- /dev/null
@@ -0,0 +1,194 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Contains translation tools
+ *
+ * $Id: class.t3lib_loaddbgroup.php 1816 2006-11-26 00:43:24Z mundaun $
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ */
+
+
+
+
+
+
+
+
+
+
+/**
+ * Contains translation tools
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_transl8tools       {
+       
+       
+       function getSystemLanguages($page_id=0,$backPath='')    {
+               global $TCA,$LANG;
+
+                       // Icons and language titles:
+               t3lib_div::loadTCA('sys_language');
+               $flagAbsPath = t3lib_div::getFileAbsFileName($TCA['sys_language']['columns']['flag']['config']['fileFolder']);
+               $flagIconPath = $backPath.'../'.substr($flagAbsPath, strlen(PATH_site));
+
+               $modSharedTSconfig = t3lib_BEfunc::getModTSconfig($page_id, 'mod.SHARED');
+               $languageIconTitles = array();
+
+                       // Set default:
+               $languageIconTitles[0] = array(
+                       'uid' => 0,
+                       'title' => strlen ($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'].' ('.$LANG->getLL('defaultLanguage').')' : $LANG->getLL('defaultLanguage'),
+                       'ISOcode' => 'DEF',
+                       'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) && @is_file($flagAbsPath.$modSharedTSconfig['properties']['defaultLanguageFlag']) ? $flagIconPath.$modSharedTSconfig['properties']['defaultLanguageFlag'] : null,
+               );
+
+                       // Set "All" language:
+               $languageIconTitles[-1]=array(
+                       'uid' => -1,
+                       'title' => $LANG->getLL('multipleLanguages'),
+                       'ISOcode' => 'DEF',
+                       'flagIcon' => $flagIconPath.'multi-language.gif',
+               );
+
+                       // Find all system languages:
+               $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       '*',
+                       'sys_language',
+                       ''
+               );
+               foreach($sys_languages as $row)         {
+                       $languageIconTitles[$row['uid']] = $row;
+
+                       if ($row['static_lang_isocode'] && t3lib_extMgm::isLoaded('static_info_tables'))        {
+                               $staticLangRow = t3lib_BEfunc::getRecord('static_languages',$row['static_lang_isocode'],'lg_iso_2');
+                               if ($staticLangRow['lg_iso_2']) {
+                                       $languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
+                               }
+                       }
+                       if (strlen ($row['flag'])) {
+                               $languageIconTitles[$row['uid']]['flagIcon'] = @is_file($flagAbsPath.$row['flag']) ? $flagIconPath.$row['flag'] : '';
+                       }
+               }               
+               
+               return $languageIconTitles;
+       }
+
+       /**
+        * Initialization of the class.
+        */
+       function translationInfo($table,$uid,$sys_language_uid=0)       {
+               global $TCA;
+               
+               if ($TCA[$table] && $uid)       {
+                       t3lib_div::loadTCA($table);
+
+                       $row = t3lib_BEfunc::getRecordWSOL($table,$uid);
+                       if (is_array($row))     {
+                               $trTable = $this->getTranslationTable($table);
+                               if ($trTable)   {
+                                       if ($trTable!==$table || $row[$TCA[$table]['ctrl']['languageField']] <= 0)      {
+                                               if ($trTable!==$table || $row[$TCA[$table]['ctrl']['transOrigPointerField']] == 0)      {
+
+                                                               // Look for translations of this record, index by language field value:
+                                                       $translationsTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                                                               'uid,'.$TCA[$trTable]['ctrl']['languageField'],
+                                                               $trTable,
+                                                               'pid='.intval($table==='pages' ? $row['uid'] : $row['pid']).    // Making exception for pages of course where the translations will always be ON the page, not on the level above...
+                                                                       ' AND '.$TCA[$trTable]['ctrl']['languageField'].(!$sys_language_uid ? '>0' : '='.intval($sys_language_uid)).
+                                                                       ' AND '.$TCA[$trTable]['ctrl']['transOrigPointerField'].'='.intval($uid).
+                                                                       t3lib_BEfunc::deleteClause($trTable).
+                                                                       t3lib_BEfunc::versioningPlaceholderClause($trTable)
+                                                       );
+                                                       
+                                                       $translations = array();
+                                                       $translations_errors = array();
+                                                       foreach($translationsTemp as $r)        {
+                                                               if (!isset($translations[$r[$TCA[$trTable]['ctrl']['languageField']]])) {
+                                                                       $translations[$r[$TCA[$trTable]['ctrl']['languageField']]] = $r;
+                                                               } else {
+                                                                       $translations_errors[$r[$TCA[$trTable]['ctrl']['languageField']]][] = $r;
+                                                               }
+                                                       }
+
+                                                       return array(
+                                                               'table' => $table,
+                                                               'uid' => $uid,
+                                                               'sys_language_uid' => $row[$TCA[$table]['ctrl']['languageField']],
+                                                               'translation_table' => $trTable,
+                                                               'translations' => $translations,
+                                                               'excessive_translations' => $translations_errors
+                                                       );
+                                               } else return 'Record "'.$table.'_'.$uid.'" seems to be a translation already (has a relation to record "'.$row[$TCA[$table]['ctrl']['transOrigPointerField']].'")';
+                                       } else return 'Record "'.$table.'_'.$uid.'" seems to be a translation already (has a language value "'.$row[$TCA[$table]['ctrl']['languageField']].'", relation to record "'.$row[$TCA[$table]['ctrl']['transOrigPointerField']].'")';
+                               } else return 'Translation is not supported for this table!';
+                       } else return 'Record "'.$table.'_'.$uid.'" was not found';
+               } else return 'No table "'.$table.'" or no UID value';
+       }
+       
+       /**
+        *  Returns the table in which translations for input table is found.
+        */
+       function getTranslationTable($table) {
+               return $this->isTranslationInOwnTable($table) ? $table : $this->foreignTranslationTable($table);
+       }
+       
+       /**
+        *  Returns true, if the input table has localization enabled and done so with records from the same table
+        */
+       function isTranslationInOwnTable($table) {
+               global $TCA;
+
+               return $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
+       }
+       
+       /**
+        *  Returns foreign translation table, if any
+        */
+       function foreignTranslationTable($table) {
+               global $TCA;
+               
+               $trTable = $TCA[$table]['ctrl']['transForeignTable'];
+
+               if ($trTable && $TCA[$trTable] && $TCA[$trTable]['ctrl']['languageField'] && $TCA[$trTable]['ctrl']['transOrigPointerField'] && $TCA[$trTable]['ctrl']['transOrigPointerTable']===$table)       {
+                       return $trTable;
+               }
+       }
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_transl8tools.php'])     {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_transl8tools.php']);
+}
+?>
\ No newline at end of file
index e3bde3e..6d7ee80 100755 (executable)
@@ -80,7 +80,6 @@
 
 
 
-
 /**
  * Class for rendering of Web>List module
  *
@@ -622,6 +621,8 @@ class localRecordList extends recordList {
                                $theData[$fCol]=$this->makeControl($table,$row);
                        } elseif ($fCol=='_CLIPBOARD_') {
                                $theData[$fCol]=$this->makeClip($table,$row);
+#                              $t3lib_transl8tools = new t3lib_transl8tools;
+#                              $theData[$fCol].=t3lib_div::view_array($t3lib_transl8tools->translationInfo($table,$row['uid']));
                        } elseif ($fCol=='_LOCALIZATION_') {
                                list($lC1, $lC2) = $this->makeLocalizationPanel($table,$row);
                                $theData[$fCol] = $lC1;
@@ -1106,50 +1107,36 @@ class localRecordList extends recordList {
                        0 => '',
                        1 => '',
                );
-               if ($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'])   {
-
-                               // Language title and icon:
-                       $out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
-
-                               // Create new localizations links:
-                       if ($row[$TCA[$table]['ctrl']['languageField']] <=0)    {
-
-                                       // Look for translations of this record, index by language field value:
-                               $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                                       'uid,'.$TCA[$table]['ctrl']['languageField'],
-                                       $table,
-                                       'pid='.intval($this->id).
-                                               ' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
-                                               ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
-                                               t3lib_BEfunc::deleteClause($table).
-                                               t3lib_BEfunc::versioningPlaceholderClause($table),
-                                       '',
-                                       '',
-                                       '',
-                                       $TCA[$table]['ctrl']['languageField']
-                               );
-
-                                       // Traverse page translations and add icon for each language that does NOT yet exist:
-                               $lNew = '';
-                               foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)        {
-                                       if (!isset($translations[$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage))      {
-                                               $href = $GLOBALS['TBE_TEMPLATE']->issueCommand(
-                                                       '&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,
-                                                       $this->listURL().'&justLocalized='.rawurlencode($table.':'.$row['uid'].':'.$lUid_OnPage)
-                                               );
-
-                                               $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
-                                               $lC = '<a href="'.htmlspecialchars($href).'">'.$lC.'</a> ';
-
-                                               $lNew.=$lC;
-                                       }
-                               }
+               
+               $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
+               $translations = $t8Tools->translationInfo($table,$row['uid']);
 
-                               if ($lNew)      $out[1].= $lNew;
-                       } else {
-                               $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;'.$out[0];
+                       // Language title and icon:
+               $out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
+
+               if (is_array($translations))    {
+
+                               // Traverse page translations and add icon for each language that does NOT yet exist:
+                       $lNew = '';
+                       foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)        {
+                               if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage))      {
+                                       $href = $GLOBALS['TBE_TEMPLATE']->issueCommand(
+                                               '&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,
+                                               $this->listURL().'&justLocalized='.rawurlencode($table.':'.$row['uid'].':'.$lUid_OnPage)
+                                       );
+
+                                       $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
+                                       $lC = '<a href="'.htmlspecialchars($href).'">'.$lC.'</a> ';
+
+                                       $lNew.=$lC;
+                               }
                        }
+                       
+                       if ($lNew)      $out[1].= $lNew;
+               } else {
+                       $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;'.$out[0];
                }
+               
 
                return $out;
        }
index c422834..185bf0c 100755 (executable)
@@ -41,7 +41,7 @@
 // **************************************************************************
 
        // This checks for my own IP at home. You can just remove the if-statement.
-if (1==0 || (substr($_SERVER['REMOTE_ADDR'],0,7)!='192.168' && $_SERVER['REMOTE_ADDR']!='127.0.0.1'))  {
+if (1==0 || (substr($_SERVER['REMOTE_ADDR'],0,7)!='192.168' && $_SERVER['REMOTE_ADDR']!='127.0.0.1' && $_SERVER['REMOTE_ADDR']!='::1'))        {
        die("In the source distribution of TYPO3, the install script is disabled by a die() function call.<br/><b>Fix:</b> Open the file typo3/install/index.php and remove/out-comment the line that outputs this message!");
 }
 
index a3243a3..db46806 100755 (executable)
@@ -87,6 +87,7 @@ if (TYPO3_MODE=='BE') {
 
        // Adding default value columns:
        $TCA['pages']['ctrl']['useColumnsForDefaultValues'].=',fe_group,hidden';
+       $TCA['pages']['ctrl']['transForeignTable'] = 'pages_language_overlay';
 
        // Adding new columns:
        $TCA['pages']['columns'] = array_merge($TCA['pages']['columns'],Array(
index 598c031..c8a9d00 100644 (file)
@@ -415,7 +415,7 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
 
 $info.='[<b>'.$TCA[$table]['ctrl']['languageField'].'</b>]';
 $info.='[<b>'.$TCA[$table]['ctrl']['transOrigPointerField'].'</b>]';
-$info.='[<b>'.$TCA[$table]['ctrl']['transOrigDiffSourceField'].'</b>]';
+$info.='[<b>'.$TCA[$table]['ctrl']['transOrigDiffSourceField'].'</b>]<br/>';
 
                                                        // Now, for each record, look for localization:
                                                $translationsUids = array(0);