2 namespace TYPO3\CMS\Backend\Controller\ContentElement;
135 $this->permsClause = $this->
getBackendUser()->getPagePermsClause(1);
137 $this->doc->divClass =
'container';
139 if (isset(
$GLOBALS[
'TCA'][$this->table])) {
141 }
elseif ($this->table ==
'_FILE' || $this->table ==
'_FOLDER' || $this->table ==
'sys_file') {
152 $this->uid = (int)$this->uid;
155 if ($this->uid && $this->
getBackendUser()->check(
'tables_select', $this->table)) {
156 if ((
string)$this->table ==
'pages') {
158 $this->access = is_array($this->pageInfo) ? 1 : 0;
164 $this->access = is_array($this->pageInfo) ? 1 : 0;
177 if ($fileOrFolderObject instanceof
Folder) {
178 $this->folderObject = $fileOrFolderObject;
179 $this->access = $this->folderObject->checkActionPermission(
'read');
180 $this->type =
'folder';
182 $this->fileObject = $fileOrFolderObject;
183 $this->access = $this->fileObject->checkActionPermission(
'read');
184 $this->type =
'file';
185 $this->table =
'sys_file';
190 $this->row = array();
207 $content = $this->doc->startPage($this->titleTag);
208 $content .= $this->doc->insertStylesAndJS($this->content);
220 if (!$this->access) {
225 $typeRendered =
false;
226 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/show_item.php'][
'typeRendering'])) {
227 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/show_item.php'][
'typeRendering'] as $classRef) {
230 if (is_object($typeRenderObj) && method_exists($typeRenderObj,
'isValid') && method_exists($typeRenderObj,
'render')) {
231 if ($typeRenderObj->isValid($this->type, $this)) {
232 $this->content .= $typeRenderObj->render($this->type, $this);
233 $typeRendered =
true;
240 if (!$typeRendered) {
242 $this->content .= $this->renderPreview();
243 $this->content .= $this->renderPropertiesAsTable();
256 if ($this->type ===
'folder') {
258 $title = $this->doc->getResourceHeader($this->folderObject, array(
' ',
''),
false);
259 }
elseif ($this->type ===
'file') {
261 $title = $this->doc->getResourceHeader($this->fileObject, array(
' ',
''),
false);
264 $title = $this->doc->getHeader($this->table, $this->row, $this->pageInfo[
'_thePath'], 1, array(
' ',
''),
false);
279 protected function renderPreview()
282 if (!$this->fileObject) {
290 if ($this->fileObject->isMissing()) {
291 $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
292 $previewTag .= $flashMessage->render();
298 $fileExtension = $this->fileObject->getExtension();
299 $url = $this->fileObject->getPublicUrl(
true);
302 if ($fileRenderer !== null) {
303 $previewTag = $fileRenderer->render(
313 $processedFile = $this->fileObject->process(
321 if ($processedFile) {
322 $thumbUrl = $processedFile->getPublicUrl(
true);
323 $previewTag .=
'<img class="img-responsive img-thumbnail" src="' . $thumbUrl .
'" ' .
324 'width="' . $processedFile->getProperty(
'width') .
'" ' .
325 'height="' . $processedFile->getProperty(
'height') .
'" ' .
326 'alt="' . htmlspecialchars(trim($this->fileObject->getName())) .
'" ' .
327 'title="' . htmlspecialchars(trim($this->fileObject->getName())) .
'" />';
334 <a class="btn btn-primary" href="' . htmlspecialchars(
$url) .
'" target="_blank">
335 ' . $this->iconFactory->getIcon(
'actions-document-view',
Icon::SIZE_SMALL)->render() .
'
336 ' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.show',
true) .
'
341 return ($previewTag ?
'<p>' . $previewTag .
'</p>' :
'') .
342 ($showLink ?
'<p>' . $showLink .
'</p>' :
'');
350 protected function renderPropertiesAsTable()
352 $tableRows = array();
353 $extraFields = array();
356 if (in_array($this->type, array(
'folder',
'file'),
true)) {
357 if ($this->type ===
'file') {
358 $extraFields[
'creation_date'] =
$lang->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.creationDate',
true);
359 $extraFields[
'modification_date'] =
$lang->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.timestamp',
true);
361 $extraFields[
'storage'] =
$lang->sL(
'LLL:EXT:lang/locallang_tca.xlf:sys_file.storage',
true);
362 $extraFields[
'folder'] =
$lang->sL(
'LLL:EXT:lang/locallang_common.xlf:folder',
true);
364 $extraFields[
'crdate'] =
$lang->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.creationDate',
true);
365 $extraFields[
'cruser_id'] =
$lang->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.creationUserId',
true);
366 $extraFields[
'tstamp'] =
$lang->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.timestamp',
true);
369 foreach ($extraFields as $fieldName => $fieldLabel) {
370 if (isset(
$GLOBALS[
'TCA'][$this->table][
'ctrl'][$fieldName])) {
373 unset($extraFields[$fieldName]);
378 foreach ($extraFields as $name => $fieldLabel) {
380 if (!isset($this->row[$name])) {
382 if ($name ===
'storage') {
383 $rowValue = $resourceObject->getStorage()->getName();
384 }
elseif ($name ===
'folder') {
385 $rowValue = $resourceObject->getParentFolder()->getReadablePath();
387 }
elseif (in_array($name, array(
'creation_date',
'modification_date'),
true)) {
393 if ($name ===
'cruser_id' && $rowValue) {
395 if ($creatorRecord) {
398 $icon = $avatar->render($creatorRecord);
401 <div class="media-left">
404 <div class="media-body">
405 <strong>' . htmlspecialchars(
$GLOBALS[
'BE_USER']->user[
'username']) .
'</strong><br>
406 ' . (
$GLOBALS[
'BE_USER']->user[
'realName'] ? htmlspecialchars(
$GLOBALS[
'BE_USER']->user[
'realName']) :
'') .
'
414 <th class="col-nowrap">' . rtrim($fieldLabel,
':') .
'</th>
415 <td>' . ($name ===
'cruser_id' ? $rowValue : htmlspecialchars($rowValue)) .
'</td>
421 foreach ($fieldList as $name) {
423 $uid = $this->row[
'uid'];
425 if (!isset(
$GLOBALS[
'TCA'][$this->table][
'columns'][$name])) {
430 if ($this->type ===
'file' && $name ===
'storage') {
439 $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0,
false,
$uid);
443 <th class="col-nowrap">' . $itemLabel .
'</th>
444 <td>' . htmlspecialchars($itemValue) .
'</td>
449 <div class="table-fit table-fit-wrap">
450 <table class="table table-striped table-hover">
451 ' . implode(
'', $tableRows) .
'
465 switch ($this->type) {
467 $references = $this->
makeRef($this->table, $this->row[
'uid']);
468 if (!empty($references)) {
469 $content .=
'<h3>' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem',
true) .
'</h3>';
473 $referencesFrom = $this->
makeRefFrom($this->table, $this->row[
'uid']);
474 if (!empty($referencesFrom)) {
475 $content .=
'<h3>' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesFromThisItem',
true) .
'</h3>';
482 if ($this->fileObject && $this->fileObject->isIndexed()) {
483 $references = $this->
makeRef(
'_FILE', $this->fileObject);
485 if (!empty($references)) {
486 $content .=
'<h3>' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem',
true) .
'</h3>';
508 <a class="btn btn-primary" href="' . htmlspecialchars($returnUrl) .
'>
509 ' . $this->iconFactory->getIcon(
'actions-view-go-back',
Icon::SIZE_SMALL)->render() .
'
510 ' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_common.xlf:back',
true) .
'
524 $tableRows = array();
525 foreach ($fieldList as $name) {
526 if (!isset(
$GLOBALS[
'TCA'][$this->table][
'columns'][$name])) {
533 $uid = $this->row[
'uid'];
534 $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0,
false,
$uid);
538 <th>' . $itemLabel .
'</th>
539 <td>' . htmlspecialchars($itemValue) .
'</td>
548 <div class="table-fit table-fit-wrap">
549 <table class="table table-striped table-hover">
550 ' . implode(
'', $tableRows) .
'
564 echo $this->doc->startPage($this->titleTag) .
565 $this->doc->insertStylesAndJS($this->content) .
566 $this->doc->endPage();
578 if (
$GLOBALS[
'TCA'][$tableName][
'columns'][$fieldName][
'label'] !== null) {
580 if (trim($field) ===
'') {
611 $url = BackendUtility::getModuleUrl(
'record_edit', $urlParameters);
613 <a class="btn btn-default btn-sm" href="' . htmlspecialchars(
$url) .
'">
614 ' . $this->iconFactory->getIcon(
'actions-document-open',
Icon::SIZE_SMALL)->render() .
'
622 $url = BackendUtility::getModuleUrl(
'record_history', $urlParameters);
623 $pageActionIcons .=
'
624 <a class="btn btn-default btn-sm" href="' . htmlspecialchars(
$url) .
'">
625 ' . $this->iconFactory->getIcon(
'actions-document-history-open',
Icon::SIZE_SMALL)->render() .
'
631 $pageActionIcons .=
'
632 <a class="btn btn-default btn-sm" href="' . htmlspecialchars(
$url) .
'" title="' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.showList') .
'">
633 ' . $this->iconFactory->getIcon(
'actions-system-list-open',
Icon::SIZE_SMALL)->render() .
'
638 $pageActionIcons .=
'
639 <a class="btn btn-default btn-sm" href="#" onclick="' . htmlspecialchars($viewOnClick) .
'" title="' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.showPage',
true) .
'">
640 ' . $this->iconFactory->getIcon(
'actions-document-view',
Icon::SIZE_SMALL)->render() .
'
645 <div class="btn-group" role="group">
646 ' . $pageActionIcons .
'
662 $selectTable =
'sys_file';
663 $selectUid = $ref->getUid();
671 'ref_table=' . $this->
getDatabaseConnection()->fullQuoteStr($selectTable,
'sys_refindex') .
' AND ref_uid=' . (
int)$selectUid .
' AND deleted=0'
676 $infoDataHeader =
'';
680 <th class="col-icon"></th>
681 <th class="col-title">' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.title') .
'</th>
682 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.table') .
'</th>
683 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.uid') .
'</th>
684 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.field') .
'</th>
685 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.flexpointer') .
'</th>
686 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.softrefKey') .
'</th>
687 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.sorting') .
'</th>
688 <th class="col-control"></th>
691 foreach ($rows as
$row) {
692 if ($row[
'tablename'] ===
'sys_file_reference') {
694 if ($row[
'tablename'] === null || $row[
'recuid'] === null) {
701 $parentRecordTitle = is_array($parentRecord)
704 $icon = $this->iconFactory->getIconForRecord($row[
'tablename'], $record,
Icon::SIZE_SMALL)->render();
708 $row[
'tablename'] => [
709 $row[
'recuid'] =>
'edit'
714 $url = BackendUtility::getModuleUrl(
'record_edit', $urlParameters);
717 <td class="col-icon">
718 <a href="' . htmlspecialchars(
$url) .
'" title="id=' . $record[
'uid'] .
'">
722 <td class="col-title">
723 <a href="' . htmlspecialchars(
$url) .
'" title="id=' . $record[
'uid'] .
'" >
727 <td>' .
$lang->sL(
$GLOBALS[
'TCA'][$row[
'tablename']][
'ctrl'][
'title'],
true) .
'</td>
729 <span title="' .
$lang->sL(
'LLL:EXT:lang/locallang_common.xlf:page') .
': '
730 . htmlspecialchars($parentRecordTitle) .
' (uid=' . $record[
'pid'] .
')">
731 ' . $record[
'uid'] .
'
735 <td>' . htmlspecialchars($row[
'flexpointer']) .
'</td>
736 <td>' . htmlspecialchars($row[
'softref_key']) .
'</td>
737 <td>' . htmlspecialchars($row[
'sorting']) .
'</td>
738 <td class="col-control">' . $actions .
'</td>
743 <td class="col-icon"></td>
744 <td class="col-title">' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.missing_record') .
' (uid=' . (int)$row[
'recuid'] .
')</td>
745 <td>' . htmlspecialchars(
$lang->sL(
$GLOBALS[
'TCA'][$row[
'tablename']][
'ctrl'][
'title']) ?: $row[
'tablename']) .
'</td>
748 <td>' . htmlspecialchars($row[
'flexpointer']) .
'</td>
749 <td>' . htmlspecialchars($row[
'softref_key']) .
'</td>
750 <td>' . htmlspecialchars($row[
'sorting']) .
'</td>
751 <td class="col-control"></td>
756 if (!empty($infoData)) {
758 <div class="table-fit">
759 <table class="table table-striped table-hover">
760 <thead>' . $infoDataHeader .
'</thead>
761 <tbody>' . implode(
'', $infoData) .
'</tbody>
765 return $referenceLine;
786 $infoDataHeader =
'';
790 <th class="col-icon"></th>
791 <th class="col-title">' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.title') .
'</th>
792 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.table') .
'</th>
793 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.uid') .
'</th>
794 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.field') .
'</th>
795 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.flexpointer') .
'</th>
796 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.softrefKey') .
'</th>
797 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.sorting') .
'</th>
798 <th>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.refString') .
'</th>
799 <th class="col-control"></th>
802 foreach ($rows as
$row) {
805 $icon = $this->iconFactory->getIconForRecord($row[
'tablename'], $record,
Icon::SIZE_SMALL)->render();
810 $row[
'ref_table'] => [
811 $row[
'ref_uid'] =>
'edit'
816 $url = BackendUtility::getModuleUrl(
'record_edit', $urlParameters);
819 <td class="col-icon">
820 <a href="' . htmlspecialchars(
$url) .
'" title="id=' . $record[
'uid'] .
'">
824 <td class="col-title">
825 <a href="' . htmlspecialchars(
$url) .
'" title="id=' . $record[
'uid'] .
'" >
829 <td>' .
$lang->sL(
$GLOBALS[
'TCA'][$row[
'ref_table']][
'ctrl'][
'title'],
true) .
'</td>
830 <td>' . htmlspecialchars($row[
'ref_uid']) .
'</td>
832 <td>' . htmlspecialchars($row[
'flexpointer']) .
'</td>
833 <td>' . htmlspecialchars($row[
'softref_key']) .
'</td>
834 <td>' . htmlspecialchars($row[
'sorting']) .
'</td>
835 <td>' . htmlspecialchars($row[
'ref_string']) .
'</td>
836 <td class="col-control">' . $actions .
'</td>
841 <td class="col-icon"></td>
842 <td class="col-title">' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:show_item.php.missing_record') .
' (uid=' . (int)$row[
'recuid'] .
')</td>
843 <td>' .
$lang->sL(
$GLOBALS[
'TCA'][$row[
'ref_table']][
'ctrl'][
'title'],
true) .
'</td>
846 <td>' . htmlspecialchars($row[
'flexpointer']) .
'</td>
847 <td>' . htmlspecialchars($row[
'softref_key']) .
'</td>
848 <td>' . htmlspecialchars($row[
'sorting']) .
'</td>
849 <td>' . htmlspecialchars($row[
'ref_string']) .
'</td>
850 <td class="col-control"></td>
855 if (empty($infoData)) {
860 <div class="table-fit">
861 <table class="table table-striped table-hover">
862 <thead>' . $infoDataHeader .
'</thead>
863 <tbody>' . implode(
'', $infoData) .
'</tbody>
878 'sys_file_reference',
879 'uid=' . (
int)$referenceRecord[
'recuid']
882 'recuid' => $fileReference[
'uid_foreign'],
883 'tablename' => $fileReference[
'tablenames'],
884 'field' => $fileReference[
'fieldname'],
887 'sorting' => $fileReference[
'sorting_foreign']