8561 Checkboxes and labels are aligned badly if in one line
[Packages/TYPO3.CMS.git] / typo3 / class.filelistfoldertree.php
index 96c91e4..42d790e 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -148,7 +148,7 @@ class filelistFolderTree extends t3lib_folderTree {
                $PM = t3lib_div::_GP('PM');
                if(($PMpos = strpos($PM, '#')) !== false) { $PM = substr($PM, 0, $PMpos); }
                $PM = explode('_', $PM);
-               if(($isAjaxCall = t3lib_div::_GP('ajax')) && is_array($PM) && count($PM)==4)    {
+               if((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) && is_array($PM) && count($PM)==4) {
                        if($PM[1])      {
                                $expandedFolderUid = $PM[2];
                                $ajaxOutput = '';
@@ -161,7 +161,7 @@ class filelistFolderTree extends t3lib_folderTree {
                }
 
 
-               // we need to count the opened <ul>'s every time we dig into another level, 
+               // we need to count the opened <ul>'s every time we dig into another level,
                // so we know how many we have to close when all children are done rendering
                $closeDepth = array();
 
@@ -171,7 +171,7 @@ class filelistFolderTree extends t3lib_folderTree {
                        $idAttr = htmlspecialchars($this->domIdPrefix.$this->getId($v['row']).'_'.$v['bank']);
                        $itemHTML  = '';
 
-                       // if this item is the start of a new level, 
+                       // if this item is the start of a new level,
                        // then a new level <ul> is needed, but not in ajax mode
                        if($v['isFirst'] && !($doCollapse) && !($doExpand && $expandedFolderUid == $uid))       {
                                $itemHTML = "<ul>\n";
@@ -213,7 +213,7 @@ class filelistFolderTree extends t3lib_folderTree {
                        if($doExpand && $expandedFolderUid == $uid) {
                                $ajaxOutput .= $itemHTML;
                                $invertedDepthOfAjaxRequestedItem = $v['invertedDepth'];
-                       } elseif($invertedDepthOfAjaxRequestedItem) { 
+                       } elseif($invertedDepthOfAjaxRequestedItem) {
                                if($v['invertedDepth'] < $invertedDepthOfAjaxRequestedItem) {
                                        $ajaxOutput .= $itemHTML;
                                } else {
@@ -311,10 +311,19 @@ class filelistFolderTree extends t3lib_folderTree {
                        $icon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($isOpen?'minus':'plus').'only.gif').' alt="" />';
                        $firstHtml= $this->PM_ATagWrap($icon,$cmd);
 
-                       switch($val['type'])    {
-                               case 'user':    $icon = 'gfx/i/_icon_ftp_user.gif';     break;
-                               case 'group':   $icon = 'gfx/i/_icon_ftp_group.gif'; break;
-                               default:                $icon = 'gfx/i/_icon_ftp.gif'; break;
+                       switch ($val['type']) {
+                               case 'user':
+                                       $icon = 'gfx/i/_icon_ftp_user.gif';
+                                       break;
+                               case 'group':
+                                       $icon = 'gfx/i/_icon_ftp_group.gif';
+                                       break;
+                               case 'readonly':
+                                       $icon = 'gfx/i/_icon_ftp_readonly.gif';
+                                       break;
+                               default:
+                                       $icon = 'gfx/i/_icon_ftp.gif';
+                                       break;
                        }
 
                                // Preparing rootRec for the mount
@@ -329,7 +338,7 @@ class filelistFolderTree extends t3lib_folderTree {
 
                                // If the mount is expanded, go down:
                        if ($isOpen)
-                               $this->getFolderTree($val['path'], 999);
+                               $this->getFolderTree($val['path'], 999, $val['type']);
 
                                // Add tree:
                        $treeArr = array_merge($treeArr, $this->tree);
@@ -347,7 +356,7 @@ class filelistFolderTree extends t3lib_folderTree {
         * @return      integer         The count of items on the level
         * @see getBrowsableTree()
         */
-       function getFolderTree($files_path, $depth=999) {
+       function getFolderTree($files_path, $depth=999, $type='')       {
 
                        // This generates the directory tree
                $dirs = t3lib_div::get_dirs($files_path);
@@ -355,7 +364,7 @@ class filelistFolderTree extends t3lib_folderTree {
 
                sort($dirs);
                $c = count($dirs);
-               
+
                $depth = intval($depth);
                $HTML = '';
                $a = 0;
@@ -383,7 +392,8 @@ class filelistFolderTree extends t3lib_folderTree {
                                $nextCount = $this->getFolderTree(
                                        $path,
                                        $depth-1,
-                                       $this->makeHTML ? '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($a == $c ? 'blank' : 'line').'.gif','width="18" height="16"').' alt="" />' : ''
+                                       $this->makeHTML ? '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($a == $c ? 'blank' : 'line').'.gif','width="18" height="16"').' alt="" />' : '',
+                                       $type
                                );
                                $exp = 1;       // Set "did expand" flag
                        } else {
@@ -395,7 +405,8 @@ class filelistFolderTree extends t3lib_folderTree {
                        if ($this->makeHTML)    {
                                $HTML = $this->PMicon($row,$a,$c,$nextCount,$exp);
 
-                               $icon = 'gfx/i/_icon_'.t3lib_BEfunc::getPathType_web_nonweb($path).'folders.gif';
+                               $webpath = t3lib_BEfunc::getPathType_web_nonweb($path);
+                               $icon = 'gfx/i/_icon_' .$webpath . 'folders' . ($type == 'readonly' ? '_ro' : '') . '.gif';
                                if ($val == '_temp_')   {
                                        $icon = 'gfx/i/sysf.gif';
                                        $row['title']='TEMP';
@@ -429,4 +440,5 @@ class filelistFolderTree extends t3lib_folderTree {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.filelistfoldertree.php'])     {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.filelistfoldertree.php']);
 }
+
 ?>
\ No newline at end of file