Fixed bug 10056: Misspelling english word "guesbooks"
[Packages/TYPO3.CMS.git] / typo3 / class.file_list.inc
index c1eea10..51ac0fd 100755 (executable)
@@ -93,6 +93,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();
@@ -125,6 +126,7 @@ class fileList extends t3lib_recordList {
                if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'])  {
                        $this->thumbScript='gfx/notfound_thumb.gif';
                }
+               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_common.xml');
        }
 
        /**
@@ -236,7 +238,6 @@ class fileList extends t3lib_recordList {
                                // half line is drawn
                        $theData = Array();
                        $theData[$titleCol] = '';
-                       $iOut.=$this->addelement(0,'',$theData);
                }
 
 
@@ -283,7 +284,7 @@ class fileList extends t3lib_recordList {
                <!--
                        File list table:
                -->
-                       <table border="0" cellpadding="0" cellspacing="0" id="typo3-filelist">
+                       <table border="0" cellpadding="0" cellspacing="1" id="typo3-filelist">
                                '.$out.'
                        </table>';
        }
@@ -295,11 +296,11 @@ class fileList extends t3lib_recordList {
         **/
        function getFolderInfo() {
                if($this->counter == 1) {
-                       $fileLabel = 'File';
+                       $fileLabel = $GLOBALS['LANG']->getLL('file', true);
                } else {
-                       $fileLabel = 'Files';
+                       $fileLabel = $GLOBALS['LANG']->getLL('files', true);
                }
-               return $this->counter.' '.$fileLabel.', '.t3lib_div::formatSize($this->totalbytes).'bytes';
+               return $this->counter . ' ' . $fileLabel . ', ' . t3lib_div::formatSize($this->totalbytes, $GLOBALS['LANG']->getLL('byteSizeUnits', true));
        }
 
        /**
@@ -311,7 +312,7 @@ class fileList extends t3lib_recordList {
        function formatDirList($items)  {
                $out='';
 
-                       // Files:
+               // Folders:
                if (count($items['sorting']))   {
                        reset($items['sorting']);
                        while (list($key,) = each($items['sorting']))   {
@@ -334,13 +335,13 @@ class fileList extends t3lib_recordList {
                                        while(list(,$field)=each($this->fieldArray))    {
                                                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']);
@@ -359,9 +360,12 @@ class fileList extends t3lib_recordList {
                                                        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;
@@ -471,10 +475,10 @@ class fileList extends t3lib_recordList {
                                        while(list(,$field)=each($this->fieldArray))    {
                                                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]);
@@ -496,7 +500,13 @@ class fileList extends t3lib_recordList {
                                                        break;
                                                }
                                        }
-                                       $out.= $this->addelement(1,$theIcon,$theData);
+                                       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);
 
                                                // Thumbsnails?
                                        if ($this->thumbs && $this->isImage($theFile['fileext']))       {
@@ -564,7 +574,7 @@ class fileList extends t3lib_recordList {
                        $d = @dir($path);
                        $tempArray=Array();
                        if (is_object($d))      {
-                               while($entry=$d->read()) {
+                               while(false !== ($entry=$d->read())) {
                                        if ($entry!='.' && $entry!='..')        {
                                                $wholePath = $path.'/'.$entry;          // Because of odd PHP-error where  <br />-tag is sometimes placed after a filename!!
                                                if (@file_exists($wholePath) && (!$type || t3lib_div::inList($type,filetype($wholePath))))      {