Index: typo3/alt_doc.php
===================================================================
--- typo3/alt_doc.php (revision 39964)
+++ typo3/alt_doc.php (working copy)
@@ -155,6 +155,7 @@
var $errorC; // Counter, used to count the number of errors (when users do not have edit permissions)
var $newC; // Counter, used to count the number of new record forms displayed
var $viewId; // Is set to the pid value of the last shown record - thus indicating which page to show when clicking the SAVE/VIEW button
+ var $previewId; // An alternate id for the SAVE/VIEW button, when previewing pages in workspaces
var $viewId_addParams; // Is set to additional parameters (like "&L=xxx") if the record supports it.
var $modTSconfig; // Module TSconfig, loaded from main() based on the page id value of viewId
@@ -650,6 +651,7 @@
$deniedAccessReason = '';
$deleteAccess = 0;
$this->viewId = 0;
+ $this->previewId = 0;
// If the command is to create a NEW record...:
if ($cmd=='new') {
@@ -686,6 +688,9 @@
$hasAccess = $CALC_PERMS&2 ? 1 : 0;
$deleteAccess = $CALC_PERMS&4 ? 1 : 0;
$this->viewId = $calcPRec['uid'];
+ // If the page is a version of an existing page, store the original page's uid
+ // (see compileForm() for usage)
+ $this->previewId = $calcPRec['t3ver_oid'];
} else {
$CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid'])); // Fetching pid-record first.
$hasAccess = $CALC_PERMS&16 ? 1 : 0;
@@ -960,7 +965,8 @@
if ($this->returnNewPageId) {
$formContent .= '';
}
- $formContent .= '';
+ $viewId = (empty($this->previewId)) ? $this->viewId : $this->previewId;
+ $formContent .= '';
if ($this->viewId_addParams) {
$formContent .= '';
}