More workspace stuff for beta.
authorKasper Skårhøj <kasper@typo3.org>
Mon, 7 Nov 2005 17:16:49 +0000 (17:16 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Mon, 7 Nov 2005 17:16:49 +0000 (17:16 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@842 709f56b5-9817-0410-a4d7-c38de5d9e867

17 files changed:
TODO.txt
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_browsetree.php
t3lib/class.t3lib_install.php
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tcemain.php
typo3/class.db_list.inc
typo3/class.db_list_extra.inc
typo3/mod/user/ws/class.wslib.php
typo3/mod/user/ws/index.php
typo3/mod/user/ws/wsol_preview.php [new file with mode: 0755]
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/impexp/class.tx_impexp.php
typo3/sysext/version/cm1/index.php
typo3/sysext/viewpage/view/index.php
typo3/tce_db.php

index e8cc024..9dc77c0 100755 (executable)
--- a/TODO.txt
+++ b/TODO.txt
@@ -303,33 +303,24 @@ SQLengine (t3lib_sqlengine):
 *******************************
 Versioning/Workspaces:
 *******************************
-- Running the TemplaVoila wizard in workspace?
-
-
-- Dual-view preview? + publishing, raise state? + diff-view inline?
-- Web > Versioning:
-       - Raising state for all records on a page and using same comment for all + send only one notification email per instance.
-       - "Publish / Swap all" - link
-- Show workspace in icon-title-text
-
-
-- Documentation:
-       - Finish screenshots for "Inside TYPO3"
-               - Web > View module always showing preview?
-       - TYPO3 Core API:
-               - As frontend preview implementation is dealt with, describe any persisting incompatibilities in "TYPO3 Core API"
-                       - Difficult frontend previews (except for new records which can shadow values)
-                               - All fields selected upon in frontend:
-                                       - $TCA[$table]['ctrl']['languageField'] and $TCA[$table]['ctrl']['transOrigPointerField']
-                                       - field: pages_language_overlay:sys_language_uid
-                                       - field: pages:doktype (used for selection many places!) - but then we cannot make mounts points etc! (?)
-                               - Suggested solution:
-                                       - Setting a workspace-readonly flag for such values!
-                                       - However,
-                                               - menu previews are bypassing the problem already,
-                                               - page shortcut has trouble but is known,
-                                               - mount points will not be possible to preview (?)
-                                               - For new translations we might have the problem, for existing translations probably not since it is unlikely that the fields $TCA[$table]['ctrl']['languageField'] and $TCA[$table]['ctrl']['transOrigPointerField'] are changed later!
+
+- TemplaVoila and workspaces:
+       - Test TemplaVoila with building site
+       - Mapping of IDs / soft-references?
+
+- CVS:
+- Notice:
+       Jason: Compare with his mail.
+       Benoit, Ingo, Dev-list:
+               - Document for download
+               - Tar ball + CVS
+               - TODO for remaining problems
+               (Invoice for ingo)
+               - TemplaVoila  is updated to support as well.
+       Dimitri: Info about how to proceed.
+
+*************
+- Preparation for next week.
 
 ----------------------------------
 Frontend Preview:
@@ -347,7 +338,6 @@ Backend preview:
 - Permissions reflected in buttons and clickmenus.
 - Logging:
        - Finally define logging in tcemain!
-       - Filter on workspace
 
 TCEmain commands:
 - copy:
@@ -368,21 +358,23 @@ Versioning API:
 - (Support for) swapping using temporary file (instead of using negative ID)
 - Way to change versioning type from element to page to branch for new records?
 
-Preview modes with no BE login; For single pages, for whole workspace?
-- Can bypass hidden pages, fe_groups, set workspace
-- Works for certain timespan
-- Sets cookie
-- Respects permissions of backend users issuing that permission!?
-- Dual-view preview?
-
 Check Various:
 - Auto publishing: Might not work with "Publish only "Publish" stage" because swapped elements will be in editing stage or so!
 
 Workspace Manager TODO:
-- Workspace list
+- Workspace admin list
+
+Preview:
+- Dualview:
+       - Implement links in notification email + only one notification per. "instance" of TCEmain
+       - Allow preview by non-be-logins through some token-facility (links from tcemain-mails)
+               - Works for certain timespan
+               - Sets cookie? (for workspace browsing)
 
 BUGS:
-- In draft workspace: importing a treestructure when "newPagesVersioningType" is set to "1" (new pages as "branch" versions) will only create root point and no subsequent records.
+- Import/Export module:
+       - In draft workspace: importing a treestructure when "newPagesVersioningType" is set to "1" (new pages as "branch" versions) will only create root point and no subsequent records.
+       - Correct references for softreferences on import.
 
 
 -----LATER:
index e2472aa..f2bad95 100755 (executable)
@@ -1618,6 +1618,9 @@ class t3lib_BEfunc        {
                $parts[] = 'id='.$row['uid'];
                if ($row['alias'])      $parts[]=$LANG->sL($TCA['pages']['columns']['alias']['label']).' '.$row['alias'];
                if ($row['pid']<0)      $parts[] = 'v#1.'.$row['t3ver_id'];
+               if ($row['t3ver_state']==1)     $parts[] = 'PLH WSID#'.$row['t3ver_wsid'];
+               if ($row['t3ver_state']==-1)    $parts[] = 'New element!';
+
                if ($row['doktype']=='3')       {
                        $parts[]=$LANG->sL($TCA['pages']['columns']['url']['label']).' '.$row['url'];
                } elseif ($row['doktype']=='4') {
@@ -1684,6 +1687,11 @@ class t3lib_BEfunc       {
                        if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $row['pid']<0)   {
                                $out.=' - v#1.'.$row['t3ver_id'];
                        }
+                       if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'])    {
+                               if ($row['t3ver_state']==1)     $out.= ' - PLH WSID#'.$row['t3ver_wsid'];
+                               if ($row['t3ver_state']==-1)    $out.= ' - New element!';
+                       }
+
                        if ($ctrl['disabled'])  {               // Hidden ...
                                $out.=($row[$ctrl['disabled']]?' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.hidden'):'');
                        }
@@ -1972,6 +1980,7 @@ class t3lib_BEfunc        {
                if ($TCA[$table]['ctrl']['versioningWS'])       {
                        $fields[] = $prefix.'t3ver_id';
                        $fields[] = $prefix.'t3ver_state';
+                       $fields[] = $prefix.'t3ver_wsid';
                }
 
                if ($TCA[$table]['ctrl']['selicon_field'])      $fields[] = $prefix.$TCA[$table]['ctrl']['selicon_field'];
@@ -2208,14 +2217,19 @@ class t3lib_BEfunc      {
                if ($altUrl)    {
                        $url = $altUrl;
                } else {
-                       if ($rootLine)  {
-                               $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
-                               if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']))    {
-                                       $preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine);
+
+                       if ($GLOBALS['BE_USER']->workspace!=0 && t3lib_extMgm::isLoaded('viewpage'))    {
+                               $url = t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir.'mod/user/ws/wsol_preview.php?id='.$id.$addGetVars.$anchor;
+                       } else {
+                               if ($rootLine)  {
+                                       $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
+                                       if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']))    {
+                                               $preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine);
+                                       }
                                }
+                               $preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..';
+                               $url = $preUrl.'/index.php?id='.$id.$addGetVars.$anchor;
                        }
-                       $preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..';
-                       $url = $preUrl.'/index.php?id='.$id.$addGetVars.$anchor;
                }
 
                return "previewWin=window.open('".$url."','newTypo3FrontendWindow','status=1,menubar=1,resizable=1,location=1,scrollbars=1,toolbar=1');".
@@ -3216,7 +3230,20 @@ class t3lib_BEfunc       {
                return $output;
        }
 
-
+       /**
+        * Performs mapping of new uids to new versions UID in case of import inside a workspace.
+        *
+        * @param       string          Table name
+        * @param       integer         Record uid (of live record placeholder)
+        * @return      integer         Uid of offline version if any, otherwise live uid.
+        */
+       function wsMapId($table,$uid)   {
+               if ($wsRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace,$table,$uid,'uid'))       {
+                       return $wsRec['uid'];
+               } else {
+                       return $uid;
+               }
+       }
 
 
 
index 431b709..9798af2 100755 (executable)
@@ -91,7 +91,7 @@ class t3lib_browseTree extends t3lib_treeView {
                $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
                $this->MOUNTS = $GLOBALS['WEBMOUNTS'];
 
-               $this->fieldArray = array_merge($this->fieldArray,array('doktype','php_tree_stop','t3ver_id','t3ver_state','t3ver_swapmode'));
+               $this->fieldArray = array_merge($this->fieldArray,array('doktype','php_tree_stop','t3ver_id','t3ver_state','t3ver_wsid','t3ver_swapmode'));
                if (t3lib_extMgm::isLoaded('cms'))      {
                        $this->fieldArray = array_merge($this->fieldArray,array('hidden','starttime','endtime','fe_group','module','extendToSubpages'));
                }
index a877cc1..8f8f9db 100755 (executable)
@@ -625,7 +625,7 @@ class t3lib_install {
        function getCreateTables($statements, $insertCountFlag=0)       {
                $crTables = array();
                foreach($statements as $line => $linecontent)   {
-                       if (eregi('^create[[:space:]]*table[[:space:]]*([[:alnum:]_]*)',substr($linecontent,0,100),$reg))       {
+                       if (eregi('^create[[:space:]]*table[[:space:]]*[`]?([[:alnum:]_]*)[`]?',substr($linecontent,0,100),$reg))       {
                                $table = trim($reg[1]);
                                if ($table)     {
                                        if (TYPO3_OS=='WIN')    { $table=strtolower($table); }  // table names are always lowercase on Windows!
@@ -638,11 +638,12 @@ class t3lib_install {
                                        $linecontent = implode(chr(10), $sqlLines);
                                        $crTables[$table] = $linecontent;
                                }
-                       } elseif ($insertCountFlag && eregi('^insert[[:space:]]*into[[:space:]]*([[:alnum:]_]*)',substr($linecontent,0,100),$reg))      {
+                       } elseif ($insertCountFlag && eregi('^insert[[:space:]]*into[[:space:]]*[`]?([[:alnum:]_]*)[`]?',substr($linecontent,0,100),$reg))      {
                                $nTable = trim($reg[1]);
                                $insertCount[$nTable]++;
                        }
                }
+
                return array($crTables,$insertCount);
        }
 
@@ -656,7 +657,7 @@ class t3lib_install {
        function getTableInsertStatements($statements, $table)  {
                $outStatements=array();
                foreach($statements as $line => $linecontent)   {
-                       if (eregi('^insert[[:space:]]*into[[:space:]]*([[:alnum:]_]*)',substr($linecontent,0,100),$reg))        {
+                       if (eregi('^insert[[:space:]]*into[[:space:]]*[`]?([[:alnum:]_]*)[`]?',substr($linecontent,0,100),$reg))        {
                                $nTable = trim($reg[1]);
                                if ($nTable && !strcmp($table,$nTable)) {
                                        $outStatements[]=$linecontent;
index 1894b00..39af8a8 100755 (executable)
@@ -3686,6 +3686,7 @@ class t3lib_TCEforms      {
 
                        // Traverse the selected rows to add them:
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
+                       t3lib_BEfunc::workspaceOL($f_table, $row);
                                // Prepare the icon if available:
                        if ($iField && $iPath && $row[$iField]) {
                                $iParts = t3lib_div::trimExplode(',',$row[$iField],1);
index 5182963..33990e2 100755 (executable)
@@ -243,6 +243,7 @@ class t3lib_TCEmain {
        var $bypassWorkspaceRestrictions = FALSE;       // Boolean: If true, workspace restrictions are bypassed on edit an create actions (process_datamap()). YOU MUST KNOW what you do if you use this feature!
 
        var $copyWhichTables = '*';                             // String. Comma-list. This list of tables decides which tables will be copied. If empty then none will. If '*' then all will (that the user has permission to of course)
+       var $generalComment = '';                               // General comment, eg. for staging in workspaces.
 
        var $copyTree = 0;                                              // Integer. If 0 then branch is NOT copied. If 1 then pages on the 1st level is copied. If 2 then pages on the second level is copied ... and so on
 
@@ -753,6 +754,7 @@ class t3lib_TCEmain {
                                                                                        $fieldArray['pid'] = -1;
                                                                                        $fieldArray['t3ver_oid'] = $this->substNEWwithIDs[$id];
                                                                                        $fieldArray['t3ver_id'] = 1;
+                                                                                       $fieldArray['t3ver_state'] = -1;        // Setting placeholder state value for version (so it can know it is currently a new version...)
                                                                                        $fieldArray['t3ver_label'] = 'First draft version';
                                                                                        $fieldArray['t3ver_wsid'] = $this->BE_USER->workspace;
                                                                                        if ($table==='pages') {         // Swap mode set to "branch" so we can build branches for pages.
@@ -2118,7 +2120,10 @@ class t3lib_TCEmain      {
                                                                                $this->version_clearWSID($table,$id);
                                                                        break;
                                                                        case 'setStage':
-                                                                               $this->version_setStage($table,$id,$value['stageId'],$value['comment']);
+                                                                               $idList = t3lib_div::trimExplode(',',$id,1);
+                                                                               foreach($idList as $id) {
+                                                                                       $this->version_setStage($table,$id,$value['stageId'],$value['comment']?$value['comment']:$this->generalComment);
+                                                                               }
                                                                        break;
                                                                }
                                                        break;
@@ -3368,7 +3373,7 @@ class t3lib_TCEmain       {
                                                                                $sArray['t3ver_oid'] = intval($id);
                                                                                $sArray['t3ver_wsid'] = $swapIntoWS ? intval($curVersion['t3ver_wsid']) : 0;
                                                                                $sArray['t3ver_tstamp'] = time();
-                                                                               $sArray['t3ver_stage'] = 0;
+                                                                               $sArray['t3ver_stage'] = $sArray['t3ver_state'] = 0;
                                                                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table,'uid='.intval($swapWith),$sArray);
                                                                                if ($GLOBALS['TYPO3_DB']->sql_error())  $sqlErrors[]=$GLOBALS['TYPO3_DB']->sql_error();
 
@@ -3380,7 +3385,7 @@ class t3lib_TCEmain       {
                                                                                $sArray['t3ver_wsid'] = $swapIntoWS ? intval($swapVersion['t3ver_wsid']) : 0;
                                                                                $sArray['t3ver_tstamp'] = time();
                                                                                $sArray['t3ver_count'] = $curVersion['t3ver_count']+1;  // Increment lifecycle counter
-                                                                               $sArray['t3ver_stage'] = 0;
+                                                                               $sArray['t3ver_stage'] = $sArray['t3ver_state'] = 0;
 
                                                                                if ($table==='pages') {         // Keeping the swapmode state
                                                                                        $sArray['t3ver_swapmode'] = $swapVersion['t3ver_swapmode'];
@@ -3491,8 +3496,8 @@ class t3lib_TCEmain       {
                                $sArray['t3ver_stage'] = $stageId;
                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($id), $sArray);
                                $this->newlog('Stage for record was changed to '.$stageId.'. Comment was: "'.substr($comment,0,100).'"');
-// TEMPORARY:
-$this->log($table,$id,6,0,0,'Stage raised...',-1,array('comment'=>$comment,'stage'=>$stageId));
+// TEMPORARY, except 6-30 as action/detail number which is observed elsewhere!
+$this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stage'=>$stageId));
 
                                if ((int)$stat['stagechg_notification']>0)      {
                                        $this->notifyStageChange($stat,$stageId,$table,$id,$comment);
index 1442e75..7b9a3d3 100755 (executable)
@@ -682,6 +682,7 @@ class recordList extends t3lib_recordList {
                                if ($TCA[$table]['ctrl']['versioningWS'])       {
                                        $fieldListArr[]='t3ver_id';
                                        $fieldListArr[]='t3ver_state';
+                                       $fieldListArr[]='t3ver_wsid';
                                        if ($table==='pages')   {
                                                $fieldListArr[]='t3ver_swapmode';
                                        }
index 28e44bf..5487a82 100755 (executable)
@@ -362,6 +362,7 @@ class localRecordList extends recordList {
                if ($TCA[$table]['ctrl']['versioningWS'])       {
                        $selectFields[] = 't3ver_id';
                        $selectFields[] = 't3ver_state';
+                       $selectFields[] = 't3ver_wsid';
                        $selectFields[] = 't3ver_swapmode';             // Filtered out when pages in makeFieldList()
                }
                if ($l10nEnabled)       {
index 0b70a80..75ec266 100755 (executable)
@@ -77,7 +77,7 @@ class wslib {
         * @param       boolean         If set, then the currently online versions are swapped into the workspace in exchange for the offline versions. Otherwise the workspace is emptied.
         * @return      array           Command array for tcemain
         */
-       function getCmdArrayForPublishWS($wsid, $doSwap)        {
+       function getCmdArrayForPublishWS($wsid, $doSwap,$pageId=0)      {
 
                $wsid = intval($wsid);
                $cmd = array();
@@ -94,7 +94,7 @@ class wslib {
                        }
 
                                // Select all versions to swap:
-                       $versions = $this->selectVersionsInWorkspace($wsid,0,$stage);
+                       $versions = $this->selectVersionsInWorkspace($wsid,0,$stage,($pageId?$pageId:-1));
 
                                // Traverse the selection to build CMD array:
                        foreach($versions as $table => $records)        {
index 49cd2dc..8be9725 100755 (executable)
@@ -126,6 +126,7 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
        var $pageModule = '';
        var $publishAccess = FALSE;
        var $be_user_Array = array();
+       var $stageIndex = array();
 
 
        /*********************************
@@ -153,10 +154,10 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                                0 => 'All',
                        ),
                        'display' => array(
-                               0 => '[ONLINE]',
-                               -98 => 'Workspaces',
+                               0 => '[Live workspace]',
+                               -98 => 'Draft Workspaces',
                                -99 => 'All',
-                               -1 => '[Offline]'
+                               -1 => '[Default Draft]'
                        ),
                        'diff' => array(
                                0 => 'No diff.',
@@ -461,8 +462,8 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                $tableRows[] = '
                        <tr class="bgColor5 tableheader">
                                <td nowrap="nowrap" width="100">Pagetree:</td>
-                               <td nowrap="nowrap" colspan="2">Online Version:</td>
-                               <td nowrap="nowrap" colspan="2">Offline Versions:</td>
+                               <td nowrap="nowrap" colspan="2">Live Version:</td>
+                               <td nowrap="nowrap" colspan="2">Draft Versions:</td>
                                <td nowrap="nowrap">Stage:</td>
                                <td nowrap="nowrap">Publish:</td>
                                <td>Lifecycle:</td>
@@ -474,7 +475,6 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
 
                $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">'.implode('',$tableRows).'</table>';
 
-
                return $table.$this->markupNewOriginals();
        }
 
@@ -762,8 +762,11 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                                        '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/up.gif','width="14" height="14"').' alt="" align="top" title="'.htmlspecialchars($titleAttrib).'" />'.
                                        '</a>';
+
+                               $this->stageIndex[$sId][$table][] = $rec_off['uid'];
                        }
                }
+
                return $actionLinks;
        }
 
@@ -1345,7 +1348,7 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                if (!isset($this->formatWorkspace_cache[$wsid]))        {
                        switch($wsid)   {
                                case -1:
-                                       $this->formatWorkspace_cache[$wsid] = '[Offline]';
+                                       $this->formatWorkspace_cache[$wsid] = '[Draft]';
                                break;
                                case 0:
                                        $this->formatWorkspace_cache[$wsid] = '';       // Does not output anything for ONLINE because it might confuse people to think that the elemnet IS online which is not the case - only that it exists as an offline version in the online workspace...
@@ -1427,7 +1430,7 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                        'log_data,tstamp,userid',
                        'sys_log',
-                       'action=6
+                       'action=6 and details_nr=30
                                AND tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_log').'
                                AND recuid='.intval($id)
                );
diff --git a/typo3/mod/user/ws/wsol_preview.php b/typo3/mod/user/ws/wsol_preview.php
new file mode 100755 (executable)
index 0000000..c3a37c1
--- /dev/null
@@ -0,0 +1,214 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2004-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  All rights reserved
+*
+*  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.
+*
+*  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!
+***************************************************************/
+/**
+ * Workspace preview module
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   62: class wsol_preview
+ *   71:     function main()
+ *  109:     function generateUrls()
+ *  125:     function printFrameset()
+ *  167:     function isBeLogin()
+ *
+ * TOTAL FUNCTIONS: 4
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+define('TYPO3_PROCEED_IF_NO_USER', '1');
+
+unset($MCONF);
+require('conf.php');
+require($BACK_PATH.'init.php');
+require_once('class.wslib.php');
+
+
+
+/**
+ * Workspace dual preview
+ * NOTICE: In this module you HAVE to check if a backend user is actually logged in if you perform operations that require a login! See function ->isBeLogin()
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @package TYPO3
+ * @subpackage core
+ */
+class wsol_preview {
+
+       var $workspace = 0;             // Which workspace to preview!
+
+       /**
+        * Main function
+        *
+        * @return      void
+        */
+       function main() {
+
+               if ($this->isBeLogin()) {
+                       $this->workspace = $GLOBALS['BE_USER']->workspace;
+               }
+
+               if ($header = t3lib_div::_GP('header')) {
+                       if ($header!=='live')   {
+                               $headerText = 'Workspace Version ('.$this->workspace.'):';
+                               $color = 'green';
+                       } else {
+                               $headerText = 'Live Version:';
+                               $color = 'red';
+                       }
+
+                       $output =  '
+                               <html>
+                                       <head>
+                                               <title>Header</title>
+                                       </head>
+                                       <body bgcolor="'.$color.'">
+                                               <font face="verdana,arial" size="2" color="white"><b>'.$headerText.'</b></font>
+                                       </body>
+                               </html>';
+               } elseif ($msg = t3lib_div::_GP('msg')) {
+                       switch($msg)    {
+                               case 'branchpoint':
+                                       $message = '<b>No live page available!</b><br/><br/>
+                                       The previewed page was inside a "Branch" type version and has no traceable counterpart in the live workspace.';
+                               break;
+                               case 'newpage':
+                                       $message = '<b>New page!</b><br/><br/>
+                                       The previewed page is created in the workspace and has no counterpart in the live workspace.';
+                               break;
+                               default:
+                                       $message = 'Unknown message code "'.$msg.'"';
+                               break;
+                       }
+
+                       $output =  '
+                               <html>
+                                       <head>
+                                               <title>Message</title>
+                                       </head>
+                                       <body bgcolor="#eeeeee">
+                                               <div width="100%" height="100%" style="text-align: center; align: center;"><br/><br/><br/><br/><font face="verdana,arial" size="2" color="#666666">'.$message.'</font></div>
+                                       </body>
+                               </html>';
+
+               } else {
+                       $this->generateUrls();
+                       $output = $this->printFrameset();
+               }
+
+               echo $output;
+       }
+
+       /**
+        * URLs generated
+        *
+        * @return      void
+        */
+       function generateUrls() {
+                       // Live URL:
+               $pageId = intval(t3lib_div::_GP('id'));
+
+               $this->URL = array(
+                       'liveHeader' => 'wsol_preview.php?header=live',
+                       'draftHeader' => 'wsol_preview.php?header=draft',
+                       'live' => t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$pageId.'&ADMCMD_noBeUser=1',
+                       'draft' => t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$pageId.'&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS='.$this->workspace,
+                       'versionMod' => '../../../sysext/version/cm1/index.php?id='.intval(t3lib_div::_GP('id')).'&diffOnly=1'
+               );
+
+               if ($this->isBeLogin()) {
+                               // Branchpoint; display error message then:
+                       if (t3lib_BEfunc::isPidInVersionizedBranch($pageId)=='branchpoint')     {
+                               $this->URL['live'] = 'wsol_preview.php?msg=branchpoint';
+                       }
+
+                       $rec = t3lib_BEfunc::getRecord('pages',$pageId,'t3ver_state');
+                       if ((int)$rec['t3ver_state']===1)       {
+                               $this->URL['live'] = 'wsol_preview.php?msg=newpage';
+                       }
+               }
+       }
+
+       /**
+        * Outputting frameset
+        *
+        * @return      void
+        */
+       function printFrameset()        {
+               if ($this->isBeLogin()) {
+                       return '
+                       <html>
+                               <head>
+                                       <title>Preview and compare workspace version with live version</title>
+                               </head>
+                               <frameset cols="60%,40%" framespacing="3" frameborder="3" border="3">
+                                       <frameset rows="20,*,20,*" framespacing="3" frameborder="3" border="3">
+                                               <frame name="frame_liveh" src="'.htmlspecialchars($this->URL['liveHeader']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                               <frame name="frame_live" src="'.htmlspecialchars($this->URL['live']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                               <frame name="frame_drafth" src="'.htmlspecialchars($this->URL['draftHeader']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                               <frame name="frame_draft" src="'.htmlspecialchars($this->URL['draft']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                       </frameset>
+                                       <frame name="be" src="'.htmlspecialchars($this->URL['versionMod']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                               </frameset>
+                       </html>';
+               } else {
+                       return '
+                       <html>
+                               <head>
+                                       <title>Preview and compare workspace version with live version</title>
+                               </head>
+                               <frameset cols="*,*" framespacing="3" frameborder="3" border="3">
+                                       <frameset rows="20,*" framespacing="3" frameborder="3" border="3">
+                                               <frame name="frame_liveh" src="'.htmlspecialchars($this->URL['liveHeader']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                               <frame name="frame_live" src="'.htmlspecialchars($this->URL['live']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                       </frameset>
+                                       <frameset rows="20,*" framespacing="3" frameborder="3" border="3">
+                                               <frame name="frame_drafth" src="'.htmlspecialchars($this->URL['draftHeader']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                               <frame name="frame_draft" src="'.htmlspecialchars($this->URL['draft']).'" marginwidth="0" marginheight="0" frameborder="1" scrolling="auto">
+                                       </frameset>
+                               </frameset>
+                       </html>';
+               }
+       }
+
+       /**
+        * Checks if a backend user is logged in. Due to the line "define('TYPO3_PROCEED_IF_NO_USER', '1');" the backend is initialized even if no backend user was authenticated. This is in order to allow previews through this module of yet not-logged in users.
+        *
+        * @return      boolean         True, if there is a logged in backend user.
+        */
+       function isBeLogin()    {
+               return is_array($GLOBALS['BE_USER']->user);
+       }
+}
+
+
+
+$previewObject = t3lib_div::makeInstance('wsol_preview');
+$previewObject->main();
+?>
\ No newline at end of file
index 401fff7..ca3068d 100755 (executable)
  *
  *
  *
- *  204: class tslib_fe
- *  371:     function tslib_fe($TYPO3_CONF_VARS, $id, $type, $no_cache='', $cHash='', $jumpurl='',$MP='',$RDCT='')
- *  404:     function connectToMySQL()
- *  414:     function connectToDB()
- *  459:     function sendRedirect()
+ *  207: class tslib_fe
+ *  375:     function tslib_fe($TYPO3_CONF_VARS, $id, $type, $no_cache='', $cHash='', $jumpurl='',$MP='',$RDCT='')
+ *  408:     function connectToMySQL()
+ *  418:     function connectToDB()
+ *  463:     function sendRedirect()
  *
  *              SECTION: Initializing, resolving page id
- *  497:     function initFEuser()
- *  547:     function initUserGroups()
- *  582:     function isUserOrGroupSet()
- *  607:     function checkAlternativeIdMethods()
- *  659:     function clear_preview()
- *  672:     function determineId()
- *  806:     function fetch_the_id()
- *  899:     function getPageAndRootline()
- *  970:     function getPageShortcut($SC,$mode,$thisUid,$itera=20,$pageLog=array())
- * 1020:     function checkRootlineForIncludeSection()
- * 1057:     function checkEnableFields($row,$bypassGroupCheck=FALSE)
- * 1073:     function checkPageGroupAccess($row, $groupList=NULL)
- * 1092:     function checkPagerecordForIncludeSection($row)
- * 1101:     function checkIfLoginAllowedInBranch()
- * 1126:     function getPageAccessFailureReasons()
- * 1158:     function setIDfromArgV()
- * 1174:     function getPageAndRootlineWithDomain($domainStartPage)
- * 1201:     function setSysPageWhereClause()
- * 1213:     function findDomainRecord($recursive=0)
- * 1233:     function pageNotFoundAndExit($reason='', $header='')
- * 1248:     function pageNotFoundHandler($code, $header='', $reason='')
- * 1292:     function checkAndSetAlias()
- * 1307:     function idPartsAnalyze($str)
- * 1332:     function mergingWithGetVars($GET_VARS)
+ *  501:     function initFEuser()
+ *  551:     function initUserGroups()
+ *  586:     function isUserOrGroupSet()
+ *  611:     function checkAlternativeIdMethods()
+ *  663:     function clear_preview()
+ *  676:     function determineId()
+ *  811:     function fetch_the_id()
+ *  904:     function getPageAndRootline()
+ *  975:     function getPageShortcut($SC,$mode,$thisUid,$itera=20,$pageLog=array())
+ * 1025:     function checkRootlineForIncludeSection()
+ * 1062:     function checkEnableFields($row,$bypassGroupCheck=FALSE)
+ * 1078:     function checkPageGroupAccess($row, $groupList=NULL)
+ * 1097:     function checkPagerecordForIncludeSection($row)
+ * 1106:     function checkIfLoginAllowedInBranch()
+ * 1131:     function getPageAccessFailureReasons()
+ * 1163:     function setIDfromArgV()
+ * 1179:     function getPageAndRootlineWithDomain($domainStartPage)
+ * 1206:     function setSysPageWhereClause()
+ * 1218:     function findDomainRecord($recursive=0)
+ * 1238:     function pageNotFoundAndExit($reason='', $header='')
+ * 1253:     function pageNotFoundHandler($code, $header='', $reason='')
+ * 1297:     function checkAndSetAlias()
+ * 1312:     function idPartsAnalyze($str)
+ * 1337:     function mergingWithGetVars($GET_VARS)
  *
  *              SECTION: Template and caching related functions.
- * 1381:     function makeCacheHash()
- * 1405:     function reqCHash()
- * 1427:     function cHashParams($addQueryParams)
- * 1436:     function initTemplate()
- * 1448:     function getFromCache()
- * 1493:     function getFromCache_queryRow()
- * 1521:     function headerNoCache()
- * 1550:     function getHash()
- * 1570:     function getConfigArray()
+ * 1386:     function makeCacheHash()
+ * 1410:     function reqCHash()
+ * 1432:     function cHashParams($addQueryParams)
+ * 1441:     function initTemplate()
+ * 1453:     function getFromCache()
+ * 1498:     function getFromCache_queryRow()
+ * 1526:     function headerNoCache()
+ * 1555:     function getHash()
+ * 1575:     function getConfigArray()
  *
  *              SECTION: Further initialization and data processing
- * 1709:     function getCompressedTCarray()
- * 1763:     function includeTCA($TCAloaded=1)
- * 1790:     function settingLanguage()
- * 1880:     function settingLocale()
- * 1905:     function checkDataSubmission()
- * 1930:     function fe_tce()
- * 1944:     function locDataCheck($locationData)
- * 1960:     function sendFormmail()
- * 2011:     function extractRecipientCopy($bodytext)
- * 2026:     function checkJumpUrl()
- * 2108:     function jumpUrl()
- * 2152:     function setUrlIdToken()
+ * 1714:     function getCompressedTCarray()
+ * 1768:     function includeTCA($TCAloaded=1)
+ * 1795:     function settingLanguage()
+ * 1885:     function settingLocale()
+ * 1910:     function checkDataSubmission()
+ * 1935:     function fe_tce()
+ * 1949:     function locDataCheck($locationData)
+ * 1965:     function sendFormmail()
+ * 2016:     function extractRecipientCopy($bodytext)
+ * 2031:     function checkJumpUrl()
+ * 2113:     function jumpUrl()
+ * 2157:     function setUrlIdToken()
  *
  *              SECTION: Page generation; cache handling
- * 2195:     function isGeneratePage()
- * 2205:     function tempPageCacheContent()
- * 2246:     function realPageCacheContent()
- * 2275:     function setPageCacheContent($c,$d,$t)
- * 2299:     function clearPageCacheContent()
- * 2309:     function clearPageCacheContent_pidList($pidList)
- * 2320:     function setSysLastChanged()
+ * 2200:     function isGeneratePage()
+ * 2210:     function tempPageCacheContent()
+ * 2251:     function realPageCacheContent()
+ * 2280:     function setPageCacheContent($c,$d,$t)
+ * 2304:     function clearPageCacheContent()
+ * 2314:     function clearPageCacheContent_pidList($pidList)
+ * 2325:     function setSysLastChanged()
  *
  *              SECTION: Page generation; rendering and inclusion
- * 2356:     function generatePage_preProcessing()
- * 2378:     function generatePage_whichScript()
- * 2390:     function generatePage_postProcessing()
- * 2482:     function INTincScript()
- * 2542:     function INTincScript_loadJSCode()
- * 2583:     function isINTincScript()
- * 2592:     function doXHTML_cleaning()
- * 2601:     function doLocalAnchorFix()
+ * 2361:     function generatePage_preProcessing()
+ * 2383:     function generatePage_whichScript()
+ * 2395:     function generatePage_postProcessing()
+ * 2487:     function INTincScript()
+ * 2547:     function INTincScript_loadJSCode()
+ * 2588:     function isINTincScript()
+ * 2597:     function doXHTML_cleaning()
+ * 2606:     function doLocalAnchorFix()
  *
  *              SECTION: Finished off; outputting, storing session data, statistics...
- * 2632:     function isOutputting()
- * 2655:     function processOutput()
+ * 2637:     function isOutputting()
+ * 2660:     function processOutput()
  * 2728:     function sendCacheHeaders()
- * 2795:     function isStaticCacheble()
- * 2808:     function contentStrReplace()
- * 2834:     function isEXTincScript()
- * 2843:     function storeSessionData()
- * 2853:     function setParseTime()
- * 2865:     function statistics()
- * 2973:     function previewInfo()
- * 3001:     function hook_eofe()
- * 3017:     function beLoginLinkIPList()
+ * 2796:     function isStaticCacheble()
+ * 2809:     function contentStrReplace()
+ * 2835:     function isEXTincScript()
+ * 2844:     function storeSessionData()
+ * 2854:     function setParseTime()
+ * 2866:     function statistics()
+ * 2974:     function previewInfo()
+ * 3002:     function hook_eofe()
+ * 3018:     function beLoginLinkIPList()
  *
  *              SECTION: Various internal API functions
- * 3072:     function makeSimulFileName($inTitle,$page,$type,$addParams='',$no_cache='')
- * 3119:     function simulateStaticDocuments_pEnc_onlyP_proc($linkVars)
- * 3148:     function getSimulFileName()
- * 3162:     function fileNameASCIIPrefix($inTitle,$titleChars,$mergeChar='.')
- * 3180:     function encryptEmail($string,$back=0)
- * 3206:     function codeString($string, $decode=FALSE)
- * 3232:     function roundTripCryptString($string)
- * 3252:     function checkFileInclude($incFile)
- * 3267:     function newCObj()
- * 3280:     function setAbsRefPrefix()
- * 3294:     function baseUrlWrap($url)
- * 3313:     function printError($label,$header='Error!')
- * 3324:     function updateMD5paramsRecord($hash)
- * 3335:     function tidyHTML($content)
- * 3361:     function prefixLocalAnchorsWithScript()
+ * 3073:     function makeSimulFileName($inTitle,$page,$type,$addParams='',$no_cache='')
+ * 3120:     function simulateStaticDocuments_pEnc_onlyP_proc($linkVars)
+ * 3149:     function getSimulFileName()
+ * 3163:     function fileNameASCIIPrefix($inTitle,$titleChars,$mergeChar='.')
+ * 3181:     function encryptEmail($string,$back=0)
+ * 3207:     function codeString($string, $decode=FALSE)
+ * 3233:     function roundTripCryptString($string)
+ * 3253:     function checkFileInclude($incFile)
+ * 3268:     function newCObj()
+ * 3281:     function setAbsRefPrefix()
+ * 3295:     function baseUrlWrap($url)
+ * 3314:     function printError($label,$header='Error!')
+ * 3325:     function updateMD5paramsRecord($hash)
+ * 3336:     function tidyHTML($content)
+ * 3362:     function prefixLocalAnchorsWithScript()
+ * 3373:     function workspacePreviewInit()
+ * 3382:     function doWorkspacePreview()
+ * 3392:     function whichWorkspace($returnTitle = FALSE)
  *
  *              SECTION: Various external API functions - for use in plugins etc.
- * 3405:     function getStorageSiterootPids()
- * 3420:     function getPagesTSconfig()
- * 3453:     function setJS($key,$content='')
- * 3491:     function setCSS($key,$content)
- * 3506:     function make_seed()
- * 3519:     function uniqueHash($str='')
- * 3528:     function set_no_cache()
- * 3538:     function set_cache_timeout_default($seconds)
- * 3554:     function plainMailEncoded($email,$subject,$message,$headers='')
+ * 3450:     function getStorageSiterootPids()
+ * 3465:     function getPagesTSconfig()
+ * 3498:     function setJS($key,$content='')
+ * 3536:     function setCSS($key,$content)
+ * 3551:     function make_seed()
+ * 3564:     function uniqueHash($str='')
+ * 3573:     function set_no_cache()
+ * 3583:     function set_cache_timeout_default($seconds)
+ * 3599:     function plainMailEncoded($email,$subject,$message,$headers='')
  *
  *              SECTION: Localization and character set conversion
- * 3595:     function sL($input)
- * 3624:     function readLLfile($fileRef)
- * 3635:     function getLLL($index,$LOCAL_LANG)
- * 3649:     function initLLvars()
- * 3683:     function csConv($str,$from='')
- * 3701:     function convOutputCharset($content,$label='')
- * 3714:     function convPOSTCharset()
+ * 3640:     function sL($input)
+ * 3669:     function readLLfile($fileRef)
+ * 3680:     function getLLL($index,$LOCAL_LANG)
+ * 3694:     function initLLvars()
+ * 3728:     function csConv($str,$from='')
+ * 3746:     function convOutputCharset($content,$label='')
+ * 3759:     function convPOSTCharset()
  *
- * TOTAL FUNCTIONS: 107
+ * TOTAL FUNCTIONS: 110
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
        var $loginUser='';                                      // Global flag indicating that a front-end user is logged in. This is set only if a user really IS logged in. The group-list may show other groups (like added by IP filter or so) even though there is no user.
        var $gr_list='';                                        // (RO=readonly) The group list, sorted numerically. Group '0,-1' is the default group, but other groups may be added by other means than a user being logged in though...
        var $beUserLogin='';                            // Flag that indicates if a Backend user is logged in!
+       var $workspacePreview='';                       // Integer, that indicates which workspace is being previewed.
        var $loginAllowedInBranch = TRUE;       // Shows whether logins are allowed in branch
 
                // PREVIEW
 
                        // If there is a Backend login we are going to check for any preview settings:
                $GLOBALS['TT']->push('beUserLogin','');
-               if ($this->beUserLogin) {
-                       $this->fePreview = $GLOBALS['BE_USER']->extGetFeAdminValue('preview') ? 1 : 0;
-
-                               // If admin panel preview is enabled...
-                       if ($this->fePreview)   {
-                               $fe_user_OLD_USERGROUP = $this->fe_user->user['usergroup'];
-
-                               $this->showHiddenPage = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','showHiddenPages');
-                               $this->showHiddenRecords = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','showHiddenRecords');
-                                       // simulate date
-                               $simTime = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateDate');
-                               if ($simTime)   $GLOBALS['SIM_EXEC_TIME']=$simTime;
-                                       // simulate user
-                               $simUserGroup = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateUserGroup');
-                               $this->simUserGroup = $simUserGroup;
-                               if ($simUserGroup)      $this->fe_user->user['usergroup']=$simUserGroup;
-                               if (!$simUserGroup && !$simTime && !$this->showHiddenPage && !$this->showHiddenRecords) {
-                                       $this->fePreview=0;
+               if ($this->beUserLogin || $this->doWorkspacePreview())  {
+
+                               // Backend user preview features:
+                       if ($this->beUserLogin) {
+                               $this->fePreview = $GLOBALS['BE_USER']->extGetFeAdminValue('preview') ? 1 : 0;
+
+                                       // If admin panel preview is enabled...
+                               if ($this->fePreview)   {
+                                       $fe_user_OLD_USERGROUP = $this->fe_user->user['usergroup'];
+
+                                       $this->showHiddenPage = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','showHiddenPages');
+                                       $this->showHiddenRecords = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','showHiddenRecords');
+                                               // simulate date
+                                       $simTime = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateDate');
+                                       if ($simTime)   $GLOBALS['SIM_EXEC_TIME']=$simTime;
+                                               // simulate user
+                                       $simUserGroup = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateUserGroup');
+                                       $this->simUserGroup = $simUserGroup;
+                                       if ($simUserGroup)      $this->fe_user->user['usergroup']=$simUserGroup;
+                                       if (!$simUserGroup && !$simTime && !$this->showHiddenPage && !$this->showHiddenRecords) {
+                                               $this->fePreview=0;
+                                       }
                                }
                        }
 
                                        // Now it's investigated if the raw page-id points to a hidden page and if so, the flag is set.
                                        // This does not require the preview flag to be set in the admin panel
                                $idQ = t3lib_div::testInt($this->id) ? 'uid='.intval($this->id) : 'alias='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->id, 'pages').' AND pid>=0';        // pid>=0 added for the sake of versioning...
-                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('hidden', 'pages', $idQ.' AND hidden!=0 AND deleted=0');  // versionOL()? - decided to leave it be for now...
+                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('hidden', 'pages', $idQ.' AND hidden!=0 AND deleted=0');
                                if ($GLOBALS['TYPO3_DB']->sql_num_rows($res))   {
                                        $this->fePreview = 1;   // The preview flag is set only if the current page turns out to actually be hidden!
                                        $this->showHiddenPage = 1;
                                }
 
                                        // For Live workspace: Check root line for proper connection to tree root (done because of possible preview of page / branch versions)
-                               if (!$this->fePreview && $GLOBALS['BE_USER']->workspace==0)     {
+                               if (!$this->fePreview && $this->whichWorkspace()===0)   {
 
                                                // Initialize the page-select functions to check rootline:
                                        $temp_sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
                        }
 
                                // The preview flag will be set if a backend user is in an offline workspace
-                       if (($GLOBALS['BE_USER']->user['workspace_preview'] || t3lib_div::_GP('ADMCMD_view')) && ($GLOBALS['BE_USER']->workspace==-1 || $GLOBALS['BE_USER']->workspace>0))      {
+                       if (($GLOBALS['BE_USER']->user['workspace_preview'] || t3lib_div::_GP('ADMCMD_view') || $this->doWorkspacePreview()) && ($this->whichWorkspace()===-1 || $this->whichWorkspace()>0))    {
                                $this->fePreview = 2;   // Will show special preview message.
                        }
 
                        // Initialize the page-select functions.
                $this->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
                $this->sys_page->versioningPreview = $this->fePreview ? TRUE : FALSE;
-               $this->sys_page->versioningWorkspaceId = $GLOBALS['BE_USER']->workspace;
+               $this->sys_page->versioningWorkspaceId = $this->whichWorkspace();
                $this->sys_page->init($this->showHiddenPage);
 
                        // Set the valid usergroups for FE
@@ -2703,13 +2711,8 @@ if (version == "n3") {
                        }
                }
 
-/*             if ($this->beUserLogin && t3lib_div::_GP('ADMCMD_view'))        {               // This is a try to change target=_top to target=_self if pages are shown in the Web>View module...
-                       $this->content = str_replace('target="_top"','target="_self"',$this->content);
-                       $this->content = str_replace('target=_top','target="_self"',$this->content);
-               }*/
-
                        // Send content-lenght header. Notice that all HTML content outside the length of the content-length header will be cut off! Therefore content of unknown length from included PHP-scripts and if admin users are logged in (admin panel might show...) we disable it!
-               if ($this->config['config']['enableContentLengthHeader'] && !$this->isEXTincScript() && !$this->beUserLogin)    {
+               if ($this->config['config']['enableContentLengthHeader'] && !$this->isEXTincScript() && !$this->beUserLogin && !$this->doWorkspacePreview())    {
                        header('Content-Length: '.strlen($this->content));
                }
        }
@@ -2732,6 +2735,7 @@ if (version == "n3") {
                        // Finally, when backend users are logged in, do not send cache headers at all (Admin Panel might be displayed for instance).
                if ($doCache
                                && !$this->beUserLogin
+                               && !$this->doWorkspacePreview()
                                && $loginsDeniedCfg)    {
 
                                // Build headers:
@@ -2970,7 +2974,7 @@ if (version == "n3") {
                if ($this->fePreview)   {
 
                                if ($this->fePreview==2)        {
-                                       $text = $GLOBALS['BE_USER']->workspaceRec['title'] ? 'Preview of workspace "'.$GLOBALS['BE_USER']->workspaceRec['title'].'" ('.$GLOBALS['BE_USER']->workspace.')' : 'Offline Workspace (-1)';
+                                       $text = 'Preview of workspace "'.$this->whichWorkspace(TRUE).'" ('.$this->whichWorkspace().')';
                                } else {
                                        $text = 'PREVIEW!';
                                }
@@ -3359,7 +3363,53 @@ if (version == "n3") {
                $this->content = eregi_replace('(<(a|area)[[:space:]]+href=")(#[^"]*")','\1'.htmlspecialchars($scriptPath).'\3',$this->content);
        }
 
+       /**
+        * Initialize workspace preview
+        * STILL VERY TEMPORARY - MUST INCLUDE SECURITY of some sort.
+        *
+        * @return      void
+        */
+       function workspacePreviewInit() {
+               if ($this->beUserLogin && is_object($GLOBALS['BE_USER']) && t3lib_div::testInt(t3lib_div::_GP('ADMCMD_previewWS')))     {
+                       $this->workspacePreview = intval(t3lib_div::_GP('ADMCMD_previewWS'));
+               }
+       }
+
+       /**
+        * Returns true if workspace preview is enabled
+        *
+        * @return      boolean         Returns true if workspace preview is enabled
+        */
+       function doWorkspacePreview()   {
+               return (string)$this->workspacePreview!=='';
+       }
+
+       /**
+        * Returns the name of the workspace
+        *
+        * @param       boolean         If set, returns title of current workspace being previewed
+        * @return      mixed           If $returnTitle is set, returns string (title), otherwise workspace integer for which workspace is being preview. False if none.
+        */
+       function whichWorkspace($returnTitle = FALSE)   {
+               if ($this->doWorkspacePreview())        {
+                       $ws = intval($this->workspacePreview);
+               } elseif ($this->beUserLogin) {
+                       $ws = $GLOBALS['BE_USER']->workspace;
+               } else return FALSE;
 
+               if ($returnTitle)       {
+                       if ($ws===-1)   {
+                               return 'Default Draft Workspace';
+                       } else {
+                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title', 'sys_workspace', 'uid='.intval($ws));
+                               if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                                       return $row['title'];
+                               }
+                       }
+               } else {
+                       return $ws;
+               }
+       }
 
 
 
index b15b93d..0274bdd 100755 (executable)
@@ -172,6 +172,7 @@ if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/index_ts.php']['preBeUser']))
        }
 }
 
+
 // *********
 // BE_USER
 // *********
@@ -249,6 +250,12 @@ if ($_COOKIE['be_typo_user']) {            // If the backend cookie is set, we proceed and
 }
 
 
+// ********************
+// Workspace preview:
+// ********************
+$TSFE->workspacePreviewInit();
+
+
 // *****************************************
 // Proces the ID, type and other parameters
 // After this point we have an array, $page in TSFE, which is the page-record of the current page, $id
@@ -259,7 +266,7 @@ $TT->push('Process ID','');
        $TSFE->determineId();
 
                // Now, if there is a backend user logged in and he has NO access to this page, then re-evaluate the id shown!
-       if ($TSFE->beUserLogin && !$BE_USER->extPageReadAccess($TSFE->page))    {
+       if ($TSFE->beUserLogin && (!$BE_USER->extPageReadAccess($TSFE->page) || t3lib_div::_GP('ADMCMD_noBeUser')))     {       // t3lib_div::_GP('ADMCMD_noBeUser') is placed here because workspacePreviewInit() might need to know if a backend user is logged in!
 
                        // Remove user
                unset($BE_USER);
index d6c1d12..abcceea 100755 (executable)
@@ -1777,7 +1777,7 @@ class tx_impexp {
 
                                // If the record has been written and received a new id, then proceed:
                        if (is_array($this->import_mapId[$table]) && isset($this->import_mapId[$table][$uid]))  {
-                               $thisNewUid = $this->wsMapId($table,$this->import_mapId[$table][$uid]);
+                               $thisNewUid = t3lib_BEfunc::wsMapId($table,$this->import_mapId[$table][$uid]);
 
                                if (is_array($this->dat['records'][$table.':'.$uid]['rels']))   {
                                        reset($this->dat['records'][$table.':'.$uid]['rels']);
@@ -1882,7 +1882,7 @@ class tx_impexp {
 
                                // If the record has been written and received a new id, then proceed:
                        if (is_array($this->import_mapId[$table]) && isset($this->import_mapId[$table][$uid]))  {
-                               $thisNewUid = $this->wsMapId($table,$this->import_mapId[$table][$uid]);
+                               $thisNewUid = t3lib_BEfunc::wsMapId($table,$this->import_mapId[$table][$uid]);
 
                                if (is_array($this->dat['records'][$table.':'.$uid]['rels']))   {
                                        reset($this->dat['records'][$table.':'.$uid]['rels']);
@@ -2021,7 +2021,7 @@ class tx_impexp {
                                                }
 
                                                        // The new id:
-                                               $thisNewUid = $this->wsMapId($table,$this->import_mapId[$table][$uid]);
+                                               $thisNewUid = t3lib_BEfunc::wsMapId($table,$this->import_mapId[$table][$uid]);
 
                                                        // Now, if there are any fields that require substitution to be done, lets go for that:
                                                foreach($fieldsIndex as $field => $softRefCfgs) {
@@ -2153,7 +2153,7 @@ class tx_impexp {
                                                                        // Trying to map database element if found in the mapID array:
                                                                list($tempTable,$tempUid) = explode(':',$cfg['subst']['recordRef']);
                                                                if (isset($this->import_mapId[$tempTable][$tempUid]))   {
-                                                                       $insertValue = $this->wsMapId($tempTable,$this->import_mapId[$tempTable][$tempUid]);
+                                                                       $insertValue = t3lib_BEfunc::wsMapId($tempTable,$this->import_mapId[$tempTable][$tempUid]);
 
                                                                                // Look if reference is to a page and the original token value was NOT an integer - then we assume is was an alias and try to look up the new one!
                                                                        if ($tempTable==='pages' && !t3lib_div::testInt($cfg['subst']['tokenValue']))   {
@@ -3524,20 +3524,6 @@ class tx_impexp {
                return $this->fileProcObj;
        }
 
-       /**
-        * Performs mapping of new uids to new versions UID in case of import inside a workspace.
-        *
-        * @param       string          Table name
-        * @param       integer         Record uid (of live record placeholder)
-        * @return      integer         Uid of offline version if any, otherwise live uid.
-        */
-       function wsMapId($table,$uid)   {
-               if ($wsRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace,$table,$uid,'uid'))       {
-                       return $wsRec['uid'];
-               } else {
-                       return $uid;
-               }
-       }
 
 
 
index af66369..ea793f4 100755 (executable)
@@ -84,6 +84,7 @@ require_once (PATH_t3lib.'class.t3lib_scbase.php');
 require_once(PATH_t3lib.'class.t3lib_diff.php');
 require_once(PATH_typo3.'mod/user/ws/class.wslib.php');
 require_once(PATH_t3lib.'class.t3lib_pagetree.php');
+require_once(PATH_t3lib.'class.t3lib_tcemain.php');
 
 
 
@@ -112,6 +113,7 @@ class tx_version_cm1 extends t3lib_SCbase {
        var $pageModule = '';                   // Name of page module
        var $publishAccess = FALSE;
        var $be_user_Array = array();
+       var $stageIndex = array();
 
 
 
@@ -139,10 +141,10 @@ class tx_version_cm1 extends t3lib_SCbase {
                                0 => 'All',
                        ),
                        'display' => array(
-                               0 => '[ONLINE]',
-                               -98 => 'Workspaces',
+                               0 => '[Live workspace]',
+                               -98 => 'Draft Workspaces',
                                -99 => 'All',
-                               -1 => '[Offline]'
+                               -1 => '[Default Draft]'
                        ),
                        'diff' => ''
                );
@@ -193,6 +195,7 @@ class tx_version_cm1 extends t3lib_SCbase {
                        $this->table = 'pages';
                }
                $this->details = t3lib_div::_GP('details');             // Page id. If set, indicates activation from Web>Versioning module
+               $this->diffOnly = t3lib_div::_GP('diffOnly');           // Flag. If set, shows only the offline version and with diff-view
 
                        // Force this setting:
                $this->MOD_SETTINGS['expandSubElements'] = TRUE;
@@ -402,7 +405,7 @@ class tx_version_cm1 extends t3lib_SCbase {
                                                        '<a href="'.$this->doc->issueCommand('&cmd['.$this->table.']['.$this->uid.'][version][action]=swap&cmd['.$this->table.']['.$this->uid.'][version][swapWith]='.$row['uid'].'&cmd['.$this->table.']['.$this->uid.'][version][swapContent]=ALL').'">'.
                                                '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/insert4.gif','width="14" height="14"').' alt="" title="Publish page AND content! - AND ALL SUBPAGES!" />'.
                                                '</a>' : '') */ : '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/blinkarrow_left.gif','width="5" height="9"').' alt="" title="CURRENT ONLINE VERSION!"/>').'</td>
-                                       <td>'.$adminLinks.'</td>
+                                       <td nowrap="nowrap">'.$adminLinks.'</td>
                                        <td nowrap="nowrap">'.t3lib_BEfunc::getRecordTitle($this->table,$row,1).'</td>
                                        <td>'.$row['uid'].'</td>
                                        <td>'.$row['t3ver_oid'].'</td>
@@ -618,7 +621,7 @@ class tx_version_cm1 extends t3lib_SCbase {
                        $menu.= t3lib_BEfunc::getFuncMenu($this->id,'SET[filter]',$this->MOD_SETTINGS['filter'],$this->MOD_MENU['filter']);
                        $menu.= t3lib_BEfunc::getFuncMenu($this->id,'SET[display]',$this->MOD_SETTINGS['display'],$this->MOD_MENU['display']);
                }
-               if (!$this->details && $GLOBALS['BE_USER']->workspace)  {
+               if (!$this->details && $GLOBALS['BE_USER']->workspace && !$this->diffOnly)      {
                        $menu.= t3lib_BEfunc::getFuncCheck($this->id,'SET[diff]',$this->MOD_SETTINGS['diff']).' Show difference view';
                }
 
@@ -626,8 +629,35 @@ class tx_version_cm1 extends t3lib_SCbase {
                        $this->content.=$this->doc->section('',$menu,0,1);
                }
 
-               $this->content.=$this->doc->spacer(15);
-               $this->content.=$this->doc->section($this->details ? 'Details for version' : 'Workspace management', $this->displayWorkspaceOverview(),0,1);
+                       // Perform workspace publishing action if buttons are pressed:
+               $errors = $this->publishAction();
+
+                       // Generate workspace overview:
+               $WSoverview = $this->displayWorkspaceOverview();
+
+                       // Buttons for publish / swap:
+               $actionLinks = '';
+               if ($GLOBALS['BE_USER']->workspace!==0) {
+                       if ($this->publishAccess)       {
+                               $actionLinks.= '<input type="submit" name="_publish" value="Publish page" onclick="return confirm(\'Are you sure you want to publish all content '.($GLOBALS['BE_USER']->workspaceRec['publish_access']&1 ? 'in &quot;Publish&quot; stage ':'').'from this page?\');"/>';
+                               if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
+                                       $actionLinks.= '<input type="submit" name="_swap" value="Swap page" onclick="return confirm(\'Are you sure you want to publish (swap) all content '.($GLOBALS['BE_USER']->workspaceRec['publish_access']&1 ? 'in &quot;Publish&quot; stage ':'').'from this page?\');" />';
+                               }
+                       } else {
+                               $actionLinks.= $this->doc->icons(1).'You are not permitted to publish from this workspace';
+                       }
+               }
+               $actionLinks.= '<input type="submit" name="_" value="Refresh" />';
+               $actionLinks.= $this->displayWorkspaceOverview_allStageCmd();
+
+               if ($actionLinks || count($errors))     {
+                       $this->content.= $this->doc->section('',$actionLinks.(count($errors) ? '<h3>Errors:</h3><br/>'.implode('<br/>',$errors).'<hr/>' : ''),0,1);
+               }
+
+                       // Output overview content:
+               $this->content.= $this->doc->spacer(15);
+               $this->content.= $this->doc->section($this->details ? 'Details for version' : 'Workspace management', $WSoverview,0,1);
+
        }
 
        /**
@@ -680,9 +710,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                if (count($pArray))     {
                        $tableRows[] = '
                                <tr class="bgColor5 tableheader">
-                                       <td nowrap="nowrap" colspan="2">Online Version:</td>
-                                       <td nowrap="nowrap" colspan="2">Offline Versions:</td>
-                                       <td nowrap="nowrap" colspan="4">Controls:</td>
+                                       '.($this->diffOnly?'':'<td nowrap="nowrap" colspan="2">Live Version:</td>').'
+                                       <td nowrap="nowrap" colspan="2">Draft Versions:</td>
+                                       <td nowrap="nowrap"'.($this->diffOnly?' colspan="2"':' colspan="4"').'>Controls:</td>
                                </tr>';
 
                                // Add lines from overview:
@@ -692,10 +722,11 @@ class tx_version_cm1 extends t3lib_SCbase {
                } else $table = '';
 
                $linkBack = t3lib_div::_GP('returnUrl') ? '<a href="'.htmlspecialchars(t3lib_div::_GP('returnUrl')).'" class="typo3-goBack"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />Click here to go back</a><br/><br/>' : '';
+               $resetDiffOnly = $this->diffOnly ? '<a href="index.php?id='.intval($this->id).'" class="typo3-goBack">Show all information</a><br/><br/>' : '';
 
                $versionSelector = $GLOBALS['BE_USER']->workspace ? $this->doc->getVersionSelector($this->id) : '';
 
-               return $versionSelector.$linkBack.$table.$this->markupNewOriginals();
+               return $versionSelector.$linkBack.$resetDiffOnly.$table.$this->markupNewOriginals();
        }
 
        /**
@@ -747,7 +778,7 @@ class tx_version_cm1 extends t3lib_SCbase {
                                                $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $rec_off['uid'], 1, '', '+edit,view,info,delete');
 
                                                        // Prepare diff-code:
-                                               if ($this->MOD_SETTINGS['diff'])        {
+                                               if ($this->MOD_SETTINGS['diff'] || $this->diffOnly)     {
                                                        if ($rec_on['t3ver_state']!=1)  {       // Not new record:
                                                                list($diffHTML,$diffPct) = $this->createDiffView($table, $rec_off, $rec_on);
                                                                $diffCode = ($diffPct<0 ? 'N/A' : ($diffPct ? $diffPct.'% change:' : '')).
@@ -812,9 +843,9 @@ class tx_version_cm1 extends t3lib_SCbase {
                                                                        $this->displayWorkspaceOverview_commandLinks($table,$rec_on,$rec_off,$vType).
                                                                        htmlspecialchars($swapLabel).
                                                                        '&nbsp;&nbsp;</td>
-                                                               <td nowrap="nowrap"><b>Lifecycle:</b> '.htmlspecialchars($this->formatCount($rec_off['t3ver_count'])).'</td>'.          // Lifecycle
+                                                               '.(!$this->diffOnly?'<td nowrap="nowrap"><b>Lifecycle:</b> '.htmlspecialchars($this->formatCount($rec_off['t3ver_count'])).'</td>'.             // Lifecycle
                                                                        ($this->showWorkspaceCol ? '
-                                                               <td nowrap="nowrap">&nbsp;&nbsp;<b>Workspace:</b> '.htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])).'</td>' : '');
+                                                               <td nowrap="nowrap">&nbsp;&nbsp;<b>Workspace:</b> '.htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])).'</td>' : ''):'');
 
                                                if ($diffCode)  {
                                                        $verElement = $verElement.'
@@ -834,12 +865,16 @@ class tx_version_cm1 extends t3lib_SCbase {
                                                                        $verElement.
                                                                        $subElements['off'].
                                                                        '</td>
-                                                               '.$ctrlTable;
+                                                               ';
 
                                                        // Compile table row:
                                                $tableRows[] = '
                                                        <tr class="bgColor4">
-                                                               '.$mainCell.$verCell.'
+                                                               '.
+                                                               ($this->diffOnly?'':$mainCell).
+                                                               $verCell.
+                                                               $ctrlTable.
+                                                               '
                                                        </tr>';
 
                                                        // Reset the main cell:
@@ -868,9 +903,45 @@ class tx_version_cm1 extends t3lib_SCbase {
                }
        }
 
+       /**
+        * Links to stage change of a version
+        *
+        * @param       string          Table name
+        * @param       array           Offline record (version)
+        * @return      string          HTML content, mainly link tags and images.
+        */
+       function displayWorkspaceOverview_allStageCmd() {
+
+               if (count($this->stageIndex[1]))        {       // Review:
+                       $sId = 1;
+                       $color = '#666666';
+                       $label = 'Comment for Reviewer:';
+                       $titleAttrib = 'Send all to Review';
+               } elseif(count($this->stageIndex[10]))  {       // Publish:
+                       $sId = 10;
+                       $color = '#6666cc';
+                       $label = 'Comment for Publisher:';
+                       $titleAttrib = 'Approve all for Publishing';
+               } else {
+                       $sId = 0;
+               }
 
+               if ($sId>0)     {
+                       $issueCmd = '';
+                       foreach($this->stageIndex[$sId] as $table => $uidArray) {
+                               $issueCmd.='&cmd['.$table.']['.implode(',',$uidArray).'][version][action]=setStage';
+                               $issueCmd.='&cmd['.$table.']['.implode(',',$uidArray).'][version][stageId]='.$sId;
+                       }
 
+                       $onClick = 'var commentTxt=window.prompt("'.$label.'","");
+                                                       if (commentTxt!=null) {document.location="'.$this->doc->issueCommand($issueCmd).'&generalComment="+escape(commentTxt);}'.
+                                                       ' return false;';
+                       $actionLinks.=
+                               '<input type="submit" name="_" value="'.htmlspecialchars($titleAttrib).'" onclick="'.htmlspecialchars($onClick).'" />';
+               } else $actionLinks = '';
 
+               return $actionLinks;
+       }
 
 
 
@@ -987,7 +1058,7 @@ class tx_version_cm1 extends t3lib_SCbase {
                $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                        'log_data,tstamp,userid',
                        'sys_log',
-                       'action=6
+                       'action=6 and details_nr=30
                                AND tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_log').'
                                AND recuid='.intval($id)
                );
@@ -1444,6 +1515,8 @@ class tx_version_cm1 extends t3lib_SCbase {
                                        '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/up.gif','width="14" height="14"').' alt="" align="top" title="'.htmlspecialchars($titleAttrib).'" />'.
                                        '</a>';
+
+                               $this->stageIndex[$sId][$table][] = $rec_off['uid'];
                        }
                }
                return $actionLinks;
@@ -1564,6 +1637,46 @@ class tx_version_cm1 extends t3lib_SCbase {
 
                return $actionLinks;
        }
+
+
+
+
+
+
+
+
+
+       /**********************************
+        *
+        * Processing
+        *
+        **********************************/
+
+       /**
+        * Will publish workspace if buttons are pressed
+        *
+        * @return      void
+        */
+       function publishAction()        {
+
+                       // If "Publish" or "Swap" buttons are pressed:
+               if (t3lib_div::_POST('_publish') || t3lib_div::_POST('_swap'))  {
+
+                       if ($this->table==='pages')     {       // Making sure ->uid is a page ID!
+                                       // Initialize workspace object and request all pending versions:
+                               $wslibObj = t3lib_div::makeInstance('wslib');
+                               $cmd = $wslibObj->getCmdArrayForPublishWS($GLOBALS['BE_USER']->workspace, t3lib_div::_POST('_swap'),$this->uid);
+
+                                       // Execute the commands:
+                               $tce = t3lib_div::makeInstance('t3lib_TCEmain');
+                               $tce->stripslashes_values = 0;
+                               $tce->start(array(), $cmd);
+                               $tce->process_cmdmap();
+
+                               return $tce->errorLog;
+                       }
+               }
+       }
 }
 
 
index 982e706..e66b8f6 100755 (executable)
  */
 
 unset($MCONF);
-require ("conf.php");
-require ($BACK_PATH."init.php");
-//require ($BACK_PATH."template.php");
-require_once (PATH_t3lib."class.t3lib_page.php");
+require ('conf.php');
+require ($BACK_PATH.'init.php');
+//require ($BACK_PATH.'template.php');
+require_once (PATH_t3lib.'class.t3lib_page.php');
 $BE_USER->modAccess($MCONF,1);
 
 
@@ -73,60 +73,65 @@ class SC_mod_web_view_index {
        var $pageinfo;
        var $url;
        var $id;
+       var $wsInstruction='';
 
        /**
-        * @return      [type]          ...
+        * Initialization of module
+        *
+        * @return      void
         */
        function init() {
-               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
-               $this->MCONF = $GLOBALS["MCONF"];
-               $this->id = intval(t3lib_div::_GP("id"));
+               global $BE_USER;
+
+               $this->MCONF = $GLOBALS['MCONF'];
+               $this->id = intval(t3lib_div::_GP('id'));
 
                $this->perms_clause = $BE_USER->getPagePermsClause(1);
 
                        // page/be_user TSconfig settings and blinding of menu-items
-               $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,"mod.".$this->MCONF["name"]);
-               $this->type = intval($this->modTSconfig["properties"]["type"]);
+               $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
+               $this->type = intval($this->modTSconfig['properties']['type']);
        }
 
        /**
-        * [Describe function...]
+        * Main function
         *
-        * @return      [type]          ...
+        * @return      void
         */
        function main() {
                global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
-               // Access check...
-               // The page will show only if there is a valid page and if this page may be viewed by the user
+
+                       // Access check...
+                       // The page will show only if there is a valid page and if this page may be viewed by the user
                $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
                $access = is_array($this->pageinfo) ? 1 : 0;
-               $addCmd="";
+               $addCmd='';
                if ($this->id && $access)       {
-                       $addCmd = "&ADMCMD_view=1&ADMCMD_editIcons=1".t3lib_BEfunc::ADMCMD_previewCmds($this->pageinfo);
+                       $addCmd = '&ADMCMD_view=1&ADMCMD_editIcons=1'.t3lib_BEfunc::ADMCMD_previewCmds($this->pageinfo);
                }
 
-               $parts = parse_url(t3lib_div::getIndpEnv("TYPO3_SITE_URL"));
-               $dName = t3lib_BEfunc::getDomainStartPage($parts["host"],$parts["path"]) ?
+               $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
+               $dName = t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']) ?
                                                t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($this->id)):
-                                               "";
+                                               '';
 
-               $this->url.= ($dName?(t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$dName:$BACK_PATH."..")."/index.php?id=".$this->id.($this->type?"&type=".$this->type:"").$addCmd;
+               $this->url.= ($dName?(t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$dName:$BACK_PATH.'..').'/index.php?id='.$this->id.($this->type?'&type='.$this->type:'').$addCmd;
                //debug($this->url);
        }
 
        /**
-        * [Describe function...]
+        * Redirect URL
         *
-        * @return      [type]          ...
+        * @return      void
         */
        function printContent() {
-               Header("Location: ".t3lib_div::locationHeaderUrl($this->url));
+               Header('Location: '.t3lib_div::locationHeaderUrl($this->url));
        }
 }
 
 // Include extension?
-if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/viewpage/view/index.php"])    {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/viewpage/view/index.php"]);
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/viewpage/view/index.php'])    {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/viewpage/view/index.php']);
 }
 
 
@@ -141,7 +146,7 @@ if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/viewpag
 
 
 // Make instance:
-$SOBE = t3lib_div::makeInstance("SC_mod_web_view_index");
+$SOBE = t3lib_div::makeInstance('SC_mod_web_view_index');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
index 1ca0f44..dbef7a6 100644 (file)
@@ -89,6 +89,7 @@ class SC_tce_db {
        var $CB;                        // Clipboard command array. May trigger changes in "cmd"
        var $vC;                        // Verification code
        var $uPT;                       // Boolean. Update Page Tree Trigger. If set and the manipulated records are pages then the update page tree signal will be set.
+       var $generalComment;    // String, general comment (for raising stages of workspace versions)
 
                // Internal, dynamic:
        var $include_once=array();              // Files to include after init() function is called:
@@ -117,10 +118,12 @@ class SC_tce_db {
                $this->CB = t3lib_div::_GP('CB');
                $this->vC = t3lib_div::_GP('vC');
                $this->uPT = t3lib_div::_GP('uPT');
+               $this->generalComment = t3lib_div::_GP('generalComment');
 
                        // Creating TCEmain object
                $this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
                $this->tce->stripslashes_values=0;
+               $this->tce->generalComment = $this->generalComment;
 
                        // Configuring based on user prefs.
                if ($BE_USER->uc['recursiveDelete'])    {