Project

General

Profile

Actions

Feature #57832

closed

Preview inline files in BE (info icon)

Added by Einar Gislason about 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2014-04-11
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

We're missing the option to preview files in the BE like you can do in the filelist module.

I have created a small patch. Not sure how to submit it but please feel free to implement it if it makes any sense at all:
TYPO3\CMS\Backend\Form\Element\InlineElement.php:675

        // "Info": (All records)
        if ($enabledControls['info'] && !$isNewItem) {
// Treat the record as a file
            if($rec['table_local'] == 'sys_file'){
                $idArray = explode('_',$rec['uid_local']);
                $fileId = array_pop($idArray);
                if(\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($fileId)){
                    $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileId);
                }
                if($fileObject instanceof \TYPO3\CMS\Core\Resource\File){
                    $cells['info'] = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'_FILE\', \''. $fileObject->getProperty('storage') . ':' . $fileObject->getProperty('identifier') . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('status-dialog-information', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE))) . '</a>';    
                }
            } else {
                $cells['info'] = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $foreign_table . '\', \'' . $rec['uid'] . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('status-dialog-information', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE))) . '</a>';    
            }
        }

The code checks if the "table_local" of the current record is a sys_file and then produces the same preview code as the file list does.

-Einar


Files

InlineElement.php (115 KB) InlineElement.php Einar Gislason, 2014-04-11 15:14
withoutpatch.png (72.4 KB) withoutpatch.png Without patch Einar Gislason, 2014-04-23 09:57
withpatch.png (258 KB) withpatch.png With patch Einar Gislason, 2014-04-23 09:57

Related issues 2 (0 open2 closed)

Is duplicate of TYPO3 Core - Bug #57302: Unify show item for FAL recordsClosed2014-03-25

Actions
Is duplicate of TYPO3 Core - Bug #57798: get file path for Resource in tt_contentClosedFrans Saris2014-04-10

Actions
Actions

Also available in: Atom PDF