Project

General

Profile

Bug #10831 » 10831v2.patch

Tolleiv Nietsch, 2010-11-29 18:10

View differences:

Classes/Controller/PreviewController.php (working copy)
// @todo - handle new pages here
// branchpoints are not handled anymore because this feature is not supposed anymore
$this->view->assign('liveUrl', $wsBaseUrl . '&ADMCMD_noBeUser=1');
if (tx_Workspaces_Service_Workspaces::isNewPage($this->pageId)) {
$wsNewPageUri = $uriBuilder->uriFor('newPage', array(), $this, 'workspaces', 'web_workspacesworkspaces');
$wsNewPageParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Preview';
$this->view->assign('liveUrl', $wsSettingsPath . $wsNewPageUri . $wsNewPageParams);
} else {
$this->view->assign('liveUrl', $wsBaseUrl . '&ADMCMD_noBeUser=1');
}
$this->view->assign('wsUrl', $wsBaseUrl . '&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS=' . $GLOBALS['BE_USER']->workspace);
$this->view->assign('wsSettingsUrl', $wsSettingsUrl);
$this->view->assign('wsHelpUrl', $wsHelpUrl);
......
}
/**
* @return void
*/
public function newPageAction() {
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage.detail'),
$GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage'),
t3lib_FlashMessage::INFO
);
t3lib_FlashMessageQueue::addMessage($message);
}
/**
* Generates the JavaScript code for the backend,
* and since we're loading a backend module outside of the actual backend
* this copies parts of the backend.php
Classes/Service/Workspaces.php (working copy)
}
return $oldStyleWorkspaceIsUsed;
}
/**
* Determine whether a specific page is new and not yet available in the LIVE workspace
*
* @static
* @param $id Primary key of the page to check
* @param $language Language for which to check the page
* @return bool
*/
public static function isNewPage($id, $language = 0) {
$isNewPage = FALSE;
// If the language is not default, check state of overlay
if ($language > 0) {
$whereClause = 'pid = ' . $id;
$whereClause .= ' AND ' .$GLOBALS['TCA']['pages_language_overlay']['ctrl']['languageField'] . ' = ' . $language;
$whereClause .= ' AND t3ver_wsid = ' . $GLOBALS['BE_USER']->workspace;
$whereClause .= t3lib_BEfunc::deleteClause('pages_language_overlay');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('t3ver_state', 'pages_language_overlay', $whereClause);
if (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
$isNewPage = (int) $row['t3ver_state'] === 1;
}
// Otherwise check state of page itself
} else {
$rec = t3lib_BEfunc::getRecord('pages', $id, 't3ver_state');
if (is_array($rec)) {
$isNewPage = (int) $rec['t3ver_state'] === 1;
}
}
return $isNewPage;
}
}
ext_tables.php (working copy)
array(
// An array holding the controller-action-combinations that are accessible
'Review' => 'index,fullIndex,singleIndex',
'Preview' => 'index,help'
'Preview' => 'index,help,newPage'
),
array(
'access' => 'user,group',
Resources/Private/Language/locallang.xml (working copy)
<label index="window.sendToNextStageWindow.comments">Comments</label>
<label index="error.getStageTitle.stageNotFound">Stage not found</label>
<label index="warning.oldStyleWorkspaceInUser">It seems that you're stil using old-style workspace. If you continue using this module without migrating your workspace you might loose data.</label>
<label index="info.newpage">New Page!</label>
<label index="info.newpage.detail">The previewed page has been created in a workspace and has no live counterpart.</label>
</languageKey>
</data>
</T3locallang>
Resources/Private/Layouts/nodoc.html (working copy)
<!-- ###FULLDOC### begin -->
{namespace this=Tx_Workspaces_ViewHelpers}
<div class="typo3-noDoc">
<!-- Content of module, for instance listing, info or editing -->
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
<this:TempFlashMessageQueue />
<f:render section="main"/>
</div>
</div>
(2-2/2)