Index: Classes/ExtDirect/ActionHandler.php =================================================================== --- Classes/ExtDirect/ActionHandler.php (revision 3891) +++ Classes/ExtDirect/ActionHandler.php (working copy) @@ -103,11 +103,12 @@ /** * Generates a view link for a page. * - * @param string $pid + * @param string $table + * @param string $uid * @return void */ - public function viewSingleRecord($pid) { - return t3lib_BEfunc::viewOnClick($pid); + public function viewSingleRecord($table, $uid) { + return tx_Workspaces_Service_Workspaces::viewSingleRecord($table, $uid); } Index: Classes/Service/GridData.php =================================================================== --- Classes/Service/GridData.php (revision 3891) +++ Classes/Service/GridData.php (working copy) @@ -53,7 +53,7 @@ $limit = isset($parameter->limit) ? intval($parameter->limit) : 10; $this->sort = isset($parameter->sort) ? $parameter->sort : 't3ver_oid'; $this->sortDir = isset($parameter->dir) ? $parameter->dir : 'ASC'; - + if (is_int($currentWorkspace)) { $this->currentWorkspace = $currentWorkspace; } else { @@ -81,7 +81,7 @@ protected function generateDataArray(array $versions, $filterTxt) { /** @var $stagesObj Tx_Workspaces_Service_Stages */ $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages'); - + /** @var $workspacesObj Tx_Workspaces_Service_Workspaces */ $workspacesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Workspaces'); $availableWorkspaces = $workspacesObj->getAvailableWorkspaces(); @@ -91,21 +91,22 @@ // check for dataArray in cache if ($this->getDataArrayFromCache($versions, $filterTxt) == FALSE) { $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages'); - + foreach ($versions as $table => $records) { $versionArray = array('table' => $table); - + foreach ($records as $record) { - + $origRecord = t3lib_BEFunc::getRecord($table, $record['t3ver_oid']); $versionRecord = t3lib_BEFunc::getRecord($table, $record['uid']); - + if (isset($GLOBALS['TCA'][$table]['columns']['hidden'])) { $recordState = $this->workspaceState($versionRecord['t3ver_state'], $origRecord['hidden'], $versionRecord['hidden']); } else { $recordState = $this->workspaceState($versionRecord['t3ver_state']); } $isDeletedPage = ($table == 'pages' && $recordState == 'deleted'); + $viewUrl = tx_Workspaces_Service_Workspaces::viewSingleRecord($table, $record['t3ver_oid'], $origRecord); $pctChange = $this->calculateChangePercentage($table, $origRecord, $versionRecord); $versionArray['uid'] = $record['uid']; @@ -132,7 +133,7 @@ $versionArray['allowedAction_swap'] = $GLOBALS['BE_USER']->workspaceSwapAccess(); $versionArray['allowedAction_delete'] = TRUE; // preview and editing of a deleted page won't work ;) - $versionArray['allowedAction_view'] = !$isDeletedPage; + $versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl; $versionArray['allowedAction_edit'] = !$isDeletedPage; $versionArray['allowedAction_editVersionedPage'] = !$isDeletedPage; @@ -144,7 +145,7 @@ } } $this->sortDataArray(); - + $this->setDataArrayIntoCache($versions, $filterTxt); } $this->sortDataArray(); @@ -171,7 +172,7 @@ /** * Initialize the workspace cache - * + * * @return void */ protected function initializeWorkspacesCachingFramework() { @@ -185,7 +186,7 @@ } catch (t3lib_cache_exception_DuplicateIdentifier $e) { // do nothing, a workspace cache already exists } - + $this->workspacesCache = $GLOBALS['typo3CacheManager']->getCache('workspaces_cache'); } } @@ -193,7 +194,7 @@ /** * Put the generated dataArray into the workspace cache. - * + * * @param array $versions All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid, t3ver_oid and t3ver_swapmode fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid" * @param string $filterTxt The given filter text from the grid. */ @@ -201,38 +202,38 @@ if (TYPO3_UseCachingFramework === TRUE) { $hash = $this->calculateHash($versions, $filterTxt); $content = serialize($this->dataArray); - + $this->workspacesCache->set($hash, $content, array($this->currentWorkspace)); } } - - + + /** * Checks if a cache entry is given for given versions and filter text and tries to load the data array from cache. - * + * * @param array $versions All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid, t3ver_oid and t3ver_swapmode fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid" * @param string $filterTxt The given filter text from the grid. */ protected function getDataArrayFromCache (array $versions, $filterTxt) { $cacheEntry = FALSE; - + if (TYPO3_UseCachingFramework === TRUE) { $hash = $this->calculateHash($versions, $filterTxt); - + $content = $this->workspacesCache->get($hash); - + if ($content != FALSE) { $this->dataArray = unserialize($content); $cacheEntry = TRUE; } } - + return $cacheEntry; } - + /** * Calculate the hash value of the used workspace, the user id, the versions array, the filter text, the sorting attribute, the workspace selected in grid and the sorting direction. - * + * * @param array $versions All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid, t3ver_oid and t3ver_swapmode fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid" * @param string $filterTxt The given filter text from the grid. */ @@ -246,7 +247,7 @@ $this->sortDir, $this->currentWorkspace); $hash = md5(serialize($hashArray)); - + return $hash; } Index: Classes/Service/Workspaces.php =================================================================== --- Classes/Service/Workspaces.php (revision 3891) +++ Classes/Service/Workspaces.php (working copy) @@ -462,6 +462,26 @@ } return $isNewPage; } + + /** + * Generates a view link for a page. + * + * @static + * @param $table + * @param $uid + * @param $record + * @return string + */ + public static function viewSingleRecord($table, $uid, $record=null) { + $viewUrl = ''; + if ($table == 'pages') { + $viewUrl = t3lib_BEfunc::viewOnClick($uid); + } elseif ($table == 'pages_language_oderlay' || $table == 'tt_content') { + $elementRecord = is_array($record) ? $record : t3lib_BEfunc::getRecord($table, $uid); + $viewUrl = t3lib_BEfunc::viewOnClick($elementRecord['pid']); + } + return $viewUrl; + } } Index: Resources/Public/JavaScript/configuration.js =================================================================== --- Resources/Public/JavaScript/configuration.js (revision 3891) +++ Resources/Public/JavaScript/configuration.js (working copy) @@ -260,11 +260,7 @@ ,tooltip: TYPO3.lang["tooltip.viewElementAction"] ,handler: function(grid, rowIndex, colIndex) { var record = TYPO3.Workspaces.MainStore.getAt(rowIndex); - if (record.json.table == 'pages') { - TYPO3.Workspaces.Actions.viewSingleRecord(record.json.t3ver_oid); - } else { - TYPO3.Workspaces.Actions.viewSingleRecord(record.json.livepid); - } + TYPO3.Workspaces.Actions.viewSingleRecord(record.json.table, record.json.livepid); }, getClass: function(v, meta, rec) { if(!rec.json.allowedAction_view) { @@ -302,7 +298,7 @@ } }, getClass: function(v, meta, rec) { - if(!rec.json.allowedAction_editVersionedPage) { + if(!rec.json.allowedAction_editVersionedPage || !top.TYPO3.configuration.pageModule) { return 'icon-hidden'; } else { return '';