Beispiel #1
0
 /**
  * For RTE: This displays all files from folder. No thumbnails shown
  *
  * @param Folder $folder The folder path to expand
  * @param string $extensionList List of file extensions to show
  * @return string HTML output
  * @todo Define visibility
  */
 public function expandFolder(Folder $folder, $extensionList = '')
 {
     $out = '';
     $renderFolders = $this->act === 'folder';
     if ($folder->checkActionPermission('read')) {
         // Create header for file listing:
         $out .= $this->barheader($GLOBALS['LANG']->getLL('files') . ':');
         // Prepare current path value for comparison (showing red arrow)
         $currentIdentifier = '';
         if ($this->curUrlInfo['value']) {
             $currentIdentifier = $this->curUrlInfo['info'];
         }
         // Create header element; The folder from which files are listed.
         $titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen'];
         $folderIcon = IconUtility::getSpriteIconForResource($folder);
         $folderIcon .= htmlspecialchars(GeneralUtility::fixed_lgd_cs($folder->getIdentifier(), $titleLen));
         $picon = '<a href="#" onclick="return link_folder(\'file:' . $folder->getCombinedIdentifier() . '\');">' . $folderIcon . '</a>';
         if ($this->curUrlInfo['act'] == 'folder' && $currentIdentifier == $folder->getCombinedIdentifier()) {
             $out .= '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
         }
         $out .= $picon . '<br />';
         // Get files from the folder:
         if ($renderFolders) {
             $items = $folder->getSubfolders();
         } else {
             $items = $this->getFilesInFolder($folder, $extensionList);
         }
         $c = 0;
         $totalItems = count($items);
         foreach ($items as $fileOrFolderObject) {
             $c++;
             if ($renderFolders) {
                 $fileIdentifier = $fileOrFolderObject->getCombinedIdentifier();
                 $overlays = array();
                 if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\InaccessibleFolder) {
                     $overlays = array('status-overlay-locked' => array());
                 }
                 $icon = IconUtility::getSpriteIcon(IconUtility::mapFileExtensionToSpriteIconName('folder'), array('title' => $fileOrFolderObject->getName()), $overlays);
                 $itemUid = 'file:' . $fileIdentifier;
             } else {
                 $fileIdentifier = $fileOrFolderObject->getUid();
                 // File icon:
                 $fileExtension = $fileOrFolderObject->getExtension();
                 // Get size and icon:
                 $size = ' (' . GeneralUtility::formatSize($fileOrFolderObject->getSize()) . 'bytes)';
                 $icon = IconUtility::getSpriteIconForResource($fileOrFolderObject, array('title' => $fileOrFolderObject->getName() . $size));
                 $itemUid = 'file:' . $fileIdentifier;
             }
             // If the listed file turns out to be the CURRENT file, then show blinking arrow:
             if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $currentIdentifier == $fileIdentifier) {
                 $arrCol = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
             } else {
                 $arrCol = '';
             }
             // Put it all together for the file element:
             $out .= '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/join' . ($c == $totalItems ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . $arrCol . '<a href="#" onclick="return link_folder(\'' . $itemUid . '\');">' . $icon . htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileOrFolderObject->getName(), $titleLen)) . '</a><br />';
         }
     }
     return $out;
 }