Fixed bug #13294: IRRE deleted combo records are still validated by TBE_EDITOR (Thank...
[Packages/TYPO3.CMS.git] / typo3 / class.db_list_extra.inc
index 03fe2f4..91a8a65 100644 (file)
@@ -2,7 +2,7 @@
 /*************************************************************
 *  Copyright notice
 *
 /*************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * Used specifically for the Web>List module (db_list.php)
  *
  * $Id$
  * Used specifically for the Web>List module (db_list.php)
  *
  * $Id$
- * Revised for TYPO3 3.6 December/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 December/2003 by Kasper Skårhøj
  * XHTML compliant
  *
  * XHTML compliant
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
@@ -83,7 +83,7 @@
 /**
  * Class for rendering of Web>List module
  *
 /**
  * Class for rendering of Web>List module
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
  * @package TYPO3
  * @subpackage core
  */
@@ -107,7 +107,9 @@ class localRecordList extends recordList {
                // Internal:
        var $pageRow=array();                                   // Set to the page record (see writeTop())
 
                // Internal:
        var $pageRow=array();                                   // Set to the page record (see writeTop())
 
-       var $csvLines=array();                                  // Used to accumulate CSV lines in for CSV export.
+               // Used to accumulate CSV lines for CSV export.
+       protected $csvLines = array();
+
        var $csvOutput=FALSE;                                   // If set, the listing is returned as CSV instead.
 
        /**
        var $csvOutput=FALSE;                                   // If set, the listing is returned as CSV instead.
 
        /**
@@ -207,7 +209,7 @@ class localRecordList extends recordList {
                                        // Edit
                                $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit';
                                $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, -1)) . '" title="' . $LANG->getLL('editPage', TRUE) . '">' .
                                        // Edit
                                $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit';
                                $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, -1)) . '" title="' . $LANG->getLL('editPage', TRUE) . '">' .
-                                                                       t3lib_iconWorks::getSpriteIcon('actions-document-open') .
+                                                                       t3lib_iconWorks::getSpriteIcon('actions-page-open') .
                                                                '</a>';
                                        // Unhide
                                if ($this->pageRow['hidden'])   {
                                                                '</a>';
                                        // Unhide
                                if ($this->pageRow['hidden'])   {
@@ -281,7 +283,7 @@ class localRecordList extends recordList {
                                // Back
                        if ($this->returnUrl) {
                                $buttons['back'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', TRUE) . '">' .
                                // Back
                        if ($this->returnUrl) {
                                $buttons['back'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', TRUE) . '">' .
-                                                                       t3lib_iconWorks::getSpriteIcon('actions-go-back') .
+                                                                       t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
                                                                '</a>';
                        }
                }
                                                                '</a>';
                        }
                }
@@ -467,37 +469,23 @@ class localRecordList extends recordList {
                                // Header line is drawn
                        $theData = Array();
                        if ($this->disableSingleTableView)      {
                                // Header line is drawn
                        $theData = Array();
                        if ($this->disableSingleTableView)      {
-                               $theData[$titleCol] = '<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.')';
+                               $theData[$titleCol] = '<span class="c-table">' . t3lib_BEfunc::wrapInHelp($table, '', $GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'], TRUE)) . '</span> ('.$this->totalItems.')';
                        } else {
                                $theData[$titleCol] = $this->linkWrapTable($table, '<span class="c-table">' . $GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'], TRUE) . '</span> (' . $this->totalItems . ') ' .
                                                ($this->table ? t3lib_iconWorks::getSpriteIcon('actions-view-table-collapse', array('title' => $GLOBALS['LANG']->getLL('contractView', TRUE))) : t3lib_iconWorks::getSpriteIcon('actions-view-table-expand', array('title' => $GLOBALS['LANG']->getLL('expandView', TRUE))))
                                        );
                        }
 
                        } else {
                                $theData[$titleCol] = $this->linkWrapTable($table, '<span class="c-table">' . $GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'], TRUE) . '</span> (' . $this->totalItems . ') ' .
                                                ($this->table ? t3lib_iconWorks::getSpriteIcon('actions-view-table-collapse', array('title' => $GLOBALS['LANG']->getLL('contractView', TRUE))) : t3lib_iconWorks::getSpriteIcon('actions-view-table-expand', array('title' => $GLOBALS['LANG']->getLL('expandView', TRUE))))
                                        );
                        }
 
-                               // CSH:
-                       $theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
-
                        if ($listOnlyInSingleTableMode) {
                                $out.='
                                        <tr>
                        if ($listOnlyInSingleTableMode) {
                                $out.='
                                        <tr>
-                                               <td class="t3-row-header" style="width:95%;">' . $theData[$titleCol] . '</td>
-                                       </tr>';
-
-                               if ($GLOBALS['BE_USER']->uc["edit_showFieldHelp"])      {
-                                       $GLOBALS['LANG']->loadSingleTableDescription($table);
-                                       if (isset($GLOBALS['TCA_DESCR'][$table]['columns']['']))        {
-                                               $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$table.'.\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
-                                               $out.='
-                                       <tr>
-                                               <td class="c-tableDescription">'.t3lib_BEfunc::helpTextIcon($table,'',$this->backPath,TRUE).$GLOBALS['TCA_DESCR'][$table]['columns']['']['description'].'</td>
+                                               <td class="t3-row-header" style="width:95%;">' . t3lib_BEfunc::wrapInHelp($table, '', $theData[$titleCol]) . '</td>
                                        </tr>';
                                        </tr>';
-                                       }
-                               }
                        } else {
                                // Render collapse button if in multi table mode
                                $collapseIcon = '';
                                if (!$this->table) {
                        } else {
                                // Render collapse button if in multi table mode
                                $collapseIcon = '';
                                if (!$this->table) {
-                                       $collapseIcon = '<a href="' . htmlspecialchars($this->listURL()) . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1') . '" title="' . ($tableCollapsed ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.expandTable', TRUE) : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.collapseTable', TRUE)) . '">' .
+                                       $collapseIcon = '<a href="' . htmlspecialchars($this->listURL() . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1')) . '" title="' . ($tableCollapsed ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.expandTable', TRUE) : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.collapseTable', TRUE)) . '">' .
                                                        ($tableCollapsed ? t3lib_iconWorks::getSpriteIcon('actions-view-list-expand', array('class' => 'collapseIcon')) : t3lib_iconWorks::getSpriteIcon('actions-view-list-collapse', array('class' => 'collapseIcon'))) .
                                                '</a>';
                                }
                                                        ($tableCollapsed ? t3lib_iconWorks::getSpriteIcon('actions-view-list-expand', array('class' => 'collapseIcon')) : t3lib_iconWorks::getSpriteIcon('actions-view-list-collapse', array('class' => 'collapseIcon'))) .
                                                '</a>';
                                }
@@ -591,8 +579,7 @@ class localRecordList extends recordList {
 
                                        // Record navigation is added to the beginning and end of the table if in single table mode
                                if ($this->table) {
 
                                        // Record navigation is added to the beginning and end of the table if in single table mode
                                if ($this->table) {
-                                       $pageNavigation = $this->renderListNavigation();
-                                       $iOut = $pageNavigation . $iOut . $pageNavigation;
+                                       $iOut = $this->renderListNavigation('top') . $iOut . $this->renderListNavigation('bottom');
                                } else {
                                                // show that there are more records than shown
                                        if ($this->totalItems > $this->itemsLimitPerTable) {
                                } else {
                                                // show that there are more records than shown
                                        if ($this->totalItems > $this->itemsLimitPerTable) {
@@ -680,7 +667,6 @@ class localRecordList extends recordList {
 
                                // The icon with link
                        $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
 
                                // The icon with link
                        $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
-                       //$iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($alttext).'"'.);
                        $iconImg = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => ($indent ? ' margin-left: ' . $indent . 'px;' : '')));
 
 
                        $iconImg = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => ($indent ? ' margin-left: ' . $indent . 'px;' : '')));
 
 
@@ -694,7 +680,7 @@ class localRecordList extends recordList {
                                                // If the record is edit-locked by another user, we will show a little warning sign:
                                        if (($lockInfo = t3lib_BEfunc::isRecordLocked($table, $row['uid']))) {
                                                $warning = '<a href="#" onclick="' . htmlspecialchars('alert(' . $GLOBALS['LANG']->JScharCode($lockInfo['msg']) . '); return false;') . '" title="' . htmlspecialchars($lockInfo['msg']) . '">' .
                                                // If the record is edit-locked by another user, we will show a little warning sign:
                                        if (($lockInfo = t3lib_BEfunc::isRecordLocked($table, $row['uid']))) {
                                                $warning = '<a href="#" onclick="' . htmlspecialchars('alert(' . $GLOBALS['LANG']->JScharCode($lockInfo['msg']) . '); return false;') . '" title="' . htmlspecialchars($lockInfo['msg']) . '">' .
-                                                               t3lib_iconWorks::getSpriteIcon('status-warning-record') .
+                                                               t3lib_iconWorks::getSpriteIcon('status-warning-in-use') .
                                                        '</a>';
                                        }
                                        $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
                                                        '</a>';
                                        }
                                        $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
@@ -731,7 +717,9 @@ class localRecordList extends recordList {
                                } else {
                                        $tmpProc = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']);
                                        $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
                                } else {
                                        $tmpProc = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']);
                                        $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
-                                       $row[$fCol] = $tmpProc;
+                                       if ($this->csvOutput) {
+                                               $row[$fCol] = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']);
+                                       }
                                }
                        }
 
                                }
                        }
 
@@ -770,7 +758,7 @@ class localRecordList extends recordList {
         * @param       integer         Uid of current record
         * @return      void
         *
         * @param       integer         Uid of current record
         * @return      void
         *
-        * @deprecated since 4.4: Use getReferenceCount instead
+        * @deprecated since 4.4, will be removed in TYPO3 4.6 - Use getReferenceCount instead
         */
        function setReferences($table, $uid) {
                t3lib_div::logDeprecatedFunction();
         */
        function setReferences($table, $uid) {
                t3lib_div::logDeprecatedFunction();
@@ -999,15 +987,15 @@ class localRecordList extends recordList {
        /**
         * Creates a page browser for tables with many records
         *
        /**
         * Creates a page browser for tables with many records
         *
+        * @param       string          Distinguish between 'top' and 'bottom' part of the navigation (above or below the records)
         * @return      string  Navigation HTML
         *
         * @return      string  Navigation HTML
         *
-        * @author      Dmitry Pikhno <dpi@goldenplanet.com>
-        * @author      Christian Kuhn <lolli@schwarzbu.ch>
         */
         */
-       protected function renderListNavigation() {
+       protected function renderListNavigation($renderPart = 'top') {
                $totalPages = ceil($this->totalItems / $this->iLimit);
 
                $content = '';
                $totalPages = ceil($this->totalItems / $this->iLimit);
 
                $content = '';
+               $returnContent = '';
 
                        // Show page selector if not all records fit into one page
                if ($totalPages > 1) {
 
                        // Show page selector if not all records fit into one page
                if ($totalPages > 1) {
@@ -1021,60 +1009,55 @@ class localRecordList extends recordList {
                        if ($currentPage > 1) {
                                $labelFirst = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:first');
 
                        if ($currentPage > 1) {
                                $labelFirst = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:first');
 
-                               $first = '<a href="' . $listURL . '&pointer=0">
-                                       <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_first.gif')
-                                       . 'alt="' . $labelFirst . '" title="' . $labelFirst . '" />
-                               </a>';
+                               $first = '<a href="' . $listURL . '&pointer=0">' .
+                                       t3lib_iconWorks::getSpriteIcon('actions-view-paging-first', array('title'=> $labelFirst)) .
+                               '</a>';
                        } else {
                        } else {
-                               $first = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_first_disabled.gif') . 'alt="" title="" />';
+                               $first = t3lib_iconWorks::getSpriteIcon('actions-view-paging-first-disabled');
                        }
 
                        if (($currentPage - 1) > 0) {
                                $labelPrevious = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:previous');
 
                        }
 
                        if (($currentPage - 1) > 0) {
                                $labelPrevious = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:previous');
 
-                               $previous = '<a href="' . $listURL . '&pointer=' . (($currentPage - 2) * $this->iLimit) . '">
-                                       <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_previous.gif')
-                                       . 'alt="' . $labelPrevious . '" title="' . $labelPrevious . '" />
-                                       </a>';
+                               $previous = '<a href="' . $listURL . '&pointer=' . (($currentPage - 2) * $this->iLimit) . '">' .
+                                       t3lib_iconWorks::getSpriteIcon('actions-view-paging-previous', array('title' => $labelPrevious)) .
+                                       '</a>';
                        } else {
                        } else {
-                               $previous = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_previous_disabled.gif') . 'alt="" title="" />';
+                               $previous = t3lib_iconWorks::getSpriteIcon('actions-view-paging-previous-disabled');
                        }
 
                        if (($currentPage + 1) <= $totalPages) {
                                $labelNext = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:next');
 
                        }
 
                        if (($currentPage + 1) <= $totalPages) {
                                $labelNext = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:next');
 
-                               $next = '<a href="' . $listURL . '&pointer=' . (($currentPage) * $this->iLimit) . '">
-                                       <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_next.gif')
-                                       . 'alt="' . $labelNext . '" title="' . $labelNext . '" />
-                                       </a>';
+                               $next = '<a href="' . $listURL . '&pointer=' . (($currentPage) * $this->iLimit) . '">' .
+                                       t3lib_iconWorks::getSpriteIcon('actions-view-paging-next', array('title' => $labelNext)) .
+                                       '</a>';
                        } else {
                        } else {
-                               $next = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_next_disabled.gif') . 'alt="" title="" />';
+                               $next = t3lib_iconWorks::getSpriteIcon('actions-view-paging-next-disabled');
                        }
 
                        if ($currentPage != $totalPages) {
                                $labelLast = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:last');
 
                        }
 
                        if ($currentPage != $totalPages) {
                                $labelLast = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:last');
 
-                               $last = '<a href="' . $listURL . '&pointer=' . (($totalPages - 1) * $this->iLimit) . '">
-                                       <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_last.gif')
-                                       . 'alt="' . $labelLast . '" title="' . $labelLast . '" />
-                                       </a>';
+                               $last = '<a href="' . $listURL . '&pointer=' . (($totalPages - 1) * $this->iLimit) . '">' .
+                                       t3lib_iconWorks::getSpriteIcon('actions-view-paging-last', array('title' => $labelLast)) .
+                                       '</a>';
                        } else {
                        } else {
-                               $last = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_last_disabled.gif') . 'alt="" title="" />';
+                               $last = t3lib_iconWorks::getSpriteIcon('actions-view-paging-last-disabled');
                        }
 
                        $reload = '<a href="#" onclick="document.dblistForm.action=\''
                        }
 
                        $reload = '<a href="#" onclick="document.dblistForm.action=\''
-                               . $listURL . '&pointer=\'+calculatePointer(); document.dblistForm.submit(); return true;" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:reload', TRUE) . '">' .
+                               . $listURL . '&pointer=\'+calculatePointer(document.getElementById(\'jumpPage-' . $renderPart .'\').value); document.dblistForm.submit(); return true;" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:reload', TRUE) . '">' .
                                        t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
                                '</a>';
 
                                        t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
                                '</a>';
 
-                       // Add js to traverse a page select input to a pointer value
-                       $content = '
+                       if ($renderPart === 'top') {
+                                       // Add js to traverse a page select input to a pointer value
+                               $content = '
 <script type="text/JavaScript">
 /*<![CDATA[*/
 
 <script type="text/JavaScript">
 /*<![CDATA[*/
 
-       function calculatePointer(){
-               page = document.getElementById(\'jumpPage\').value;
-
+       function calculatePointer(page) {
                if (page > ' . $totalPages . ') {
                        page = ' . $totalPages . ';
                }
                if (page > ' . $totalPages . ') {
                        page = ' . $totalPages . ';
                }
@@ -1091,10 +1074,10 @@ class localRecordList extends recordList {
 /*]]>*/
 </script>
 ';
 /*]]>*/
 </script>
 ';
-
+                       }
                        $pageNumberInput = '<span>
                                <input type="text" value="' . $currentPage
                        $pageNumberInput = '<span>
                                <input type="text" value="' . $currentPage
-                               . '" size="3" id="jumpPage" name="jumpPage" onkeyup="if (event.keyCode == Event.KEY_RETURN) { document.dblistForm.action=\'' . $listURL . '&pointer=\'+calculatePointer(); document.dblistForm.submit(); } return true;" />
+                               . '" size="3" id="jumpPage-' . $renderPart . '" name="jumpPage-' . $renderPart . '" onkeyup="if (event.keyCode == Event.KEY_RETURN) { document.dblistForm.action=\'' . $listURL . '&pointer=\'+calculatePointer(this.value); document.dblistForm.submit(); } return true;" />
                                </span>';
                        $pageIndicator = '<span class="pageIndicator">'
                                . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:pageIndicator'), $pageNumberInput, $totalPages)
                                </span>';
                        $pageIndicator = '<span class="pageIndicator">'
                                . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:pageIndicator'), $pageNumberInput, $totalPages)
@@ -1117,13 +1100,15 @@ class localRecordList extends recordList {
                                . $next . $last . '<span class="bar">&nbsp;</span>'
                                . $reload
                                . '</div>';
                                . $next . $last . '<span class="bar">&nbsp;</span>'
                                . $reload
                                . '</div>';
-               } // end of if pages > 1
 
 
-               $data = Array();
-               $titleColumn = $this->fieldArray[0];
-               $data[$titleColumn] = $content;
+                       $data = Array();
+                       $titleColumn = $this->fieldArray[0];
+                       $data[$titleColumn] = $content;
+
+                       $returnContent = $this->addElement(1, '', $data);
+               } // end of if pages > 1
 
 
-               return ($this->addElement(1, '', $data));
+               return $returnContent;
        }
 
 
        }
 
 
@@ -1215,7 +1200,7 @@ class localRecordList extends recordList {
                                                        $versionIcon = count($vers) - 1;
                                                }
 
                                                        $versionIcon = count($vers) - 1;
                                                }
 
-                                               $cells['version']='<a href="'.htmlspecialchars($this->backPath.t3lib_extMgm::extRelPath('version')).'cm1/index.php?table='.rawurlencode($table).'&uid='.rawurlencode($row['uid']).'" title="'.$LANG->getLL('displayVersions', TRUE) . '">' .
+                                               $cells['version'] = '<a href="' . htmlspecialchars($this->backPath . t3lib_extMgm::extRelPath('version') . 'cm1/index.php?table=' . rawurlencode($table) . '&uid=' . rawurlencode($row['uid'])) . '" title="' . $LANG->getLL('displayVersions', TRUE) . '">' .
                                                                t3lib_iconWorks::getSpriteIcon('status-version-' . $versionIcon) .
                                                                '</a>';
                                        } elseif(!$this->table) {
                                                                t3lib_iconWorks::getSpriteIcon('status-version-' . $versionIcon) .
                                                                '</a>';
                                        } elseif(!$this->table) {
@@ -1347,7 +1332,7 @@ class localRecordList extends recordList {
                /**
                 * @hook                        recStatInfoHooks: Allows to insert HTML before record icons on various places
                 * @date                        2007-09-22
                /**
                 * @hook                        recStatInfoHooks: Allows to insert HTML before record icons on various places
                 * @date                        2007-09-22
-                * @request             Kasper Skaarhoj  <kasper2007@typo3.com>
+                * @request             Kasper Skårhøj  <kasper2007@typo3.com>
                 */
                if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks']))     {
                        $stat='';
                 */
                if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks']))     {
                        $stat='';
@@ -1475,7 +1460,7 @@ class localRecordList extends recordList {
         * @param       integer         UID of record
         * @return      string          HTML-table
         *
         * @param       integer         UID of record
         * @return      string          HTML-table
         *
-        * @deprecated since 4.4: Use getReferenceHTML() instead
+        * @deprecated since 4.4, will be removed in TYPO3 4.6 - Use getReferenceHTML() instead
         */
        function makeRef($table,$uid)   {
                t3lib_div::logDeprecatedFunction();
         */
        function makeRef($table,$uid)   {
                t3lib_div::logDeprecatedFunction();
@@ -1570,9 +1555,10 @@ class localRecordList extends recordList {
                        $lNew = '';
                        foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)        {
                                if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage))      {
                        $lNew = '';
                        foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)        {
                                if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage))      {
-                                       $href = $this->backPath . $GLOBALS['TBE_TEMPLATE']->issueCommand(
-                                               '&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,
-                                               $this->listURL().'&justLocalized='.rawurlencode($table.':'.$row['uid'].':'.$lUid_OnPage)
+                                       $url = substr($this->listURL(), strlen($this->backPath));
+                                       $href = $GLOBALS['SOBE']->doc->issueCommand(
+                                               '&cmd[' . $table . '][' . $row['uid'] . '][localize]=' . $lUid_OnPage,
+                                               $url . '&justLocalized=' . rawurlencode($table . ':' . $row['uid'] . ':' . $lUid_OnPage)
                                        );
                                        $language = t3lib_BEfunc::getRecord('sys_language', $lUid_OnPage, 'title');
                                        $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
                                        );
                                        $language = t3lib_BEfunc::getRecord('sys_language', $lUid_OnPage, 'title');
                                        $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
@@ -1787,60 +1773,52 @@ class localRecordList extends recordList {
         *
         * @return      void
         */
         *
         * @return      void
         */
-       function initCSV()      {
-
-                       // Reset:
-               $this->csvLines=array();
-
-                       // Getting header line with field names:
-               $csvRow = array();
-               foreach ($this->fieldArray as $fN) {
-                       if ($fN == '_CONTROL_' || $fN == '_CLIPBOARD_') {
-                                       continue;
-                       }
-                       $csvRow[] = $fN;
-               }
-
-                       // Set the header + an empty row:
-               $this->setCsvRow($csvRow);
-               $this->csvLines[] = '';
+       protected function initCSV() {
+               $this->addHeaderRowToCSV();
        }
 
        }
 
+       /**
+        * Add header line with field names as CSV line
+        *
+        * @return void
+        */
+       protected function addHeaderRowToCSV() {
+                       // Add header row, control fields will be reduced inside addToCSV()
+               $this->addToCSV(array_combine($this->fieldArray, $this->fieldArray));
+       }
 
        /**
 
        /**
-        * Adds the content of input array $row to the CSV list:
+        * Adds selected columns of one table row as CSV line.
         *
         * @param       array           Record array, from which the values of fields found in $this->fieldArray will be listed in the CSV output.
         *
         * @param       array           Record array, from which the values of fields found in $this->fieldArray will be listed in the CSV output.
-        * @param       string          Table name
+        * @param       string          Table name @deprecated since 4.4
         * @return      void
         */
         * @return      void
         */
-       function addToCSV($row,$table)  {
-
-                       // Traversing fields, adding values from $row:
-               $csvRow = array();
-               foreach ($this->fieldArray as $fN) {
-                       switch ($fN) {
-                               case '_PATH_':
-                                       $csvRow[] = $this->recPath($row['pid']);
-                                       break;
-
-                               case '_REF_':
-                                       $csvRow[] = $this->createReferenceHtml($table, $row['uid']);
-                                       break;
-
-                                       // remove these columns from the CSV view
-                               case '_CONTROL_':
-                               case '_CLIPBOARD_':
-                                       continue;
-                                       break;
-
-                               default:
-                                       $csvRow[] = $row[$fN];
-                       }
-               }
+       protected function addToCSV(array $row = array(), $table = '') {
+               $rowReducedByControlFields = self::removeControlFieldsFromFieldRow($row);
+               $rowReducedToSelectedColumns = array_intersect_key($rowReducedByControlFields, array_flip($this->fieldArray));
+               $this->setCsvRow($rowReducedToSelectedColumns);
+       }
 
 
-                       // Set the values in the CSV list
-               $this->setCsvRow($csvRow);
+       /**
+        * Remove control fields from row for CSV export
+        *
+        * @param array fieldNames => fieldValues
+        * @return array Input array reduces by control fields
+        */
+       protected static function removeControlFieldsFromFieldRow(array $row = array()) {
+                       // Possible control fields in a list row
+               $controlFields = array(
+                       '_PATH_',
+                       '_REF_',
+                       '_CONTROL_',
+                       '_AFTERCONTROL_',
+                       '_AFTERREF_',
+                       '_CLIPBOARD_',
+                       '_LOCALIZATION_',
+                       '_LOCALIZATION_b',
+               );
+               return array_diff_key($row, array_flip($controlFields));
        }
 
 
        }