Generally: FE charset output conversion, new localization modes in FE and FE preview...
authorKasper Skårhøj <kasper@typo3.org>
Thu, 26 Aug 2004 12:18:49 +0000 (12:18 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Thu, 26 Aug 2004 12:18:49 +0000 (12:18 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@440 709f56b5-9817-0410-a4d7-c38de5d9e867

20 files changed:
typo3/alt_doc.php
typo3/browse_links.php
typo3/class.db_list_extra.inc
typo3/db_list.php
typo3/mod/web/func/index.php
typo3/mod/web/info/index.php
typo3/mod/web/perm/index.php
typo3/stylesheet.css
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/cms/tbl_tt_content.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_menu.php
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/cms/web_info/class.tx_cms_webinfo_lang.php
typo3/sysext/cms/web_info/locallang.xml
typo3/sysext/lang/locallang_core.xml
typo3/template.php
typo3/wizard_rte.php

index 9543079..76510c4 100755 (executable)
@@ -111,6 +111,7 @@ class SC_alt_doc {
        var $vC;                                // GPvar (for processing only) : Verification code, internal stuff.
 
        var $popViewId;                 // GPvar (module) : ID for displaying the page in the frontend (used for SAVE/VIEW operations)
+       var $popViewId_addParams;       // GPvar (module) : Additional GET vars for the link, eg. "&L=xxx"
        var $viewUrl;                   // GPvar (module) : Alternative URL for viewing the frontend pages.
        var $editRegularContentFromId;          // If this is pointing to a page id it will automatically load all content elements (NORMAL column/default language) from that page into the form!
        var $recTitle;                          // Alternative title for the document handler.
@@ -142,7 +143,8 @@ class SC_alt_doc {
        var $firstEl;                   // Pointer to the first element in $elementsData
        var $errorC;                    // Counter, used to count the number of errors (when users do not have edit permissions)
        var $newC;                              // Counter, used to count the number of new record forms displayed
-       var $viewId;                    // Is set the the pid value of the last shown record - thus indicating which page to show when clicking the SAVE/VIEW button
+       var $viewId;                    // Is set to the pid value of the last shown record - thus indicating which page to show when clicking the SAVE/VIEW button
+       var $viewId_addParams;  // Is set to additional parameters (like "&L=xxx") if the record supports it.
        var $modTSconfig;               // Module TSconfig, loaded from main() based on the page id value of viewId
        var $tceforms;                  // Contains the instance of TCEforms class.
        var $generalPathOfForm; // Contains the root-line path of the currently edited record(s) - for display.
@@ -348,6 +350,7 @@ class SC_alt_doc {
 
                        // Setting more GPvars:
                $this->popViewId = t3lib_div::_GP('popViewId');
+               $this->popViewId_addParams = t3lib_div::_GP('popViewId_addParams');
                $this->viewUrl = t3lib_div::_GP('viewUrl');
                $this->editRegularContentFromId = t3lib_div::_GP('editRegularContentFromId');
                $this->recTitle = t3lib_div::_GP('recTitle');
@@ -413,7 +416,7 @@ class SC_alt_doc {
                                }
                                return false;
                        }
-               '.(isset($HTTP_POST_VARS['_savedokview_x']) && $this->popViewId ? t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl) : '')
+               '.(isset($HTTP_POST_VARS['_savedokview_x']) && $this->popViewId ? t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl,$this->popViewId_addParams) : '')
                ).$this->doc->getDynTabMenuJScode();
 
                        // Setting up the context sensitive menu:
@@ -601,6 +604,11 @@ class SC_alt_doc {
                                                                                $hasAccess = $CALC_PERMS&16 ? 1 : 0;
                                                                                $deleteAccess = $CALC_PERMS&16 ? 1 : 0;
                                                                                $this->viewId = $calcPRec['pid'];
+
+                                                                                       // Adding "&L=xx" if the record being edited has a languageField with a value larger than zero!
+                                                                               if ($TCA[$table]['ctrl']['languageField'] && $calcPRec[$TCA[$table]['ctrl']['languageField']]>0)        {
+                                                                                       $this->viewId_addParams = '&L='.$calcPRec[$TCA[$table]['ctrl']['languageField']];
+                                                                               }
                                                                        }
 
                                                                                // Check internals regarding access:
@@ -895,6 +903,9 @@ class SC_alt_doc {
                        $formContent.='<input type="hidden" name="returnNewPageId" value="1" />';
                }
                $formContent.='<input type="hidden" name="popViewId" value="'.htmlspecialchars($this->viewId).'" />';
+               if ($this->viewId_addParams) {
+                       $formContent.='<input type="hidden" name="popViewId_addParams" value="'.htmlspecialchars($this->viewId_addParams).'" />';
+               }
                $formContent.='<input type="hidden" name="closeDoc" value="0" />';
                $formContent.='<input type="hidden" name="doSave" value="0" />';
                $formContent.='<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
@@ -948,7 +959,7 @@ class SC_alt_doc {
 
                                // Shortcut:
                        if ($BE_USER->mayMakeShortcut())        {
-                               $content.=$this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,popViewId,returnNewPageId,editRegularContentFromId,disHelp,noView',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'],1);
+                               $content.=$this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,disHelp,noView',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'],1);
                        }
 
                                // Open in new window:
index cec0686..ce3cf31 100755 (executable)
@@ -1613,6 +1613,7 @@ class SC_browse_links {
                        $dblist->thumbs = 0;
                        $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
                        $dblist->noControlPanels=1;
+                       $dblist->clickMenuEnabled=0;
                        $dblist->tableList=implode(',',$tablesArr);
 
                        $dblist->start($id,t3lib_div::_GP('table'),$pointer,
index dfa1f49..5a0272b 100755 (executable)
@@ -96,6 +96,7 @@ class localRecordList extends recordList {
        var $dontShowClipControlPanels=FALSE;   // If true, will disable the rendering of clipboard + control panels.
        var $showClipboard=FALSE;                               // If true, will show the clipboard in the field list.
        var $noControlPanels = FALSE;                   // If true, will DISABLE all control panels in lists. (Takes precedence)
+       var $clickMenuEnabled = TRUE;                   // If true, clickmenus will be rendered
 
 
 
@@ -124,7 +125,7 @@ class localRecordList extends recordList {
                $this->pageRow = $row;
                $this->counter++;
                $alttext = t3lib_BEfunc::getRecordIconAltText($row,'pages');
-               $iconImg = t3lib_iconWorks::getIconImage('pages',$row,$this->backPath,'title="'.htmlspecialchars($alttext).'"');
+               $iconImg = t3lib_iconWorks::getIconImage('pages',$row,$this->backPath,'class="absmiddle" title="'.htmlspecialchars($alttext).'"');
                $titleCol = 'test';     // pseudo title column name
                $this->fieldArray = Array($titleCol,'up');              // Setting the fields to display in the list (this is of course "pseudo fields" since this is the top!)
 
@@ -242,7 +243,7 @@ class localRecordList extends recordList {
                                                        '</a>';
 
                                // Make Icon:
-                       $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,'pages',$this->id);
+                       $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,'pages',$this->id) : $iconImg;
                } else {        // On root-level of page tree:
 
                                // Setting title of root (sitename):
@@ -269,7 +270,7 @@ class localRecordList extends recordList {
                        </table>';
 
                        // ... and the element row is created:
-               $out.=$this->addelement(1,'',$theData,'',$this->leftMargin, $theIcon);
+               $out.=$this->addelement(1,$theIcon,$theData,'',$this->leftMargin);
 
                        // ... and wrapped into a table and added to the internal ->HTMLcode variable:
                $this->HTMLcode.='
@@ -522,7 +523,7 @@ class localRecordList extends recordList {
 
                        // The icon with link
                $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($alttext).'"');
-               $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']);
+               $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']) : $iconImg;
 
                        // Preparing and getting the data-array
                $theData = Array();
@@ -762,6 +763,24 @@ class localRecordList extends recordList {
                                                '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/history2.gif','width="13" height="12"').' title="'.$LANG->getLL('history',1).'" alt="" />'.
                                                '</a>';
 
+                                       // Versioning:
+                               if (t3lib_extMgm::isLoaded('version'))  {
+                                       $vers = t3lib_BEfunc::selectVersionsOfRecord($table, $row['uid'], $fields='uid');
+                                       if (is_array($vers))    {       // If table can be versionized.
+                                               if (count($vers)>1)     {
+                                                       $st = 'background-color: #FFFF00; font-weight: bold;';
+                                                       $lab = count($vers)-1;
+                                               } else {
+                                                       $st = 'background-color: #9999cc; font-weight: bold;';
+                                                       $lab = 'V';
+                                               }
+
+                                               $cells[]='<a href="'.htmlspecialchars(t3lib_extMgm::extRelPath('version')).'cm1/index.php?table='.rawurlencode($table).'&uid='.rawurlencode($row['uid']).'" style="'.htmlspecialchars($st).'">'.
+                                                               $lab.
+                                                               '</a>';
+                                       }
+                               }
+
                                        // "Edit Perms" link:
                                if ($table=='pages' && $GLOBALS['BE_USER']->check('modules','web_perm'))        {
                                        $cells[]='<a href="'.htmlspecialchars('mod/web/perm/index.php?id='.$row['uid'].'&return_id='.$row['uid'].'&edit=1').'">'.
index 2de3896..8bb868c 100755 (executable)
@@ -277,6 +277,9 @@ class SC_db_list {
                                // Render the page header:
                        $dblist->writeTop($this->pageinfo);
 
+                               // Render versioning selector:
+                       $dblist->HTMLcode.= $this->doc->getVersionSelector($this->id);
+
                                // Render the list of tables:
                        $dblist->generateList($this->id,$this->table);
 
index 21d01d4..3392512 100755 (executable)
@@ -131,7 +131,10 @@ class SC_mod_web_func_index extends t3lib_SCbase {
                        $this->content.=$this->doc->divider(5);
 
 
-
+                       $vContent = $this->doc->getVersionSelector($this->id,1);
+                       if ($vContent)  {
+                               $this->content.=$this->doc->section('',$vContent);
+                       }
 
 
                        $this->extObjContent();
index 623eff1..f3acc72 100755 (executable)
@@ -139,7 +139,10 @@ class SC_mod_web_info_index extends t3lib_SCbase {
                        $this->content.=$this->doc->divider(5);
 
 
-
+                       $vContent = $this->doc->getVersionSelector($this->id,1);
+                       if ($vContent)  {
+                               $this->content.=$this->doc->section('',$vContent);
+                       }
 
                        $this->extObjContent();
 
index f731bbb..4dfb7cf 100755 (executable)
@@ -251,6 +251,15 @@ class SC_mod_web_perm_index {
                                ));
                        $this->content.=$this->doc->divider(5);
 
+
+
+                       $vContent = $this->doc->getVersionSelector($this->id,1);
+                       if ($vContent)  {
+                               $this->content.=$this->doc->section('',$vContent);
+                       }
+
+
+
                                // Main function, branching out:
                        if (!$this->edit)       {
                                $this->notEdit();
index 898906f..f56d4ea 100755 (executable)
@@ -393,6 +393,8 @@ TABLE.typo3-dblist TR TD DIV.typo3-clipCtrl IMG, TABLE.typo3-dblist TR TD DIV.ty
 TABLE.typo3-dblist-overview { width: 410px; margin-top: 10px; margin-left:1px;}
 TABLE.typo3-dblist-overview TD.c-tableDescription {padding-left: 10px; font-style: italic; color: #333333;}
 TABLE.typo3-dblist-overview TD.c-tableDescription IMG { margin-right: 10px; }
+TABLE#typo3-versionSelector { background-color: #ABBBB4; margin-top: 5px; margin-bottom: 5px; }
+TABLE#typo3-versionSelector TD { padding-left: 2px; padding-right: 2px; }
 
 DIV#typo3-newRecordLink { margin: 5px 0px 5px 0px; font-weight: bold;}
 DIV#typo3-newRecordLink IMG { margin-right: 5px; vertical-align: middle; }
index 762fb38..9cb41a7 100755 (executable)
@@ -423,7 +423,7 @@ class tx_cms_layout extends recordList {
                                        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
 
                                                // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script:
-                                       if ($this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result))      {
+                                       if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result))     {
                                                $onClick = "document.location='db_new_content_el.php?id=".$id.'&colPos='.intval($key).'&sys_language_uid='.$lP.'&uid_pid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';";
                                                $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent'));
                                                $content[$key].= '<img src="clear.gif" width="1" height="5" alt="" /><br />'.$theNewButton;
@@ -514,22 +514,27 @@ class tx_cms_layout extends recordList {
                                        $cCont[$lP]='
                                                <td valign="top" align="center" class="bgColor6"><strong>'.htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]).'</strong></td>';
 
+                                               // "View page" icon is added:
+                                       $viewLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id,$this->backPath,t3lib_BEfunc::BEgetRootLine($this->id),'','','&L='.$lP)).'">'.
+                                               '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' class="absmiddle" title="" alt="" />'.
+                                               '</a>';
+
                                                // Language overlay page header:
                                        if ($lP)        {
+
                                                list($lpRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$id,'AND sys_language_uid='.intval($lP));
                                                $params='&edit[pages_language_overlay]['.$lpRecord['uid'].']=edit&overrideVals[pages_language_overlay][sys_language_uid]='.$lP;
-                                               $lPLabel = '<span class="nobr">'.
-                                                       t3lib_iconWorks::getIconImage('pages_language_overlay',$lpRecord,$this->backPath,'  class="absmiddle"').
-                                                       '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
+                                               $lPLabel = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage('pages_language_overlay',$lpRecord,$this->backPath,'  class="absmiddle"'),'pages_language_overlay',$lpRecord['uid']).
+                                                       $viewLink.
+                                                       ($GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay') ? '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
                                                        '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" class="absmiddle" alt="" />'.
-                                                       '</a>'.
-                                                       htmlspecialchars(t3lib_div::fixed_lgd_cs($lpRecord['title'],20)).
-                                                       '</span>';
+                                                       '</a>' : '').
+                                                       htmlspecialchars(t3lib_div::fixed_lgd_cs($lpRecord['title'],20));
                                        } else {
-                                               $lPLabel='';
+                                               $lPLabel = $viewLink;
                                        }
                                        $sCont[$lP]='
-                                               <td>'.$lPLabel.'</td>';
+                                               <td nowrap="nowrap">'.$lPLabel.'</td>';
                                }
                                        // Add headers:
                                $out.='
@@ -612,7 +617,7 @@ class tx_cms_layout extends recordList {
                                $rowOut = '';
 
                                        // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script:
-                               if ($this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result))      {
+                               if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result))     {
                                        $onClick="document.location='db_new_content_el.php?id=".$id.'&colPos='.intval($key).'&sys_language_uid='.$lP.'&uid_pid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';";
                                        $theNewButton=$GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent'));
                                        $theNewButton='<img src="clear.gif" width="1" height="5" alt="" /><br />'.$theNewButton;
@@ -683,14 +688,18 @@ class tx_cms_layout extends recordList {
                        // Add the big buttons to page:
                if ($this->option_showBigButtons)       {
                        $bArray=array();
+
                        if (!$GLOBALS['SOBE']->current_sys_language)    {
-                               $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages]['.$id."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageTitle'));
+                               if ($this->ext_CALC_PERMS&2)    $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages]['.$id."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageTitle'));
                        } else {
-                               $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages_language_overlay]['.$GLOBALS['SOBE']->current_sys_language."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageTitle_curLang'));
+                               if ($this->doEdit && $GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay'))      {
+                                       list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$id,'AND sys_language_uid='.intval($GLOBALS['SOBE']->current_sys_language));
+                                       $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages_language_overlay]['.$languageOverlayRecord['uid']."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageTitle_curLang'));
+                               }
                        }
-                       $bArray[1]=$GLOBALS['SOBE']->doc->t3Button("document.location='".$this->backPath."move_el.php?table=pages&uid=".$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('move_page'));
-                       $bArray[2]=$GLOBALS['SOBE']->doc->t3Button("document.location='".$this->backPath."db_new.php?id=".$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('newPage2'));
-                       if ($this->ext_function==1) $bArray[3]=$GLOBALS['SOBE']->doc->t3Button("document.location='db_new_content_el.php?id=".$id.'&sys_language_uid='.$GLOBALS['SOBE']->current_sys_language.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('newPageContent2'));
+                       if ($this->ext_CALC_PERMS&4 || $this->ext_CALC_PERMS&2) $bArray[1]=$GLOBALS['SOBE']->doc->t3Button("document.location='".$this->backPath."move_el.php?table=pages&uid=".$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('move_page'));
+                       if ($this->ext_CALC_PERMS&8)    $bArray[2]=$GLOBALS['SOBE']->doc->t3Button("document.location='".$this->backPath."db_new.php?id=".$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('newPage2'));
+                       if ($this->doEdit && $this->ext_function==1) $bArray[3]=$GLOBALS['SOBE']->doc->t3Button("document.location='db_new_content_el.php?id=".$id.'&sys_language_uid='.$GLOBALS['SOBE']->current_sys_language.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('newPageContent2'));
                        $out = '
                                <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons">
                                        <tr>
@@ -1783,7 +1792,7 @@ class tx_cms_layout extends recordList {
         * @return      string          "Copy languages" button, if available.
         */
        function newLanguageButton($defLanguageCount,$lP)       {
-               if (count($defLanguageCount) && $lP)    {
+               if ($this->doEdit && count($defLanguageCount) && $lP)   {
 
                        $params = '';
                        foreach($defLanguageCount as $uidVal)   {
@@ -1863,7 +1872,7 @@ class tx_cms_layout extends recordList {
                $params['field'] = 'bodytext';
                $params['returnUrl'] = t3lib_div::linkThisScript();
                $RTEonClick = "document.location='".$this->backPath."wizard_rte.php?".t3lib_div::implodeArrayForUrl('',array('P'=>$params))."';return false;";
-               $addButton = $this->option_showBigButtons ? $GLOBALS['SOBE']->doc->t3Button($RTEonClick,$GLOBALS['LANG']->getLL('editInRTE')) : '';
+               $addButton = $this->option_showBigButtons && $this->doEdit ? $GLOBALS['SOBE']->doc->t3Button($RTEonClick,$GLOBALS['LANG']->getLL('editInRTE')) : '';
 
                return $addButton;
        }
@@ -1877,7 +1886,7 @@ class tx_cms_layout extends recordList {
         * @see getTable_tt_content()
         */
        function languageSelector($id)  {
-               if ($GLOBALS['BE_USER']->check('tables_select','pages_language_overlay'))       {
+               if ($GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay'))       {
 
                                // First, select all
                        $res = $GLOBALS['SOBE']->exec_languageQuery(0);
index 1d82357..d0b3476 100755 (executable)
@@ -877,7 +877,9 @@ class SC_db_layout {
                $dblist->script = 'db_layout.php';
                $dblist->showIcon = 0;
                $dblist->setLMargin=0;
-               $dblist->doEdit = $this->CALC_PERMS&16 ? 1 : 0;
+               $dblist->doEdit = $this->EDIT_CONTENT;
+               $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
+
                $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
                $dblist->id = $this->id;
                $dblist->nextThree = t3lib_div::intInRange($this->modTSconfig['properties']['editFieldsAtATime'],0,10);
@@ -977,6 +979,9 @@ class SC_db_layout {
                        $dblist->counter = $CMcounter;
                        $dblist->ext_function = $this->MOD_SETTINGS['function'];
 
+                               // Render versioning selector:
+                       $dblist->HTMLcode.= $this->doc->getVersionSelector($this->id);
+
                                // Generate the list of elements here:
                        $dblist->generateList();
 
index e55f36b..d61e8c1 100755 (executable)
@@ -379,6 +379,7 @@ $TCA['tt_content'] = Array (
                        )
                ),
                'image' => Array (
+#                      'l10n_mode' => 'mergeIfNotBlank',
                        'label' => 'LLL:EXT:lang/locallang_general.php:LGL.images',
                        'config' => Array (
                                'type' => 'group',
index 65fab78..a79f68f 100755 (executable)
@@ -1139,15 +1139,26 @@ class tslib_cObj {
                                $cObj->setParent($this->data,$this->currentRecord);
                                $this->currentRecordNumber=0;
                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
-                                       if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']])  {
-                                               $this->currentRecordNumber++;
-                                               $cObj->parentRecordNumber = $this->currentRecordNumber;
-                                               $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
-                                               $this->lastChanged($row['tstamp']);
-                                               $cObj->start($row,$conf['table']);
-                                               if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries'])      { $theValue.='<!--DMAILER_SECTION_BOUNDARY_'.intval($row['module_sys_dmail_category']).'-->'; }
-                                               $theValue.= $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
-                                       }# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');
+
+                                               // Versioning preview:
+                                       $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row);
+
+                                               // Language Overlay:
+                                       if ($GLOBALS['TSFE']->sys_language_contentOL)   {
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
+                                       }
+
+                                       if (is_array($row))     {       // Might be unset in the sys_language_contentOL
+                                               if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']])  {
+                                                       $this->currentRecordNumber++;
+                                                       $cObj->parentRecordNumber = $this->currentRecordNumber;
+                                                       $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
+                                                       $this->lastChanged($row['tstamp']);
+                                                       $cObj->start($row,$conf['table']);
+                                                       if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries'])      { $theValue.='<!--DMAILER_SECTION_BOUNDARY_'.intval($row['module_sys_dmail_category']).'-->'; }
+                                                       $theValue.= $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
+                                               }# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');
+                                       }
                                }
                                if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries'])      { $theValue.='<!--DMAILER_SECTION_BOUNDARY_END-->'; }
                        }
@@ -1205,22 +1216,33 @@ class tslib_cObj {
                        reset($loadDB->itemArray);
                        while(list(,$val)=each($loadDB->itemArray))     {
                                $row = $data[$val['table']][$val['id']];
-                               if (!$conf['dontCheckPid'])     {
-                                       $row = $this->checkPid($row['pid']) ? $row : '';
-                               }
-                               if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']])    {
-                                       $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
-                                       $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
-                                       $renderObjConf = $conf['conf.'][$val['table'].'.'];
-                                       $this->currentRecordNumber++;
-                                       $cObj->parentRecordNumber=$this->currentRecordNumber;
-                                       $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
-                                       $this->lastChanged($row['tstamp']);
-                                       $cObj->start($row,$val['table']);
-                                       if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries'])      {$theValue.='<!--DMAILER_SECTION_BOUNDARY_'.intval($row['module_sys_dmail_category']).'-->';}
-                                       $theValue.=$cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
-                                       if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries'])      {$theValue.='<!--DMAILER_SECTION_BOUNDARY_END-->';}
-                               }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
+
+                                       // Versioning preview:
+                               $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row);
+
+                                       // Language Overlay:
+                               if ($GLOBALS['TSFE']->sys_language_contentOL)   {
+                                       $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
+                               }
+
+                               if (is_array($row))     {       // Might be unset in the content overlay things...
+                                       if (!$conf['dontCheckPid'])     {
+                                               $row = $this->checkPid($row['pid']) ? $row : '';
+                                       }
+                                       if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']])    {
+                                               $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
+                                               $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
+                                               $renderObjConf = $conf['conf.'][$val['table'].'.'];
+                                               $this->currentRecordNumber++;
+                                               $cObj->parentRecordNumber=$this->currentRecordNumber;
+                                               $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
+                                               $this->lastChanged($row['tstamp']);
+                                               $cObj->start($row,$val['table']);
+                                               if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries'])      {$theValue.='<!--DMAILER_SECTION_BOUNDARY_'.intval($row['module_sys_dmail_category']).'-->';}
+                                               $theValue.=$cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
+                                               if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries'])      {$theValue.='<!--DMAILER_SECTION_BOUNDARY_END-->';}
+                                       }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
+                               }
                        }
                }
                $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore
@@ -5950,6 +5972,8 @@ class tslib_cObj {
                        if ($depth>0)   {
                                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($allFields, 'pages', 'pid='.intval($id).' AND NOT deleted AND doktype!=255 AND doktype!=6'.$moreWhereClauses, '' ,'sorting');
                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
+#??                            $GLOBALS['TSFE']->sys_page->versionOL('pages',$row);
+
                                                // Find mount point if any:
                                        $next_id = $row['uid'];
                                        $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($next_id, $row);
@@ -5958,6 +5982,7 @@ class tslib_cObj {
                                                $next_id = $mount_info['mount_pid'];
                                                $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($allFields, 'pages', 'uid='.intval($next_id).' AND NOT deleted AND doktype!=255 AND doktype!=6'.$moreWhereClauses, '' ,'sorting');
                                                $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2);
+#??                                            $GLOBALS['TSFE']->sys_page->versionOL('pages',$row);
                                        }
                                                // Add record:
                                        if (is_array($row) && $dontCheckEnableFields || $GLOBALS['TSFE']->checkPagerecordForIncludeSection($row))       {
@@ -6202,6 +6227,7 @@ class tslib_cObj {
         * @see getQuery()
         */
        function getWhere($table,$conf, $returnQueryArray=FALSE)        {
+               global $TCA;
 
                        // Init:
                $query = '';
@@ -6241,8 +6267,15 @@ class tslib_cObj {
                if ($where = trim($conf['where']))      {
                        $query.=' AND '.$where;
                }
+
                if ($conf['languageField'])     {
-                       $query.=' AND '.$conf['languageField'].'='.intval($GLOBALS['TSFE']->sys_language_content);
+                       if ($GLOBALS['TSFE']->sys_language_contentOL && $TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
+                                       // Sys language content is set to zero - and it is expected that whatever routine processes the output will OVERLAY the records with localized version!
+                               $sys_language_content = 0;
+                       } else {
+                               $sys_language_content = $GLOBALS['TSFE']->sys_language_content;
+                       }
+                       $query.=' AND '.$conf['languageField'].'='.intval($sys_language_content);
                }
 
                $andWhere = trim($this->stdWrap($conf['andWhere'],$conf['andWhere.']));
index 0a46150..9e187cc 100755 (executable)
        var $showHiddenPage='';                         // Flag indicating that hidden pages should be shown, selected and so on. This goes for almost all selection of pages!
        var $showHiddenRecords='';                      // Flag indicating that hidden records should be shown. This includes sys_template, pages_language_overlay and even fe_groups in addition to all other regular content. So in effect, this includes everything except pages.
        var $simUserGroup='0';                          // Value that contains the simulated usergroup if any
+       var $versionPreviewMap=array();         // Versioning Preview record map (temporary, for sys_page)
 
                // CONFIGURATION
        var $TYPO3_CONF_VARS=array();           // The configuration array as set up in t3lib/config_default.php. Should be an EXACT copy of the global array.
        var $config='';                                         // 'CONFIG' object from TypoScript. Array generated based on the TypoScript configuration of the current page. Saved with the cached pages.
+       var $TCAcachedExtras=array();           // Array of cached information from TCA. This is NOT TCA itself!
 
                // TEMPLATE / CACHE
        var $tmpl='';                                           // The TypoScript template object. Used to parse the TypoScript template
        var $displayFieldEditIcons='';          // If set, edit icons are rendered aside individual fields of content. Must be set only if the ->beUserLogin flag is set and set_no_cache() must be called as well.
        var $sys_language_uid=0;                        // Site language, 0 (zero) is default, int+ is uid pointing to a sys_language record. Should reflect which language it DOES actually display!
        var $sys_language_mode='';                      // Site language mode
-       var $sys_language_content=0;            // Site language selection uid
+       var $sys_language_content=0;            // Site content selection uid
+       var $sys_language_contentOL=0;          // Site content overlay flag; If set - and sys_language_content is > 0 - , records selected will try to look for a translation pointing to their uid. (If configured in [ctrl][languageField] / [ctrl][transOrigP...]
        var $sys_language_isocode = '';         // Is set to the iso code of the sys_language if that is properly defined by the sys_language record representing the sys_language_uid. (Requires the extension "static_info_tables")
 
                // RENDERING data
                                        $this->fePreview = 1;   // The preview flag is set only if the current page turns out to actually be hidden!
                                        $this->showHiddenPage = 1;
                                }
+
+                                       // Check root line for proper connection to tree root (done because of possible preview of page / branch versions)
+                               if (!$this->fePreview)  {
+
+                                               // Initialize the page-select functions to check rootline:
+                                       $temp_sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
+                                       $temp_sys_page->init($this->showHiddenPage);
+
+                                               // If root line contained NO records and ->error_getRootLine_failPid tells us that it was because of a pid=-1 (indicating a "version" record)...:
+                                       if (!count($temp_sys_page->getRootLine($this->id,$this->MP)) && $temp_sys_page->error_getRootLine_failPid==-1)  {
+
+                                                       // Setting versioningPreview flag and try again:
+                                               $temp_sys_page->versioningPreview = TRUE;
+                                               if (count($temp_sys_page->getRootLine($this->id,$this->MP)))    {
+                                                               // Finally, we got a root line (meaning that it WAS due to versioning preview of a page somewhere) and we set the fePreview flag which in itself will allow sys_page class to display previews of versionized records.
+                                                       $this->fePreview = 1;
+#debug('version in rootline...');
+                                               }
+                                       }
+                               }
+                       }
+
+                               // Checking for specific version preview of records:
+                       if (is_array(t3lib_div::_GP('ADMCMD_vPrev')))   {
+                               $this->fePreview = 1;
+                               $this->versionPreviewMap = t3lib_div::_GP('ADMCMD_vPrev');
                        }
 
                        if ($this->fePreview)   {       // If the front-end is showing a preview, caching MUST be disabled.
                        }
                }
                        // Final cleaning.
-               $this->id=$this->contentPid=intval($this->id);  // Make sure it's an integer
-               $this->type=intval($this->type);        // Make sure it's an integer
+               $this->id = $this->contentPid = intval($this->id);      // Make sure it's an integer
+               $this->type = intval($this->type);      // Make sure it's an integer
 
 
                        // Call post processing function for id determination:
                        // Initialize the page-select functions.
                $this->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
                $this->sys_page->init($this->showHiddenPage);
+               $this->sys_page->versioningPreview = $this->fePreview ? TRUE : FALSE;
+               if ($this->sys_page->versioningPreview) {
+                       $this->sys_page->versionPreviewMap = $this->versionPreviewMap;
+#debug($this->sys_page->versionPreviewMap);
+               }
 
                        // Set the valid usergroups for FE
                $this->initUserGroups();
 
                $GLOBALS['TT']->push('Get Compressed TC array');
                if (!$this->TCAloaded)  {
+                               // Create hash string for storage / retrieval of cached content:
                        $tempHash = md5('tables.php:'.
                                filemtime(TYPO3_extTableDef_script ? PATH_typo3conf.TYPO3_extTableDef_script : PATH_t3lib.'stddb/tables.php').
                                (TYPO3_extTableDef_script?filemtime(PATH_typo3conf.TYPO3_extTableDef_script):'').
                                ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] ? filemtime(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php') : '')
                        );
-                       $TCA = unserialize($this->sys_page->getHash($tempHash, 0));
-                       if (!$TCA)      {
+                               // Try to fetch if:
+                       list($TCA,$this->TCAcachedExtras) = unserialize($this->sys_page->getHash($tempHash, 0));
+                               // If no result, create it:
+                       if (!is_array($TCA))    {
                                $this->includeTCA(0);
-                               reset($TCA);
-                               $newTc=Array();
-                               while(list($key,$val)=each($TCA))               {
+                               $newTc = Array();
+                               $this->TCAcachedExtras = array();       // Collects other information
+
+                               foreach($TCA as $key => $val)           {
                                        $newTc[$key]['ctrl'] = $val['ctrl'];
-                                       $newTc[$key]['feInterface']=$val['feInterface'];
+                                       $newTc[$key]['feInterface'] = $val['feInterface'];
+
+                                               // Collect information about localization exclusion of fields:
+                                       t3lib_div::loadTCA($key);
+                                       if (is_array($TCA[$key]['columns']))    {
+                                               $this->TCAcachedExtras[$key]['l10n_mode'] = array();
+                                               foreach($TCA[$key]['columns'] as $fN => $fV)    {
+                                                       if ($fV['l10n_mode'])   {
+                                                               $this->TCAcachedExtras[$key]['l10n_mode'][$fN] = $fV['l10n_mode'];
+                                                       }
+                                               }
+                                       }
                                }
-                               $TCA=$newTc;
-                               $this->sys_page->storeHash($tempHash, serialize($newTc), 'SHORT TC');
+
+                                       // Store it in cache:
+                               $TCA = $newTc;
+                               $this->sys_page->storeHash($tempHash, serialize(array($newTc,$this->TCAcachedExtras)), 'SHORT TC');
                        }
                }
                $GLOBALS['TT']->pull();
 
        /**
         * Includes full TCA.
-        * Normally in the frontend only a part of the global $TCA array is loaded, for instance the "ctrL" part. Thus it doesn't take up too much memory.
+        * Normally in the frontend only a part of the global $TCA array is loaded, for instance the "ctrl" part. Thus it doesn't take up too much memory.
         * If you need the FULL TCA available for some reason (like plugins using it) you should call this function which will include the FULL TCA.
         * Global vars $TCA, $PAGES_TYPES, $LANG_GENERAL_LABELS can/will be affected.
         * The flag $this->TCAloaded will make sure that such an inclusion happens only once since; If $this->TCAloaded is set, nothing is included.
                        if (TYPO3_extTableDef_script)   {
                                include (PATH_typo3conf.TYPO3_extTableDef_script);
                        }
+
                        $this->TCAloaded = $TCAloaded;
                }
        }
                        // Get values from TypoScript:
                $this->sys_language_uid = $this->sys_language_content = intval($this->config['config']['sys_language_uid']);
                list($this->sys_language_mode,$sys_language_content) = t3lib_div::trimExplode(';', $this->config['config']['sys_language_mode']);
+               $this->sys_language_contentOL = $this->config['config']['sys_language_overlay'];
 
-                       // Request the overlay record for the sys_language_uid:
-               $olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
-
-                       // Setting sys_language if an overlay record was found (which it is only if a language is used)
-               if (!count($olRec))     {
+                       // If sys_language_uid is set to another language than default:
+               if ($this->sys_language_uid>0)  {
+                               // Request the overlay record for the sys_language_uid:
+                       $olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
+                       if (!count($olRec))     {
 
-                               // If no OL record exists and a foreign language is asked for...
-                       if ($this->sys_language_uid)    {
+                                       // If no OL record exists and a foreign language is asked for...
+                               if ($this->sys_language_uid)    {
 
-                                       // If requested translation is not available:
-                               if ($this->page['l18n_cfg']&2)  {
-                                       $this->pageNotFoundAndExit('Page is not available in the requested language.');
-                               } else {
-                                       switch((string)$this->sys_language_mode)        {
-                                               case 'strict':
-                                                       $this->pageNotFoundAndExit('Page is not available in the requested language (strict).');
-                                               break;
-                                               case 'content_fallback':
-                                                       $fallBackOrder = t3lib_div::trimExplode(',', $sys_language_content,1);
-                                                       foreach($fallBackOrder as $orderValue)  {
-                                                               if (!strcmp($orderValue,'0') || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
-                                                                       $this->sys_language_content = $orderValue;      // Setting content uid (but leaving the sys_language_uid)
-                                                                       break;
+                                               // If requested translation is not available:
+                                       if ($this->page['l18n_cfg']&2)  {
+                                               $this->pageNotFoundAndExit('Page is not available in the requested language.');
+                                       } else {
+                                               switch((string)$this->sys_language_mode)        {
+                                                       case 'strict':
+                                                               $this->pageNotFoundAndExit('Page is not available in the requested language (strict).');
+                                                       break;
+                                                       case 'content_fallback':
+                                                               $fallBackOrder = t3lib_div::trimExplode(',', $sys_language_content,1);
+                                                               foreach($fallBackOrder as $orderValue)  {
+                                                                       if (!strcmp($orderValue,'0') || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
+                                                                               $this->sys_language_content = $orderValue;      // Setting content uid (but leaving the sys_language_uid)
+                                                                               break;
+                                                                       }
                                                                }
-                                                       }
-                                               break;
-                                               default:
-                                                               // Default is that everything defaults to the default language...
-                                                       $this->sys_language_uid = $this->sys_language_content = 0;
-                                               break;
+                                                       break;
+                                                       default:
+                                                                       // Default is that everything defaults to the default language...
+                                                               $this->sys_language_uid = $this->sys_language_content = 0;
+                                                       break;
+                                               }
                                        }
                                }
+                       } else {
+                                       // Setting sys_language if an overlay record was found (which it is only if a language is used)
+                               $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
                        }
-               } else {
-                       $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
                }
+
+                       // Setting sys_language_uid inside sys-page:
                $this->sys_page->sys_language_uid = $this->sys_language_uid;
 
                        // If default translation is not available:
                                $this->sys_language_isocode=$stLrow['lg_iso_2'];
                        }
                }
+
+                       // Setting softMergeIfNotBlank:
+               $table_fields = t3lib_div::trimExplode(',', $this->config['config']['sys_language_softMergeIfNotBlank'],1);
+               foreach($table_fields as $TF)   {
+                       list($tN,$fN) = explode(':',$TF);
+                       $this->TCAcachedExtras[$tN]['l10n_mode'][$fN] = 'mergeIfNotBlank';
+               }
        }
 
        /**
                        }
                }
 
-                       // Storing page
+                       // Processing if caching is enabled:
                if (!$this->no_cache)   {
                                        // Tidy up the code, if flag...
                        if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'cached')            {
                                        t3lib_div::callUserFunction($_funcRef,$_params,$this);
                                }
                        }
-
-                       $this->realPageCacheContent();
-               } elseif ($this->tempContent)   {               // If there happens to be temporary content in the cache and the cache was not cleared due to new content put in it... ($this->no_cache=0)
-                       $this->clearPageCacheContent();
                }
 
+                       // Indexing the page?
                if ($this->isSearchIndexPage()) {
                        $GLOBALS['TT']->push('Index page','');
                                $indexer = t3lib_div::makeInstance('tx_indexedsearch_indexer');
                        $GLOBALS['TT']->setTSlogMessage('Index page? No, page was set to "no_cache" and so cannot be indexed.');
                        $GLOBALS['TT']->pull();
                }
+
+                       // Convert char-set for output:
+               $this->content = $this->convOutputCharset($this->content,'mainpage');
+
+                       // Storing for cache:
+               if (!$this->no_cache)   {
+                       $this->realPageCacheContent();
+               } elseif ($this->tempContent)   {               // If there happens to be temporary content in the cache and the cache was not cleared due to new content put in it... ($this->no_cache=0)
+                       $this->clearPageCacheContent();
+               }
+
+                       // Sets sys-last-change:
                $this->setSysLastChanged();
        }
 
                $this->divSection='';
 
                $INTiS_config = $GLOBALS['TSFE']->config['INTincScript'];
-               reset($INTiS_splitC);
-               while(list($INTiS_c,$INTiS_cPart)=each($INTiS_splitC))  {
+               foreach($INTiS_splitC as $INTiS_c => $INTiS_cPart)      {
                        if (substr($INTiS_cPart,32,3)=='-->')   {       // If the split had a comment-end after 32 characters it's probably a split-string
                                $GLOBALS['TT']->push('Include '.$INTiS_config[$INTiS_key]['file'],'');
                                $INTiS_key = 'INT_SCRIPT.'.substr($INTiS_cPart,0,32);
                                                break;
                                        }
                                }
-                               $this->content.= $incContent;
+                               $this->content.= $this->convOutputCharset($incContent,'INC-'.$INTiS_c);
                                $this->content.= substr($INTiS_cPart,35);
                                $GLOBALS['TT']->pull($incContent);
                        } else {
-                               $this->content.= ($c?'<!--INT_SCRIPT.':'').$INTiS_cPart;
+                               $this->content.= ($INTiS_c?'<!--INT_SCRIPT.':'').$INTiS_cPart;
                        }
                }
                $GLOBALS['TT']->push('Substitute header section');
                $this->INTincScript_loadJSCode();
-               $this->content = str_replace('<!--HD_'.$this->config['INTincScript_ext']['divKey'].'-->', implode(chr(10),$this->additionalHeaderData), $this->content);
-               $this->content = str_replace('<!--TDS_'.$this->config['INTincScript_ext']['divKey'].'-->', $this->divSection, $this->content);
+               $this->content = str_replace('<!--HD_'.$this->config['INTincScript_ext']['divKey'].'-->', $this->convOutputCharset(implode(chr(10),$this->additionalHeaderData),'HD'), $this->content);
+               $this->content = str_replace('<!--TDS_'.$this->config['INTincScript_ext']['divKey'].'-->', $this->convOutputCharset($this->divSection,'TDS'), $this->content);
                $this->setAbsRefPrefix();
                $GLOBALS['TT']->pull();
        }
@@ -3151,6 +3223,32 @@ if (version == "n3") {
                        return $str;
                }
        }
+
+       /**
+        * Converts input string from renderCharset to metaCharset IF the two charsets are different.
+        *
+        * @param       string  Content to be converted.
+        * @param       string  Label (just for fun, no function)
+        * @return      string  Converted content string.
+        */
+       function convOutputCharset($content,$label)     {
+               if ($this->renderCharset != $this->metaCharset) {
+                       $content = $this->csConvObj->conv($content,$this->renderCharset,$this->metaCharset,TRUE);
+               }
+
+               return $content;
+       }
+
+       /**
+        * Converts the $_POST array from metaCharset (page HTML charset from input form) to renderCharset (internal processing) IF the two charsets are different.
+        *
+        * @return      void
+        */
+       function convPOSTCharset()      {
+               if ($this->renderCharset != $this->metaCharset && is_array($_POST) && count($_POST))    {
+                       $this->csConvObj->convArray($_POST,$this->metaCharset,$this->renderCharset);
+               }
+       }
 }
 
 
index 4780e87..1317f32 100755 (executable)
@@ -799,7 +799,11 @@ class tslib_menu {
                        if (!t3lib_div::inList($this->doktypeExcludeList,$data['doktype']))     {               // Page may not be 'not_in_menu' or 'Backend User Section'
                                if (!$data['nav_hide']) {       // Not hidden in navigation
                                        if (!t3lib_div::inArray($banUidArray,$uid))     {       // not in banned uid's
-                                               if (!(!$GLOBALS['TSFE']->sys_language_uid && $data['l18n_cfg']&1))      {       // Checks if the default language version can be shown:
+
+                                                       // Checks if the default language version can be shown:
+                                                       // Block page is set, if l18n_cfg allows plus: 1) Either default language or 2) another language but NO overlay record set for page!
+                                               $blockPage = $data['l18n_cfg']&1 && (!$GLOBALS['TSFE']->sys_language_uid || ($GLOBALS['TSFE']->sys_language_uid && !$data['_PAGES_OVERLAY']));
+                                               if (!$blockPage)        {
 
                                                                // Checking if a page should be shown in the menu depending on whether a translation exists:
                                                        $tok = TRUE;
index 83cf54c..3ae343f 100755 (executable)
@@ -262,6 +262,13 @@ $TT->push('Process ID','');
 $TT->pull();
 
 
+// *******************************************
+// Get compressed $TCA-Array();
+// After this, we should now have a valid $TCA, though minimized
+// *******************************************
+$TSFE->getCompressedTCarray();
+
+
 // ********************************
 // Starts the template
 // *******************************
@@ -285,11 +292,10 @@ $TT->pull();
 $TSFE->getConfigArray();
 
 
-// *******************************************
-// Get compressed $TCA-Array();
-// After this, we should now have a valid $TCA, though minimized
-// *******************************************
-$TSFE->getCompressedTCarray();
+// ********************************
+// Convert POST data to internal "renderCharset" if different from the metaCharset:
+// *******************************
+$TSFE->convPOSTCharset();
 
 
 // *******************************************
@@ -363,14 +369,13 @@ if ($TSFE->isINTincScript())              {
 
                        // Special feature: Include libraries
                $TT->push('Include libraries');
-               reset($INTiS_config);
-               while(list(,$INTiS_cPart)=each($INTiS_config))  {
+               foreach($INTiS_config as $INTiS_cPart)  {
                        if ($INTiS_cPart['conf']['includeLibs'])        {
                                $INTiS_resourceList = t3lib_div::trimExplode(',',$INTiS_cPart['conf']['includeLibs'],1);
                                $GLOBALS['TT']->setTSlogMessage('Files for inclusion: "'.implode(', ',$INTiS_resourceList).'"');
-                               reset($INTiS_resourceList);
-                               while(list(,$INTiS_theLib)=each($INTiS_resourceList))   {
-                                       $INTiS_incFile=$GLOBALS['TSFE']->tmpl->getFileName($INTiS_theLib);
+
+                               foreach($INTiS_resourceList as $INTiS_theLib)   {
+                                       $INTiS_incFile = $GLOBALS['TSFE']->tmpl->getFileName($INTiS_theLib);
                                        if ($INTiS_incFile)     {
                                                require_once('./'.$INTiS_incFile);
                                        } else {
index a1e69ae..ddfd53f 100644 (file)
@@ -202,6 +202,7 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
 
                                // Put into cell:
                        $tCells[] = '<td class="'.$status.' c-leftLine">'.$info.'</td>';
+                       $tCells[] = '<td class="'.$status.'" title="'.$LANG->getLL('lang_renderl10n_CEcount','1').'" align="center">'.$this->getContentElementCount($data['row']['uid'],0).'</td>';
 
                                // Traverse system languages:
                        foreach($languages as $langRow) {
@@ -238,7 +239,7 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
                                        $info.= str_replace('###LANG_UID###',$langRow['uid'],$viewPageLink);
 
                                        $tCells[] = '<td class="'.$status.'">'.$info.'</td>';
-                                       $tCells[] = '<td class="'.$status.'">&nbsp;</td>';
+                                       $tCells[] = '<td class="'.$status.'" title="'.$LANG->getLL('lang_renderl10n_CEcount','1').'" align="center">'.$this->getContentElementCount($data['row']['uid'],$langRow['uid']).'</td>';
                                } else {
                                        $status = $data['row']['l18n_cfg']&2 || $data['row']['l18n_cfg']&1 ? 'c-blocked' : 'c-fallback';
                                        $tCells[] = '<td class="'.$status.' c-leftLine">&nbsp;</td>';
@@ -270,7 +271,7 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
                                <img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('lang_renderl10n_editPageHeaders','1').'" border="0" alt="" />
                                </a>';
                } else $editIco = '';
-               $tCells[] = '<td class="c-leftLine">'.
+               $tCells[] = '<td class="c-leftLine" colspan="2">'.
                                        $LANG->getLL('lang_renderl10n_default','1').':'.
                                        $editIco.
                                        '</td>';
@@ -354,6 +355,26 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
 
                return $row;
        }
+
+       /**
+        * Counting content elements for a single language on a page.
+        *
+        * @param       integer         Page id to select for.
+        * @param       integer         Sys language uid
+        * @return      integer         Number of content elements from the PID where the language is set to a certain value.
+        */
+       function getContentElementCount($pageId,$sysLang)       {
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                       'count(*)',
+                       'tt_content',
+                       'pid='.intval($pageId).
+                               ' AND sys_language_uid='.intval($sysLang).
+                               t3lib_BEfunc::deleteClause('tt_content')
+               );
+
+               list($count) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
+               return $count ? $count : '-';
+       }
 }
 
 
index 945bd22..14fa8b5 100755 (executable)
@@ -35,6 +35,7 @@
                        <label index="lang_renderl10n_page">Page</label>
                        <label index="lang_renderl10n_default">Default</label>
                        <label index="lang_getlangsta_createNewTranslationHeaders">Create new translation headers</label>
+                       <label index="lang_renderl10n_CEcount">Content Element Count</label>
                </languageKey>
                <languageKey index="dk" type="array">
                        <label index="page_title">Overblik over sidetræ</label>
index 8534eda..9753f61 100755 (executable)
@@ -82,6 +82,11 @@ Do you want to continue WITHOUT saving?</label>
                        <label index="labels.revertSelection">Revert selection</label>
                        <label index="labels.setAllCheckboxes">Select All Checkboxes</label>
                        <label index="labels.changeInOrig">Change in original</label>
+                       <label index="ver.online">ONLINE</label>
+                       <label index="ver.mgm">Version Management</label>
+                       <label index="ver.selVer">Select version:</label>
+                       <label index="ver.swap">Swap/Publish</label>
+                       <label index="ver.swapPage">Publish this version of the page including content</label>
                        <label index="TYPO3_Element_Browser">TYPO3 Element Browser</label>
                        <label index="show_item.php.viewItem">View Item</label>
                        <label index="show_item.php.file">File</label>
index ef91aae..0581c46 100755 (executable)
@@ -1655,6 +1655,73 @@ $str.=$this->docBodyTagBegin().
                        </script>
                ';
        }
+
+       /**
+        * Creates the version selector for the page id inputted.
+        * Requires the core version management extension, "version" to be loaded.
+        *
+        * @param       integer         Page id to create selector for.
+        * @param       boolean         If set, there will be no button for swapping page.
+        * @return      void
+        */
+       function getVersionSelector($id,$noAction=FALSE)        {
+
+               if ($id>0 && t3lib_extMgm::isLoaded('version')) {
+
+                               // Get Current page record:
+                       $curPage = t3lib_BEfunc::getRecord('pages',$id);
+                               // If the selected page is not online, find the right ID
+                       $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id);
+                               // Select all versions of online version:
+                       $versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_id');
+
+                               // If more than one was found...:
+                       if (count($versions)>1) {
+
+                                       // Create selector box entries:
+                               $opt = array();
+                               foreach($versions as $vRow)     {
+                                       $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$vRow['uid']))).'"'.($id==$vRow['uid']?' selected="selected"':'').'>'.
+                                                       htmlspecialchars($vRow['t3ver_label'].' [v#'.$vRow['t3ver_id'].']'.($vRow['uid']==$onlineId ? ' =>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online').'<=':'')).
+                                                       '</option>';
+                               }
+
+                                       // Add management link:
+                               $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$id))).'">---</option>';
+                               $opt[] = '<option value="'.htmlspecialchars($this->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?table=pages&uid='.$onlineId).'">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.mgm',1).'</option>';
+
+                                       // Create onchange handler:
+                               $onChange = "document.location=this.options[this.selectedIndex].value;";
+
+                                       // Controls:
+                               if ($id==$onlineId)     {
+                                       $controls = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="absmiddle" alt="" /> <b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online',1).'</b>';
+                               } elseif (!$noAction) {
+                                       $controls = '<a href="'.$this->issueCommand('&cmd[pages]['.$onlineId.'][version][swapWith]='.$id.'&cmd[pages]['.$onlineId.'][version][action]=swap&cmd[pages]['.$onlineId.'][version][swapContent]=1',t3lib_div::linkThisScript(array('id'=>$onlineId))).'">'.
+                                                       '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/insert2.gif','width="14" height="14"').' style="margin-right: 2px;" class="absmiddle" alt="" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swapPage',1).'" />'.
+                                                       '<b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap',1).'</b></a>';
+                               }
+
+                                       // Write out HTML code:
+                               return '
+
+                                       <!--
+                                               Version selector:
+                                       -->
+                                       <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
+                                               <tr>
+                                                       <td>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.selVer',1).'</td>
+                                                       <td>
+                                                               <select onchange="'.htmlspecialchars($onChange).'">
+                                                                       '.implode('',$opt).'
+                                                               </select></td>
+                                                       <td>'.$controls.'</td>
+                                               </tr>
+                                       </table>
+                               ';
+                       }
+               }
+       }
 }
 
 
@@ -1724,4 +1791,4 @@ $LANG->init($BE_USER->uc['lang']);
 // The template is loaded
 // ******************************
 $TBE_TEMPLATE = t3lib_div::makeInstance('template');
-?>
+?>
\ No newline at end of file
index 80e063e..7861600 100755 (executable)
@@ -123,7 +123,7 @@ class SC_wizard_rte {
                global $BE_USER,$LANG;
 
                        // If all parameters are available:
-               if ($this->P['table'] && $this->P['field'] && $this->P['uid'])  {
+               if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'],$this->P['uid']))     {
 
                                // Getting the raw record (we need only the pid-value from here...)
                        $rawRec = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
@@ -278,6 +278,36 @@ class SC_wizard_rte {
        function printContent() {
                echo $this->content;
        }
+
+       /**
+        * Checks access for element
+        *
+        * @param       string          Table name
+        * @param       integer         Record uid
+        * @return      void
+        */
+       function checkEditAccess($table,$uid)   {
+               global $BE_USER;
+
+               $calcPRec = t3lib_BEfunc::getRecord($table,$uid);
+               t3lib_BEfunc::fixVersioningPid($table,$uid);
+               if (is_array($calcPRec))        {
+                       if ($table=='pages')    {       // If pages:
+                               $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
+                               $hasAccess = $CALC_PERMS&2 ? TRUE : FALSE;
+                       } else {
+                               $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid']));   // Fetching pid-record first.
+                               $hasAccess = $CALC_PERMS&16 ? TRUE : FALSE;
+                       }
+
+                               // Check internals regarding access:
+                       if ($hasAccess) {
+                               $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec);
+                       }
+               } else $hasAccess = FALSE;
+
+               return $hasAccess;
+       }
 }
 
 // Include extension?