Project

General

Profile

Actions

Feature #57832

closed

Preview inline files in BE (info icon)

Added by Einar Gislason over 10 years ago. Updated about 6 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 #1

Updated by Frans Saris over 10 years ago

  • Status changed from New to Needs Feedback

Could you provide a screenshot of the result of this patch so I can understant what you want to achieve?

Gr. Frans

Updated by Einar Gislason over 10 years ago

Please see the 2 attached screenshots from two different 6.2.0 sites
Without the patch the info field on the inline media elm. just displays some metainfo on the image. WIth the patch the image is shown and is downloadable, just like in Filelist.
Hope this clears things up.

Actions #3

Updated by Frans Saris over 10 years ago

Hi Einar,

Thanks for the info and screenshots.
I simplified your change and push a patch to the review system.

gr. Frans

Actions #4

Updated by Gerrit Code Review over 10 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29651

Actions #5

Updated by Frans Saris over 10 years ago

  • Status changed from Under Review to Resolved
Actions #6

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF