From: Stefan Galinski Date: Thu, 28 Jun 2012 16:15:08 +0000 (+0200) Subject: [FEATURE] Improve the info popup X-Git-Tag: TYPO3_6-0-0alpha3~127 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/5a48e86cba0471560f87daf662f7efa96ed1bf54?hp=036eb9400cbc8e462b9e550b05dc46aa56aeb319 [FEATURE] Improve the info popup The change improves the general spacing and CGL of the code, removes some unused variables, tailores some very long lines for better readability, adds the creation date, creation user and last modified timestamp of the record and adds some general actions to the references which improve the usability of the feature a lot. Change-Id: Iad2ec3ca01707a1486e2785115e3c5c25f6e1c57 Resolves: #38469 Releases: 6.0 Reviewed-on: http://review.typo3.org/12420 Reviewed-by: Susanne Moog Tested-by: Susanne Moog Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- diff --git a/typo3/show_item.php b/typo3/show_item.php index 60c083838f3..efef6439f1c 100644 --- a/typo3/show_item.php +++ b/typo3/show_item.php @@ -1,37 +1,29 @@ - */ - + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ $GLOBALS['BACK_PATH'] = ''; require_once('init.php'); @@ -43,13 +35,23 @@ require_once('init.php'); * @package TYPO3 * @subpackage core */ -class transferData extends t3lib_transferData { - +class transferData extends t3lib_transferData { + /** + * @var string + */ var $formname = 'loadform'; + + /** + * @var boolean + */ var $loading = 1; - // Extra for show_item.php: - var $theRecord = Array(); + /** + * Extra for show_item.php: + * + * @var array + */ + var $theRecord = array(); /** * Register item function. @@ -70,15 +72,16 @@ class transferData extends t3lib_transferData { break; } if (t3lib_div::inList($config['eval'], 'date')) { - $content = Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $content); + $content = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $content); } - break; + break; + case 'group': - break; case 'select': - break; + break; } - $this->theRecord[$field]=$content; + + $this->theRecord[$field] = $content; } } @@ -90,35 +93,77 @@ class transferData extends t3lib_transferData { * @subpackage core */ class SC_show_item { - - // GET vars: - // Record table (or filename) + /** + * GET vars: + * Record table (or filename) + * + * @var string + */ var $table; - // Record uid (or '' when filename) + + /** + * Record uid (or '' when filename) + * + * @var int + */ var $uid; - // Internal, static: - // Page select clause + /** + * Internal, static: + * Page select clause + * + * @var string + */ var $perms_clause; - // If TRUE, access to element is granted + + /** + * If TRUE, access to element is granted + * + * @var boolean + */ var $access; - // Which type of element: "file" or "db" + + /** + * Which type of element: "file" or "db" + * + * @var string + */ var $type; - // Document Template Object + + /** + * Document Template Object + * + * @var template + */ var $doc; - // Internal, dynamic: - // Content Accumulation + /** + * Internal, dynamic: + * Content Accumulation + * + * @var string + */ var $content; - // For type "db": Set to page record of the parent page of the item set (if type="db") + + /** + * For type "db": Set to page record of the parent page of the item set + * (if type="db") + * + * @var array + */ var $pageinfo; - // For type "db": The database record row. + + /** + * For type "db": The database record row. + * + * @var array + */ var $row; /** * The fileObject if present * - * @var t3lib_file_AbstractFile + * @var t3lib_file_File */ protected $fileObject; @@ -131,7 +176,8 @@ class SC_show_item { /** * Initialization of the class - * Will determine if table/uid GET vars are database record or a file and if the user has access to view information about the item. + * Will determine if table/uid GET vars are database record or a file and if + * the user has access to view information about the item. * * @return void */ @@ -147,7 +193,8 @@ class SC_show_item { // Sets the type, "db" or "file". If blank, nothing can be shown. $this->type = ''; - // Checking if the $table value is really a table and if the user has access to it. + // Checking if the $table value is really a table and if the user has + // access to it. if (isset($GLOBALS['TCA'][$this->table])) { t3lib_div::loadTCA($this->table); $this->type = 'db'; @@ -157,20 +204,21 @@ class SC_show_item { if ($this->uid && $GLOBALS['BE_USER']->check('tables_select', $this->table)) { if ((string)$this->table == 'pages') { $this->pageinfo = t3lib_BEfunc::readPageAccess($this->uid, $this->perms_clause); - $this->access = is_array($this->pageinfo) ? 1 : 0; + $this->access = (is_array($this->pageinfo) ? 1 : 0); $this->row = $this->pageinfo; } else { $this->row = t3lib_BEfunc::getRecordWSOL($this->table, $this->uid); if ($this->row) { $this->pageinfo = t3lib_BEfunc::readPageAccess($this->row['pid'], $this->perms_clause); - $this->access = is_array($this->pageinfo) ? 1 : 0; + $this->access = (is_array($this->pageinfo) ? 1 : 0); } } + /** @var $treatData t3lib_transferData */ $treatData = t3lib_div::makeInstance('t3lib_transferData'); $treatData->renderRecord($this->table, $this->uid, 0, $this->row); - $cRow = $treatData->theRecord; } + } elseif ($this->table == '_FILE' || $this->table == '_FOLDER' || $this->table == 'sys_file') { $fileOrFolderObject = t3lib_file_Factory::getInstance()->retrieveFileOrFolderObject($this->uid); @@ -184,13 +232,12 @@ class SC_show_item { $this->type = 'file'; $this->table = 'sys_file'; t3lib_div::loadTCA($this->table); + try { $this->row = t3lib_BEfunc::getRecordWSOL($this->table, $this->fileObject->getUid()); } catch (Exception $e) { $this->row = array(); } - - } } @@ -199,133 +246,203 @@ class SC_show_item { $this->doc->backPath = $GLOBALS['BACK_PATH']; // Starting the page by creating page header stuff: - $this->content .= $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.viewItem')); - $this->content .= '

' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.viewItem') . '

'; + $this->content .= $this->doc->startPage( + $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.viewItem') + ); + + $this->content .= '

' . + $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.viewItem') . '

'; $this->content .= $this->doc->spacer(5); } /** - * Main function. Will generate the information to display for the item set internally. + * Main function. Will generate the information to display for the item + * set internally. * * @return void */ function main() { + if (!$this->access) { + return; + } - if ($this->access) { - $returnLink = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl')); - $returnLinkTag = $returnLink ? '' : ''; - // render type by user func - $typeRendered = FALSE; - if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) { - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) { - $typeRenderObj = t3lib_div::getUserObj($classRef); - if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) { - if ($typeRenderObj->isValid($this->type, $this)) { - $this->content .= $typeRenderObj->render($this->type, $this); - $typeRendered = TRUE; - break; - } + $returnLink = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl')); + $returnLinkTag = $returnLink ? '' : ''; + + // render type by user func + $typeRendered = FALSE; + if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) { + $typeRenderObj = t3lib_div::getUserObj($classRef); + // @TODO should have an interface + if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') + && method_exists($typeRenderObj, 'render') + ) { + if ($typeRenderObj->isValid($this->type, $this)) { + $this->content .= $typeRenderObj->render($this->type, $this); + $typeRendered = TRUE; + break; } } } + } - // If type was not rendered use default rendering functions - if (!$typeRendered) { - // Branch out based on type: - switch ($this->type) { - case 'db': - $this->renderDBInfo(); - break; - case 'file': - $this->renderFileInfo($returnLinkTag); - break; - case 'folder': - // @todo: implement a info about a folder - break; - } + // If type was not rendered use default rendering functions + if (!$typeRendered) { + // Branch out based on type: + switch ($this->type) { + case 'db': + $this->renderDBInfo(); + break; + case 'file': + $this->renderFileInfo($returnLinkTag); + break; + case 'folder': + // @todo: implement an info about a folder + break; } + } - // If return Url is set, output link to go back: - if (t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'))) { - $this->content = $this->doc->section('', $returnLinkTag.''.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack', 1).'

').$this->content; - - $this->content .= $this->doc->section('', '
'.$returnLinkTag.''.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack', 1).''); - } + // If return Url is set, output link to go back: + if (t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'))) { + $this->content = $this->doc->section( + '', + $returnLinkTag . + ''.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack', 1) . + '

' + ) . $this->content; + + $this->content .= $this->doc->section( + '', + '
' . $returnLinkTag . + '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack', 1) . + '' + ); } } /** - * Main function. Will generate the information to display for the item set internally. + * Main function. Will generate the information to display for the item + * set internally. * * @return void */ function renderDBInfo() { - // Print header, path etc: - $code = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1).'
'; - $this->content.= $this->doc->section('', $code); - - // Initialize variables: + // @TODO invalid context menu code in the output + $code = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1) . '
'; + $this->content .= $this->doc->section('', $code); $tableRows = array(); - $i = 0; + + $extraFields = array( + 'crdate' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.creationDate', 1), + 'cruser_id' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.creationUserId', 1), + 'tstamp' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.timestamp', 1) + ); + + foreach ($extraFields as $name => $value) { + $rowValue = t3lib_BEfunc::getProcessedValueExtra($this->table, $name, $this->row[$name]); + + if ($name === 'cruser_id' && $rowValue) { + $userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( + 'username, realName', + 'be_users', + 'uid = ' . intval($rowValue) + ); + + if ($userTemp[0]['username'] !== '') { + $rowValue = $userTemp[0]['username']; + if ($userTemp[0]['realName'] !== '') { + $rowValue .= ' - '.$userTemp[0]['realName']; + } + } + } + + $tableRows[] = ' + + ' . $value . ' + ' . htmlspecialchars($rowValue) . ' + '; + } // Traverse the list of fields to display for the record: $fieldList = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], 1); foreach ($fieldList as $name) { $name = trim($name); - if ($GLOBALS['TCA'][$this->table]['columns'][$name]) { - if (!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name)) { - $i++; - $tableRows[] = ' - - ' . $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($this->table, $name), 1) . ' - ' . htmlspecialchars(t3lib_BEfunc::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $this->row['uid'])) . ' - '; - } + if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) { + continue; + } + + $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || + $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name)); + if ($isExcluded) { + continue; } + + $uid = $this->row['uid']; + $itemValue = t3lib_BEfunc::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid); + $itemLabel = $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($this->table, $name), 1); + $tableRows[] = ' + + ' . $itemLabel . ' + ' . htmlspecialchars($itemValue) . ' + '; } // Create table from the information: $tableCode = ' - - '.implode('', $tableRows).' -
'; + + '.implode('', $tableRows).' +
'; $this->content .= $this->doc->section('', $tableCode); // Add path and table information in the bottom: $code = ''; - $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -48) . '
'; - $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table') . ': ' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']) . ' (' . $this->table . ') - UID: ' . $this->uid . '
'; + $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . + t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -48) . '
'; + $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table') . ': ' . + $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']) . + ' (' . $this->table . ') - UID: ' . $this->uid . '
'; $this->content .= $this->doc->section('', $code); // References: - $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $this->makeRef($this->table, $this->row['uid'])); + $this->content .= $this->doc->section( + $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), + $this->makeRef($this->table, $this->row['uid']) + ); - // References: - $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesFromThisItem'), $this->makeRefFrom($this->table, $this->row['uid'])); + $this->content .= $this->doc->section( + $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesFromThisItem'), + $this->makeRefFrom($this->table, $this->row['uid']) + ); } /** - * Main function. Will generate the information to display for the item set internally. + * Main function. Will generate the information to display for the item + * set internally. * * @param string $returnLinkTag tag closing/returning. * @return void */ function renderFileInfo($returnLinkTag) { $fileExtension = $this->fileObject->getExtension(); - // Setting header: - $code = '
' - . t3lib_iconWorks::getSpriteIconForFile($fileExtension) . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.file', TRUE) . ': ' . $this->fileObject->getName() - . '  ' - . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.filesize') . ': ' - . t3lib_div::formatSize($this->fileObject->getSize()) - . '
+ $code = '
' . + t3lib_iconWorks::getSpriteIconForFile($fileExtension) . + '' . + $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.file', TRUE) . + ': ' . $this->fileObject->getName() . + '  ' . + '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.filesize') . + ': ' . + t3lib_div::formatSize($this->fileObject->getSize()) . + '
'; $this->content .= $this->doc->section('', $code); $this->content .= $this->doc->divider(2); // If the file was an image... - // @todo: add this check in the domain model in some kind of way, or in the processing folder + // @todo: add this check in the domain model, or in the processing folder if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) { // @todo: find a way to make getimagesize part of the t3lib_file object $imgInfo = @getimagesize($this->fileObject->getForLocalProcessing(FALSE)); @@ -334,64 +451,77 @@ class SC_show_item { t3lib_file_ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '150m', 'height' => '150m') )->getPublicUrl(TRUE); - $code = '
' - . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.dimensions') - . ': ' . $imgInfo[0] . 'x' . $imgInfo[1] . ' ' - . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.pixels') . '
'; + + $code = '
' . + '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.dimensions') . + ': ' . $imgInfo[0] . 'x' . $imgInfo[1] . ' ' . + $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.pixels') . '
'; + $code .= '
-
' . $returnLinkTag . '' . htmlspecialchars(trim($this->fileObject->getName())) . '
'; +
' . $returnLinkTag . '' .
+				htmlspecialchars(trim($this->fileObject->getName())) . '
'; $this->content .= $this->doc->section('', $code); + } elseif ($fileExtension == 'ttf') { $thumbUrl = $this->fileObject->process( t3lib_file_ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '530m', 'height' => '600m') )->getPublicUrl(TRUE); + $thumb = '
-
' . $returnLinkTag . '
'; +
' . $returnLinkTag . '
'; $this->content .= $this->doc->section('', $thumb); } - // Initialize variables: - $tableRows = array(); - $i = 0; - // Traverse the list of fields to display for the record: - $fieldList = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], TRUE); + $tableRows = array(); + $showRecordFieldList = $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList']; + $fieldList = t3lib_div::trimExplode(',', $showRecordFieldList, TRUE); foreach ($fieldList as $name) { $name = trim($name); - if ($GLOBALS['TCA'][$this->table]['columns'][$name]) { - if (!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name)) { - $i++; - $tableRows[] = ' - - ' . $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($this->table, $name), 1) . ' - ' . htmlspecialchars(t3lib_BEfunc::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $this->row['uid'])) . ' - '; - } + if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) { + continue; + } + + $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || + $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name)); + if ($isExcluded) { + continue; } + + $uid = $this->row['uid']; + $itemValue = t3lib_BEfunc::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid); + $itemLabel = $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($this->table, $name), 1); + $tableRows[] = ' + + ' . $itemLabel . ' + ' . htmlspecialchars($itemValue) . ' + '; } // Create table from the information: $tableCode = ' - - ' . implode('', $tableRows) . ' -
'; + + ' . implode('', $tableRows) . ' +
'; $this->content .= $this->doc->section('', $tableCode); - + // References: if ($this->fileObject->isIndexed()) { - // References: - $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $this->makeRef('_FILE', $this->fileObject)); + $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'); + $this->content .= $this->doc->section($header, $this->makeRef('_FILE', $this->fileObject)); } } /** * End page and print content * - * @return void + * @return void */ function printContent() { - $this->content.= $this->doc->endPage(); + $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); echo $this->content; } @@ -413,38 +543,66 @@ class SC_show_item { } else { $field = $fieldName; } + return $field; } + /** + * Returns the rendered record actions + * + * @param string $table + * @param integer $uid + * @return string + */ + protected function getRecordActions($table, $uid) { + if ($table === '' || $uid < 0) { + return ''; + } + + $editOnClick = t3lib_BEfunc::editOnClick('&edit[' . $table . '][' . $uid . ']=edit', $GLOBALS['BACK_PATH']); + $icon = t3lib_iconWorks::getSpriteIcon('actions-document-open'); + $pageActionIcons = '' . $icon . ''; + + $historyOnClick = 'window.location.href=\'show_rechis.php?element=' . $table . '%3A' . $uid . + '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '\'; return false;'; + $icon = t3lib_iconWorks::getSpriteIcon('actions-document-history-open'); + $pageActionIcons .= '' . $icon . ''; + + if ($table === 'pages') { + $pageActionIcons .= $this->doc->viewPageIcon($uid, ''); + } + + return $pageActionIcons; + } + /** * Make reference display * * @param string $table Table name - * @param string $ref Filename or uid + * @param string|t3lib_file_File $ref Filename or uid * @return string HTML */ function makeRef($table, $ref) { - + // Look up the path: if ($table === '_FILE') { - // Look up the path: $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( '*', 'sys_file_reference', 'uid_local=' . $ref->getUid() ); } else { - // Look up the path: $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( '*', 'sys_refindex', - 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND ref_uid=' . intval($ref) . - ' AND deleted=0' + 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . + ' AND ref_uid=' . intval($ref) . ' AND deleted=0' ); } // Compile information for title tag: $infoData = array(); if (count($rows)) { $infoData[] = '' . + ' ' . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.table') . '' . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.title') . '' . '[uid]' . @@ -454,16 +612,21 @@ class SC_show_item { '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.sorting') . '' . ''; } + foreach ($rows as $row) { if($table === '_FILE') { $row = $this->mapFileReferenceOnRefIndex($row); } + $record = t3lib_BEfunc::getRecord($row['tablename'], $row['recuid']); + $parentRecord = t3lib_BEfunc::getRecord('pages', $record['pid']); + $actions = $this->getRecordActions($row['tablename'], $row['recuid']); $infoData[] = '' . + '' . $actions . '' . '' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$row['tablename']]['ctrl']['title'], TRUE) . '' . '' . t3lib_BEfunc::getRecordTitle($row['tablename'], $record, TRUE) . '' . '' . $record['uid'] . '' . '' . htmlspecialchars($this->getFieldName($row['tablename'], $row['field'])) . '' . '' . htmlspecialchars($row['flexpointer']) . '' . @@ -472,9 +635,13 @@ class SC_show_item { ''; } - return count($infoData) - ? '' . implode('', $infoData) . '
' - : ''; + $referenceLine = ''; + if (count($infoData)) { + $referenceLine = '' . + implode('', $infoData) . '
'; + } + + return $referenceLine; } /** @@ -503,8 +670,8 @@ class SC_show_item { * @return string HTML */ function makeRefFrom($table, $ref) { - // Look up the path: + // @TODO files not respected (see makeRef) $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( '*', 'sys_refindex', @@ -516,6 +683,7 @@ class SC_show_item { $infoData = array(); if (count($rows)) { $infoData[] = '' . + ' ' . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.field') . '' . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.flexpointer') . '' . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.softrefKey') . '' . @@ -525,8 +693,11 @@ class SC_show_item { '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.refString') . '' . ''; } + foreach ($rows as $row) { + $actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']); $infoData[] = '' . + '' . $actions . '' . '' . htmlspecialchars($this->getFieldName($table, $row['field'])) . '' . '' . htmlspecialchars($row['flexpointer']) . '' . '' . htmlspecialchars($row['softref_key']) . '' . @@ -537,16 +708,20 @@ class SC_show_item { ''; } - return count($infoData) - ? '' . implode('', $infoData) . '
' - : ''; + $referenceLine = ''; + if (count($infoData)) { + $referenceLine = '' . + implode('', $infoData) . '
'; + } + + return $referenceLine; } } - // Make instance: +/** @var $SOBE SC_show_item */ $SOBE = t3lib_div::makeInstance('SC_show_item'); $SOBE->init(); $SOBE->main(); $SOBE->printContent(); -?> +?> \ No newline at end of file diff --git a/typo3/sysext/lang/locallang_general.xlf b/typo3/sysext/lang/locallang_general.xlf index bbe1b095019..f18262a0ee5 100644 --- a/typo3/sysext/lang/locallang_general.xlf +++ b/typo3/sysext/lang/locallang_general.xlf @@ -9,6 +9,15 @@ Hide: + + Last Modified: + + + Created At: + + + Created By: + Start: