! Fixed issue #17561: htmlArea RTE: Delete class HTMLArea.Base
[Packages/TYPO3.CMS.git] / typo3 / class.file_list.inc
old mode 100755 (executable)
new mode 100644 (file)
index 0b4e502..8b60341
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2008 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
@@ -28,9 +28,9 @@
  * Include file extending t3lib_recordList
  *
  * $Id$
- * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
@@ -68,7 +68,7 @@
 /**
  * Class for rendering of File>Filelist
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -84,6 +84,7 @@ class fileList extends t3lib_recordList {
        var $sortRev = 1;                                       // Reverse sorting flag
        var $firstElementNumber=0;
        var $clipBoard = 0;
+       var $bigControlPanel = 0;
 
                // internal
        var $JScode = '';
@@ -93,6 +94,7 @@ class fileList extends t3lib_recordList {
        var $files = Array();
        var $path = '';
        var $eCounter=0;                                        // Counting the elements no matter what...
+       var $dirCounter = 0;
        var $totalItems='';
 
        var $CBnames=array();
@@ -109,7 +111,7 @@ class fileList extends t3lib_recordList {
         * @param       boolean         Show clipboard flag
         * @return      void
         */
-       function start($path,$pointer,$sort,$sortRev,$clipBoard=0)      {
+       function start($path, $pointer, $sort, $sortRev, $clipBoard=0, $bigControlPanel=0) {
                $this->counter=0;
                $this->totalbytes=0;
                $this->JScode='';
@@ -119,6 +121,7 @@ class fileList extends t3lib_recordList {
                $this->sortRev=$sortRev;
                $this->firstElementNumber=$pointer;
                $this->clipBoard = $clipBoard;
+               $this->bigControlPanel = $bigControlPanel;
                        // setting the maximum length of the filenames to the user's settings or minimum 30 (= $this->fixedL)
                $this->fixedL = max($this->fixedL, $GLOBALS['BE_USER']->uc['titleLen']);
 
@@ -173,23 +176,23 @@ class fileList extends t3lib_recordList {
                                // if this is some subpage under the mount root....
                        if ($GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($theFile['path'])) {
                                        // The icon with link
-                               $otherMarkers['PAGE_ICON'] = '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
+                               $otherMarkers['PAGE_ICON'] = '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="'.htmlspecialchars($theFile['file']).'" />';
                                if ($this->clickMenus) $otherMarkers['PAGE_ICON'] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($otherMarkers['PAGE_ICON'],$path);
 
-                               $buttons['level_up'] .= $this->linkWrapDir('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/folder_up.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" />',$theFile['path']);
-                               $otherMarkers['TITLE'] .= t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20));  // No HTML specialchars here - HTML like <b> </b> is allowed
+                               $buttons['level_up'] .= $this->linkWrapDir(t3lib_iconWorks::getSpriteIcon('actions-view-go-up', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.upOneLevel', 1))), $theFile['path']);
+                               $otherMarkers['TITLE'] .= t3lib_div::removeXSS(t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20)));    // No HTML specialchars here - HTML like <strong> </strong> is allowed
 
                                // this is the root page
                        } else {
-                               $otherMarkers['PAGE_ICON'] = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_ftp.gif','width="18" height="16"').' alt="" />';
+                               $otherMarkers['PAGE_ICON'] = t3lib_iconWorks::getSpriteIcon('apps-filetree-root');
                                if ($this->clickMenus) $otherMarkers['PAGE_ICON'] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($otherMarkers['PAGE_ICON'],$path);
                                $otherMarkers['TITLE'] .= htmlspecialchars(t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20)));
                        }
                }
 
-               $buttons['refresh'] = '<a href="'.htmlspecialchars($this->listURL()).'">'.
-                               '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/refresh_n.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload',1).'" alt="" />'.
-                               '</a>';
+               $buttons['refresh'] = '<a href="'.htmlspecialchars($this->listURL()).'" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.reload', 1) . '">'.
+                               t3lib_iconWorks::getSpriteIcon('actions-system-refresh')  .
+                       '</a>';
 
                return array($buttons, $otherMarkers);
        }
@@ -221,12 +224,16 @@ class fileList extends t3lib_recordList {
                        // Adds the code of files/dirs
                $out='';
                $titleCol = 'file';
+               $upLevelDir = dirname(substr($files['files'][0]['path'], 0, -1)) . '/';
+               $levelUp = $GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($upLevelDir) ? $this->linkWrapDir(t3lib_iconWorks::getSpriteIcon('actions-view-go-up', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE))), $upLevelDir) : '';
 
                        // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
                $rowlist = t3lib_div::rmFromList($titleCol,$rowlist);
                $rowlist = t3lib_div::uniqueList($rowlist);
                $rowlist = $rowlist ? $titleCol.','.$rowlist : $titleCol;
-               if ($this->clipBoard)   $rowlist.=',_CLIPBOARD_';
+               if ($this->bigControlPanel || $this->clipBoard) {
+                       $rowlist = str_replace('file,', 'file,_CLIPBOARD_,', $rowlist);
+               }
                $this->fieldArray = explode(',',$rowlist);
 
                        // Directories are added
@@ -237,7 +244,6 @@ class fileList extends t3lib_recordList {
                                // half line is drawn
                        $theData = Array();
                        $theData[$titleCol] = '';
-                       $iOut.=$this->addelement(0,'',$theData);
                }
 
 
@@ -247,33 +253,33 @@ class fileList extends t3lib_recordList {
 
                        // Header line is drawn
                $theData = Array();
-               reset($this->fieldArray);
-               while(list(,$v)=each($this->fieldArray))        {
-                       if ($v=='_CLIPBOARD_')  {
+
+               foreach ($this->fieldArray as $v)       {
+                       if ($v == '_CLIPBOARD_' && $this->clipBoard) {
                                $cells=array();
                                $table='_FILE';
                                $elFromTable = $this->clipObj->elFromTable($table);
                                if (count($elFromTable))        {
-                                       $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('_FILE',$this->path)).'" onclick="return '.htmlspecialchars($this->clipObj->confirmMsg('_FILE',$this->path,'into',$elFromTable)).'">'.
-                                               '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_paste',1).'" alt="" /></a>';
+                                       $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('_FILE',$this->path)).'" onclick="return '.htmlspecialchars($this->clipObj->confirmMsg('_FILE',$this->path,'into',$elFromTable)).'" title="' . $GLOBALS['LANG']->getLL('clip_paste', 1) . '">' .
+                                               t3lib_iconWorks::getSpriteIcon('actions-document-paste-after') .
+                                       '</a>';
                                }
                                if ($this->clipObj->current!='normal' && $iOut) {
-                                       $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg('','gfx/clip_copy.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_selectMarked',1).'" alt="" />',$table,'setCB');
-                                       $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg('','gfx/garbage.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_deleteMarked',1).'" alt="" />',$table,'delete',$GLOBALS['LANG']->getLL('clip_deleteMarkedWarning'));
-                                       $onClick = 'checkOffCB(\''.implode(',',$this->CBnames).'\'); return false;';
-                                       $cells[]='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
-                                                       '<img'.t3lib_iconWorks::skinImg('','gfx/clip_select.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_markRecords',1).'" alt="" />'.
-                                                       '</a>';
+                                       $cells[]=$this->linkClipboardHeaderIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-copy', array('title' => $GLOBALS['LANG']->getLL('clip_selectMarked', 1))), $table,'setCB');
+                                       $cells[]=$this->linkClipboardHeaderIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => $GLOBALS['LANG']->getLL('clip_deleteMarked'))), $table,'delete',$GLOBALS['LANG']->getLL('clip_deleteMarkedWarning'));
+                                       $onClick = 'checkOffCB(\'' . implode(',', $this->CBnames) . '\', this); return false;';
+                                       $cells[] = '<a class="cbcCheckAll" rel="" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $GLOBALS['LANG']->getLL('clip_markRecords', TRUE) . '">' .
+                                                       t3lib_iconWorks::getSpriteIcon('actions-document-select').
+                                               '</a>';
                                }
-
                                $theData[$v] = implode('',$cells);
                        } else {        // Normal row:
                                $theT = $this->linkWrapSort($GLOBALS['LANG']->getLL('c_'.$v,1), $this->path,$v);
                                $theData[$v] = $theT;
                        }
                }
-               $out.=$this->addelement(1,'',$theData,' class="c-headLine"','');
-               $out.=$iOut;
+               $out .= '<thead>' . $this->addelement(1, $levelUp, $theData, ' class="t3-row-header"', '') . '</thead>';
+               $out .= '<tbody>' . $iOut . '</tbody>';
 
                        // half line is drawn
 
@@ -284,7 +290,7 @@ class fileList extends t3lib_recordList {
                <!--
                        File list table:
                -->
-                       <table border="0" cellpadding="0" cellspacing="0" id="typo3-filelist">
+                       <table cellpadding="0" cellspacing="0" id="typo3-filelist">
                                '.$out.'
                        </table>';
        }
@@ -312,10 +318,9 @@ class fileList extends t3lib_recordList {
        function formatDirList($items)  {
                $out='';
 
-                       // Files:
+               // Folders:
                if (count($items['sorting']))   {
-                       reset($items['sorting']);
-                       while (list($key,) = each($items['sorting']))   {
+                       foreach ($items['sorting'] as $key => $value) {
                                list($flag,$code) = $this->fwd_rwd_nav();
                                $out.=$code;
                                if ($flag)      {
@@ -326,22 +331,21 @@ class fileList extends t3lib_recordList {
                                        list($title,$icon,$path) =  $this->dirData($theFile);
 
                                                // The icon with link
-                                       $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
+                                       $theIcon = t3lib_iconWorks::getSpriteIconForFile( ($theFile['type'] == 'dir' ? 'folder' : $theFile['fileext']), array('title' => htmlspecialchars($theFile['file'])));
                                        if ($this->clickMenus) $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon,$path);
 
                                                //      Preparing and getting the data-array
                                        $theData = Array();
-                                       reset($this->fieldArray);
-                                       while(list(,$field)=each($this->fieldArray))    {
+                                       foreach ($this->fieldArray as $field) {
                                                switch($field)  {
                                                        case 'size':
-       //                                                      $theData[$field]=t3lib_div::formatSize($theFile[$field]);
+                                                               $theData[$field] = t3lib_div::formatSize($theFile[$field], $GLOBALS['LANG']->getLL('byteSizeUnits', true));
                                                        break;
                                                        case 'rw':
-                                                               $theData[$field]= (($theFile['readable'])?'':'<span class="typo3-red"><b>R</b></span>').(($theFile['writable'])?'':'<span class="typo3-red"><b>W</b></span>');
+                                                               $theData[$field] = (($theFile['readable']) ? '' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('read', true) . '</strong></span>') . (($theFile['writable']) ? '' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('write', true) . '</strong></span>');
                                                        break;
                                                        case 'fileext':
-       //                                                      $theData[$field]=strtoupper($theFile['fileext']);
+                                                               $theData[$field]=strtoupper($theFile['fileext']);
                                                        break;
                                                        case 'tstamp':
                                                                $theData[$field]=Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $theFile['tstamp']);
@@ -350,19 +354,27 @@ class fileList extends t3lib_recordList {
                                                                $theData[$field]= $this->linkWrapDir($title,$path);
                                                        break;
                                                        case '_CLIPBOARD_':
-                                                               $theData[$field]=$this->makeClip($theFile);
+                                                               $temp = '';
+                                                               if ($this->bigControlPanel) {
+                                                                       $temp .= $this->makeEdit($theFile);
+                                                               }
+                                                               $temp .= $this->makeClip($theFile);
+                                                               $theData[$field] = $temp;
                                                        break;
                                                        case '_REF_':
                                                                $theData[$field]=$this->makeRef($theFile);
                                                        break;
                                                        default:
-                                                               $theData[$field]=t3lib_div::fixed_lgd($theFile[$field],$this->fixedL);
+                                                               $theData[$field]=t3lib_div::fixed_lgd_cs($theFile[$field],$this->fixedL);
                                                        break;
                                                }
                                        }
-                                       $out.=$this->addelement(1,$theIcon,$theData);
+                                       $altRows = 'class="' . ($i++ % 2 == 0 ? 'bgColor6' : 'bgColor4') . '"';
+
+                                       $out .= $this->addelement(1, $theIcon, $theData, $altRows);
                                }
                                $this->eCounter++;
+                               $this->dirCounter = $this->eCounter;
                        }
                }
                return $out;
@@ -381,7 +393,7 @@ class fileList extends t3lib_recordList {
 
                        // Sometimes $code contains plain HTML tags. In such a case the string should not be modified!
                if(!strcmp($code,strip_tags($code)))    {
-                       return '<a href="'.htmlspecialchars($href).'"'.$onclick.' title="'.htmlspecialchars($code).'">'.t3lib_div::fixed_lgd($code,$this->fixedL).'</a>';
+                       return '<a href="'.htmlspecialchars($href).'"'.$onclick.' title="'.htmlspecialchars($code).'">'.t3lib_div::fixed_lgd_cs($code,$this->fixedL).'</a>';
                } else  {
                        return '<a href="'.htmlspecialchars($href).'"'.$onclick.'>'.$code.'</a>';
                }
@@ -396,10 +408,10 @@ class fileList extends t3lib_recordList {
         */
        function linkWrapFile($code,$path)      {
 
-               if (t3lib_div::isFirstPartOfStr($path,t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT')))    {
-                       $href = substr($path,strlen(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT')));
+               if (t3lib_div::isFirstPartOfStr($path, PATH_site)) {
+                       $href = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . substr($path, strlen(PATH_site));
                        $aOnClick = "return top.openUrlInWindow('".$href."','WebFile');";
-                       $code = '<a href="#" title="'.htmlspecialchars($code).'" onclick="'.htmlspecialchars($aOnClick).'">'.t3lib_div::fixed_lgd($code,$this->fixedL).'</a>';
+                       $code = '<a href="#" title="'.htmlspecialchars($code).'" onclick="'.htmlspecialchars($aOnClick).'">'.t3lib_div::fixed_lgd_cs($code,$this->fixedL).'</a>';
                }
                return $code;
        }
@@ -449,8 +461,7 @@ class fileList extends t3lib_recordList {
 
                        // Files:
                if (count($items['sorting']))   {
-                       reset($items['sorting']);
-                       while (list($key,) = each($items['sorting']))   {
+                       foreach ($items['sorting'] as $key => $value) {
                                list($flag,$code) = $this->fwd_rwd_nav();
                                $out.=$code;
                                if ($flag)      {
@@ -463,19 +474,19 @@ class fileList extends t3lib_recordList {
                                        $icon = t3lib_BEfunc::getFileIcon($ext);
 
                                                // The icon with link
-                                       $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/fileicons/'.$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
+                                       $theIcon = t3lib_iconWorks::getSpriteIconForFile($theFile['fileext'], array('title' => htmlspecialchars($theFile['file'])));
+
                                        if ($this->clickMenus) $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon,$theFile['path'].$theFile['file']);
 
                                                //      Preparing and getting the data-array
                                        $theData = Array();
-                                       reset($this->fieldArray);
-                                       while(list(,$field)=each($this->fieldArray))    {
+                                       foreach ($this->fieldArray as $field) {
                                                switch($field)  {
                                                        case 'size':
-                                                               $theData[$field]=t3lib_div::formatSize($theFile[$field]);
+                                                               $theData[$field] = t3lib_div::formatSize($theFile[$field], $GLOBALS['LANG']->getLL('byteSizeUnits', true));
                                                        break;
                                                        case 'rw':
-                                                               $theData[$field]= (($theFile['readable'])?'':'<span class="typo3-red"><b>R</b></span>').(($theFile['writable'])?'':'<span class="typo3-red"><b>W</b></span>');
+                                                               $theData[$field] = (($theFile['readable']) ? '' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('read', true) . '</strong></span>') . (($theFile['writable']) ? '' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('write', true) . '</strong></span>');
                                                        break;
                                                        case 'fileext':
                                                                $theData[$field]=strtoupper($theFile[$field]);
@@ -484,36 +495,45 @@ class fileList extends t3lib_recordList {
                                                                $theData[$field]=Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $theFile[$field]);
                                                        break;
                                                        case '_CLIPBOARD_':
-                                                               $theData[$field]=$this->makeClip($theFile);
+                                                               $temp = '';
+                                                               if ($this->bigControlPanel) {
+                                                                       $temp .= $this->makeEdit($theFile);
+                                                               }
+                                                               $temp .= $this->makeClip($theFile);
+                                                               $theData[$field] = $temp;
                                                        break;
                                                        case '_REF_':
                                                                $theData[$field]=$this->makeRef($theFile);
                                                        break;
                                                        case 'file':
                                                                $theData[$field] = $this->linkWrapFile($theFile[$field],$theFile['path'].$theFile['file']);
+                                                                       // Thumbsnails?
+                                                               if ($this->thumbs && $this->isImage($theFile['fileext']))       {
+                                                                       $thumbData = array();
+                                                                       $theFile_R = rawurlencode($theFile['path'].$theFile['file']);
+                                                                       $titleCol = $this->fieldArray[0];
+
+                                                                       $theFile_abs = $theFile['path'].$theFile['file'];
+                                                                       $check = basename($theFile_abs).':'.filemtime($theFile_abs).':'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
+                                                                       $params = '&file='.$theFile_R;
+                                                                       $params.= '&md5sum='.t3lib_div::shortMD5($check);
+                                                                       $href = $this->backPath.$this->thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
+
+                                                                       $theData[$field] .= '<br /><img src="'.htmlspecialchars($href).'" hspace="2" title="'.htmlspecialchars(trim($theFile['file'])).'" alt="'.htmlspecialchars(trim($theFile['file'])).'" />';
+                                                               }
                                                        break;
                                                        default:
-                                                               $theData[$field]=t3lib_div::fixed_lgd($theFile[$field],$this->fixedL);
+                                                               $theData[$field]=t3lib_div::fixed_lgd_cs($theFile[$field],$this->fixedL);
                                                        break;
                                                }
                                        }
-                                       $out.= $this->addelement(1,$theIcon,$theData);
-
-                                               // Thumbsnails?
-                                       if ($this->thumbs && $this->isImage($theFile['fileext']))       {
-                                               $thumbData = array();
-                                               $theFile_R = rawurlencode($theFile['path'].$theFile['file']);
-                                               $titleCol = $this->fieldArray[0];
-
-                                               $theFile_abs = $theFile['path'].$theFile['file'];
-                                               $check = basename($theFile_abs).':'.filemtime($theFile_abs).':'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
-                                               $params = '&file='.$theFile_R;
-                                               $params.= '&md5sum='.t3lib_div::shortMD5($check);
-                                               $href = $this->backPath.$this->thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
-
-                                               $thumbData[$titleCol]='<img src="'.htmlspecialchars($href).'" hspace="2" title="'.htmlspecialchars(trim($theFile['file'])).'" alt="" />';
-                                               $out.= $this->addelement(4,'',$thumbData);
+                                       if ($this->dirCounter % 2 == 0) {
+                                               $altRows = 'class="' . ($i++ % 2 == 0 ? 'bgColor6' : 'bgColor4') . '"';
+                                       } else {
+                                               $altRows = 'class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '"';
                                        }
+
+                                       $out .= $this->addelement(1, $theIcon, $theData, $altRows);
                                }
                                $this->eCounter++;
                        }
@@ -545,7 +565,7 @@ class fileList extends t3lib_recordList {
                } else {
                        $params='&SET[sort]='.$col.'&SET[reverse]=0';
                }
-               $href = $this->script.'?id='.rawurlencode($path).$params;
+               $href = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('filelist') . 'mod1/' . $this->script . '?id=' . rawurlencode($path) . $params;
                return '<a href="'.htmlspecialchars($href).'">'.$code.'</a>';
        }
 
@@ -583,8 +603,7 @@ class fileList extends t3lib_recordList {
                                $d->close();
                        }
                                // Get fileinfo
-                       reset($tempArray);
-                       while (list(,$val)=each($tempArray))    {
+                       foreach ($tempArray as $val) {
                                $temp = $GLOBALS['SOBE']->basicFF->getTotalFileInfo($val);
                                $items['files'][] = $temp;
                                if ($this->sort)        {
@@ -620,10 +639,10 @@ class fileList extends t3lib_recordList {
                if ($this->clipObj->current=='normal')  {
                        $isSel = $this->clipObj->isSelected('_FILE',$md5);
                        $cells[]='<a href="'.htmlspecialchars($this->clipObj->selUrlFile($fullIdent,1,($isSel=='copy'))).'">'.
-                                               '<img'.t3lib_iconWorks::skinImg('','gfx/clip_copy'.($isSel=='copy'?'_h':'').'.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.copy',1).'" alt="" />'.
+                                               t3lib_iconWorks::getSpriteIcon('actions-edit-copy'.($isSel=='copy'?'-release':''),array('title'=>$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.copy',1))).
                                                '</a>';
                        $cells[]='<a href="'.htmlspecialchars($this->clipObj->selUrlFile($fullIdent,0,($isSel=='cut'))).'">'.
-                                               '<img'.t3lib_iconWorks::skinImg('','gfx/clip_cut'.($isSel=='cut'?'_h':'').'.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.cut',1).'" alt="" />'.
+                                               t3lib_iconWorks::getSpriteIcon('actions-edit-cut'.($isSel=='cut'?'-release':''),array('title'=>$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.cut',1))).
                                                '</a>';
                } else {        // For numeric pads, add select checkboxes:
                        $n='_FILE|'.$md5;
@@ -637,9 +656,9 @@ class fileList extends t3lib_recordList {
                        // Display PASTE button, if directory:
                $elFromTable = $this->clipObj->elFromTable('_FILE');
                if (@is_dir($fullIdent) && count($elFromTable)) {
-                       $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('_FILE',$fullIdent)).'" onclick="return '.htmlspecialchars($this->clipObj->confirmMsg('_FILE',$fullIdent,'into',$elFromTable)).'">'.
-                                               '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteinto.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_pasteInto',1).'" alt="" />'.
-                                               '</a>';
+                       $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('_FILE',$fullIdent)).'" onclick="return '.htmlspecialchars($this->clipObj->confirmMsg('_FILE',$fullIdent,'into',$elFromTable)).'" title="' . $GLOBALS['LANG']->getLL('clip_pasteInto', TRUE) . '">'.
+                         t3lib_iconWorks::getSpriteIcon('actions-document-paste-into') .
+                       '</a>';
                }
 
                        // Compile items into a DIV-element:
@@ -651,6 +670,63 @@ class fileList extends t3lib_recordList {
        }
 
        /**
+       * Creates the edit control section
+       *
+       * @param        array           Array with information about the file/directory for which to make the edit control section for the listing.
+       * @return       string          HTML-table
+       */
+       function makeEdit($theData) {
+               $cells = array();
+               $fullIdent = $theData['path'].$theData['file'];
+               $canEdit = t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $theData['realFileext']);
+
+                       // prepare space icon
+               $iconWidth  = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth']  ? $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth']  : 12;
+               $iconHeight = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeHeight'] ? $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeHeight'] : 12;
+               $spaceIcon = '<img src="' . $this->backPath . 'clear.gif" width="' . $iconWidth . '" height="' . $iconHeight . '" title="" alt="" />';
+
+
+                       //edit
+               if ($theData['type'] == 'dir' || !$canEdit) {
+                       $cells['edit'] = $spaceIcon;
+               } else {
+                       $editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target=' .
+                               rawurlencode($fullIdent) .
+                               '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location);return false;';
+                       $cells['edit'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.edit') . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-open') . '</a>';
+               }
+                       //rename
+               $renameOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_rename.php?target=' .
+                       rawurlencode($fullIdent) .
+                       '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location);return false;';
+               $cells['rename'] = '<a href="#" onclick="' . $renameOnClick . '"  title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.rename') . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-rename') . '</a>';
+
+                       //info
+               $infoOnClick = 'top.launchView(\'' . $fullIdent . '\', \'\');return false;';
+               $cells['info'] = '<a href="#" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.info') . '">' . t3lib_iconWorks::getSpriteIcon('status-dialog-information') . '</a>';
+
+                       // Hook for manipulating edit icons.
+               if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
+                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
+                               $hookObject = t3lib_div::getUserObj($classData);
+
+                               if(!($hookObject instanceof fileList_editIconHook)) {
+                                       throw new UnexpectedValueException('$hookObject must implement interface fileList_editIconHook', 1235225797);
+                               }
+
+                               $hookObject->manipulateEditIcons($cells, $this);
+                       }
+               }
+
+                       // Compile items into a DIV-element:
+               return '                                                        <!-- EDIT CONTROLS: -->
+                                                                                       <div class="typo3-editCtrl">
+                                                                                               ' . implode('
+                                                                                               ', $cells).'
+                                                                                       </div>';
+       }
+
+       /**
         * Make reference count
         *
         * @param       array           Array with information about the file/directory for which to make the clipboard panel for the listing.
@@ -682,13 +758,13 @@ class fileList extends t3lib_recordList {
                        }
                }
 
-               return count($infoData) ? '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$theData['path'].$theData['file'].'\', \'\'); return false;').'" title="'.htmlspecialchars(t3lib_div::fixed_lgd(implode(' / ',$infoData),100)).'">'.count($infoData).'</a>' : '';
+               return count($infoData) ? '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$theData['path'].$theData['file'].'\', \'\'); return false;').'" title="'.htmlspecialchars(t3lib_div::fixed_lgd_cs(implode(' / ',$infoData),100)).'">'.count($infoData).'</a>' : '';
        }
 }
 
 
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc'])      {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc']);
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc']);
 }
 ?>