Fixed bug #15155: Move file list from mod to sysext
authorSteffen Kamper <info@sk-typo3.de>
Sun, 18 Jul 2010 19:42:28 +0000 (19:42 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sun, 18 Jul 2010 19:42:28 +0000 (19:42 +0000)
Fixed bug #15154: Move Extension manager from mod to sysext
Fixed bug #15153: Move mod/user/ws to sysext version
Fixed bug #15152: Move Web>List from mod to sysext
Fixed bug #15151: Move Web>Access from mod to sysext
Fixed bug #15150: Move Web>Func from mod to sysext
Fixed bug #15149: Move Web>Info from mod to sysext

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8210 709f56b5-9817-0410-a4d7-c38de5d9e867

26 files changed:
typo3/mod/user/ws/.htaccess [deleted file]
typo3/mod/user/ws/class.wslib.php [deleted file]
typo3/mod/user/ws/class.wslib_gui.php [deleted file]
typo3/mod/user/ws/clear.gif [deleted file]
typo3/mod/user/ws/cli/conf.php [deleted file]
typo3/mod/user/ws/conf.php [deleted file]
typo3/mod/user/ws/index.php [deleted file]
typo3/mod/user/ws/progress.gif [deleted file]
typo3/mod/user/ws/publish.php [deleted file]
typo3/mod/user/ws/sys_workspace.gif [deleted file]
typo3/mod/user/ws/sys_workspace.png [deleted file]
typo3/mod/user/ws/workspaceforms.php [deleted file]
typo3/mod/user/ws/wsol_preview.php [deleted file]
typo3/sysext/version/ws/.htaccess [new file with mode: 0644]
typo3/sysext/version/ws/class.wslib.php [new file with mode: 0755]
typo3/sysext/version/ws/class.wslib_gui.php [new file with mode: 0644]
typo3/sysext/version/ws/clear.gif [new file with mode: 0755]
typo3/sysext/version/ws/cli/conf.php [new file with mode: 0755]
typo3/sysext/version/ws/conf.php [new file with mode: 0755]
typo3/sysext/version/ws/index.php [new file with mode: 0755]
typo3/sysext/version/ws/progress.gif [new file with mode: 0644]
typo3/sysext/version/ws/publish.php [new file with mode: 0644]
typo3/sysext/version/ws/sys_workspace.gif [new file with mode: 0644]
typo3/sysext/version/ws/sys_workspace.png [new file with mode: 0755]
typo3/sysext/version/ws/workspaceforms.php [new file with mode: 0644]
typo3/sysext/version/ws/wsol_preview.php [new file with mode: 0755]

diff --git a/typo3/mod/user/ws/.htaccess b/typo3/mod/user/ws/.htaccess
deleted file mode 100644 (file)
index bc54bf1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<FilesMatch "\.(gif|png)$">
-       <IfModule mod_expires.c>
-               ExpiresActive on
-               ExpiresDefault "access plus 7 days"
-       </IfModule>
-       FileETag MTime Size
-</FilesMatch>
diff --git a/typo3/mod/user/ws/class.wslib.php b/typo3/mod/user/ws/class.wslib.php
deleted file mode 100755 (executable)
index dea0c67..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2005-2010 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.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Library with Workspace related functionality
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   68: class wslib
- *   81:     function getCmdArrayForPublishWS($wsid, $doSwap,$pageId=0)
- *  127:     function selectVersionsInWorkspace($wsid,$filter=0,$stage=-99,$pageId=-1)
- *
- *              SECTION: CLI functions
- *  183:     function CLI_main()
- *  193:     function autoPublishWorkspaces()
- *
- * TOTAL FUNCTIONS: 4
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-
-
-
-
-
-
-
-
-
-
-/**
- * Library with Workspace related functionality
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage core
- */
-class wslib {
-
-
-
-
-       /**
-        * Building tcemain CMD-array for swapping all versions in a workspace.
-        *
-        * @param       integer         Real workspace ID, cannot be ONLINE (zero).
-        * @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.
-        * @param       [type]          $pageId: ...
-        * @return      array           Command array for tcemain
-        */
-       function getCmdArrayForPublishWS($wsid, $doSwap,$pageId=0)      {
-
-               $wsid = intval($wsid);
-               $cmd = array();
-
-               if ($wsid>=-1 && $wsid!==0)     {
-
-                               // Define stage to select:
-                       $stage = -99;
-                       if ($wsid>0)    {
-                               $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace',$wsid);
-                               if ($workspaceRec['publish_access']&1)  {
-                                       $stage = 10;
-                               }
-                       }
-
-                               // Select all versions to swap:
-                       $versions = $this->selectVersionsInWorkspace($wsid,0,$stage,($pageId?$pageId:-1));
-
-                               // Traverse the selection to build CMD array:
-                       foreach($versions as $table => $records)        {
-                               foreach($records as $rec)       {
-
-                                               // Build the cmd Array:
-                                       $cmd[$table][$rec['t3ver_oid']]['version'] = array(
-                                               'action' => 'swap',
-                                               'swapWith' => $rec['uid'],
-                                               'swapIntoWS' => $doSwap ? 1 : 0
-                                       );
-                               }
-                       }
-               }
-               return $cmd;
-       }
-
-       /**
-        * Select all records from workspace pending for publishing
-        * Used from backend to display workspace overview
-        * User for auto-publishing for selecting versions for publication
-        *
-        * @param       integer         Workspace ID. If -99, will select ALL versions from ANY workspace. If -98 will select all but ONLINE. >=-1 will select from the actual workspace
-        * @param       integer         Lifecycle filter: 1 = select all drafts (never-published), 2 = select all published one or more times (archive/multiple), anything else selects all.
-        * @param       integer         Stage filter: -99 means no filtering, otherwise it will be used to select only elements with that stage. For publishing, that would be "10"
-        * @param       integer         Page id: Live page for which to find versions in workspace!
-        * @return      array           Array of 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 REAL pid of the online record is found as "realpid"
-        */
-       function selectVersionsInWorkspace($wsid,$filter=0,$stage=-99,$pageId=-1)       {
-               global $TCA;
-
-               $wsid = intval($wsid);
-               $filter = intval($filter);
-               $output = array();
-
-                       // Traversing all tables supporting versioning:
-               foreach($TCA as $table => $cfg) {
-                       if ($TCA[$table]['ctrl']['versioningWS'])       {
-
-                                       // Select all records from this table in the database from the workspace
-                                       // This joins the online version with the offline version as tables A and B
-                               $recs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows (
-                                       'A.uid, A.t3ver_oid,'.($table==='pages' ? ' A.t3ver_swapmode,':'').' B.pid AS realpid',
-                                       $table.' A,'.$table.' B',
-                                       'A.pid=-1'.     // Table A is the offline version and pid=-1 defines offline
-                                               ($pageId!=-1 ? ($table==='pages' ? ' AND B.uid='.intval($pageId) : ' AND B.pid='.intval($pageId)) : '').
-                                               ($wsid>-98 ? ' AND A.t3ver_wsid='.$wsid : ($wsid===-98 ? ' AND A.t3ver_wsid!=0' : '')). // For "real" workspace numbers, select by that. If = -98, select all that are NOT online (zero). Anything else below -1 will not select on the wsid and therefore select all!
-                                               ($filter===1 ? ' AND A.t3ver_count=0' : ($filter===2 ? ' AND A.t3ver_count>0' : '')).   // lifecycle filter: 1 = select all drafts (never-published), 2 = select all published one or more times (archive/multiple)
-                                               ($stage!=-99 ? ' AND A.t3ver_stage='.intval($stage) : '').
-                                               ' AND B.pid>=0'.        // Table B (online) must have PID >= 0 to signify being online.
-                                               ' AND A.t3ver_oid=B.uid'.       // ... and finally the join between the two tables.
-                                               t3lib_BEfunc::deleteClause($table,'A').
-                                               t3lib_BEfunc::deleteClause($table,'B'),
-                                       '',
-                                       'B.uid'         // Order by UID, mostly to have a sorting in the backend overview module which doesn't "jump around" when swapping.
-                               );
-                               if (count($recs)) {
-                                       $output[$table] = $recs;
-                               }
-                       }
-               }
-
-               return $output;
-       }
-
-
-
-
-
-
-
-
-
-
-
-
-       /****************************
-        *
-        * Scheduler methods
-        *
-        ****************************/
-
-       /**
-        * Main function to call from cli-script
-        *
-        * @return      void
-        * @deprecated since TYPO3 4.5 - This was meant for an obsolete CLI script. You shouldn't be calling this.
-        */
-       function CLI_main()     {
-               self::logDeprecatedFunction();
-               $this->autoPublishWorkspaces();
-       }
-
-       /**
-        * This method is called by the Scheduler task that triggers
-        * the autopublication process
-        * It searches for workspaces whose publication date is in the past
-        * and publishes them
-        *
-        * @return      void
-        */
-       function autoPublishWorkspaces()        {
-               global $TYPO3_CONF_VARS;
-
-                       // Temporarily set high power...
-               $GLOBALS['BE_USER']->user['admin'] = 1;
-
-                       // Select all workspaces that needs to be published / unpublished:
-               $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'uid,swap_modes,publish_time,unpublish_time',
-                       'sys_workspace',
-                       'pid=0
-                               AND
-                               ((publish_time!=0 AND publish_time<='.intval($GLOBALS['EXEC_TIME']).')
-                               OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<='.intval($GLOBALS['EXEC_TIME']).'))'.
-                               t3lib_BEfunc::deleteClause('sys_workspace')
-               );
-
-               foreach($workspaces as $rec)    {
-
-                               // First, clear start/end time so it doesn't get select once again:
-                       $fieldArray = $rec['publish_time']!=0 ? array('publish_time'=>0) : array('unpublish_time'=>0);
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace','uid='.intval($rec['uid']),$fieldArray);
-
-                               // Get CMD array:
-                       $cmd = $this->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes']==1);      // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
-
-                               // Execute CMD array:
-                       $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                       $tce->stripslashes_values = 0;
-                       $tce->start(array(),$cmd);
-                       $tce->process_cmdmap();
-               }
-       }
-}
-
-
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.wslib.php'])      {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.wslib.php']);
-}
-?>
\ No newline at end of file
diff --git a/typo3/mod/user/ws/class.wslib_gui.php b/typo3/mod/user/ws/class.wslib_gui.php
deleted file mode 100644 (file)
index e2968ed..0000000
+++ /dev/null
@@ -1,1309 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005-2010 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.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Library with Workspace GUI related functionality. It is used by main workspace
- * module but also can be used from extensions. Originally 99.9%% of the code
- * was written by Kasper and only transfered here by Dmitry.
- *
- * $Id$
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @author     Dmitry Dulepov <dmitry@typo3.org>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   84: class wslib_gui
- *
- *              SECTION: Public functions
- *  128:     function getWorkspaceOverview(&$doc, $wsid = null, $filter = 0, $pageId = -1)
- *  192:     function hlSubelements(origId, verId, over, diffLayer)
- *
- *              SECTION: Private functions (do not use outside of this class!)
- *  224:     function initVars()
- *  253:     function displayWorkspaceOverview_setInPageArray(&$pArray, $rlArr, $table, $row)
- *  284:     function markupNewOriginals()
- *  309:     function displayWorkspaceOverview_list($pArray, $tableRows=array(), $c=0, $warnAboutVersions=FALSE)
- *  504:     function displayWorkspaceOverview_pageTreeIconTitle($pageUid, $title, $indentCount)
- *  518:     function formatVerId($verId)
- *  529:     function formatWorkspace($wsid)
- *  559:     function createDiffView($table, $diff_1_record, $diff_2_record)
- *  676:     function versionsInOtherWS($table, $uid)
- *  705:     function showStageChangeLog($table,$id,$stageCommands)
- *  757:     function displayWorkspaceOverview_commandLinks($table,&$rec_on,&$rec_off,$vType)
- *  830:     function formatCount($count)
- *  860:     function subElements($uid,$treeLevel,$origId=0)
- *  963:     function subElements_getNonPageRecords($tN, $uid, &$recList)
- *  993:     function subElements_renderItem(&$tCell,$tN,$uid,$rec,$origId,$iconMode,$HTMLdata)
- * 1066:     function displayWorkspaceOverview_commandLinksSub($table,$rec,$origId)
- * 1113:     function displayWorkspaceOverview_stageCmd($table,&$rec_off)
- *
- * TOTAL FUNCTIONS: 19
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-require_once(PATH_typo3 . 'mod/user/ws/class.wslib.php');
-$LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
-$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
-
-/**
- * Library with Workspace GUI related functionality. It is used by main workspace
- * module but also can be used from extensions. Originally 99.9%% of the code
- * was written by Kasper and only transfered here by Dmitry.
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @author     Dmitry Dulepov <dmitry@typo3.org>
- * @package TYPO3
- * @subpackage core
- */
-class wslib_gui {
-
-       // Static:
-       var $pageTreeIndent = 8;
-       var $pageTreeIndent_titleLgd = 30;
-
-       // Options
-       var     $diff = false;
-       var     $expandSubElements = false;
-       var     $alwaysDisplayHeader = false;
-
-       // Internal
-       var     $showWorkspaceCol = 0;
-       var     $doc;
-       var     $formatWorkspace_cache = array();
-       var     $targets = array();                                             // Accumulation of online targets.
-       var     $be_user_Array = array();
-       var     $pageModule = '';
-       var $formatCount_cache = array();
-       var $stageIndex = array();
-       var     $addHlSubelementsScript = false;
-
-       /*********************************
-        *
-        * Public functions
-        *
-        *********************************/
-
-       /**
-        * Creates HTML to display workspace overview. Can be used to display overview for all possible records or only for single page.
-        *
-        * The following code is <strong>required</strong> in BE module when this function is used:
-        * <code>
-        *      $this->doc->getContextMenuCode();
-        * </code>
-        * or click-menu will not be generated properly!
-        *
-        * @param       object          $doc    Document (to use for formatting)
-        * @param       int             $wsid   Workspace ID, If <code>null</code>, the value is obtained from current BE user
-        * @param       int             $filter If 0, than no filtering, if 10 than select for publishing, otherwise stage value
-        * @param       int             $pageId If greater than zero, than it is UID of page in LIVE workspaces to select records for
-        * @return      string          Generated HTML
-        */
-       function getWorkspaceOverview(&$doc, $wsid = null, $filter = 0, $pageId = -1) {
-               global  $LANG;
-
-               // Setup
-               $this->workspaceId = (!is_null($wsid) ? $wsid : $GLOBALS['BE_USER']->workspace);
-               $this->showWorkspaceCol = $GLOBALS['BE_USER']->workspace == 0 && $this->workspaceId <= -98;
-               $this->doc = $doc;
-               $this->initVars();
-
-               // Initialize workspace object and request all pending versions:
-               $wslibObj = t3lib_div::makeInstance('wslib');
-
-               // Selecting ALL versions belonging to the workspace:
-               $versions = $wslibObj->selectVersionsInWorkspace($this->workspaceId, $filter, -99, $pageId);
-
-               // Traverse versions and build page-display array:
-               $pArray = array();
-               $wmArray = array();     // is page in web mount?
-               $rlArray = array();     // root line of page
-               $pagePermsClause = $GLOBALS['BE_USER']->getPagePermsClause(1);
-               foreach($versions as $table => $records)        {
-                       if (is_array($records)) {
-                               foreach($records as $rec)       {
-                                       $pageIdField = $table==='pages' ? 't3ver_oid' : 'realpid';
-                                       $recPageId = $rec[$pageIdField];
-                                       if (!isset($wmArray[$recPageId]))       {
-                                               $wmArray[$recPageId] = $GLOBALS['BE_USER']->isInWebMount($recPageId,$pagePermsClause);
-                                       }
-                                       if ($wmArray[$recPageId])       {
-                                               if (!isset($rlArray[$recPageId]))       {
-                                                       $rlArray[$recPageId] = t3lib_BEfunc::BEgetRootLine($recPageId, 'AND 1=1');
-                                               }
-                                               $this->displayWorkspaceOverview_setInPageArray(
-                                                       $pArray,
-                                                       $rlArray[$recPageId],
-                                                       $table,
-                                                       $rec
-                                               );
-                                       }
-                               }
-                       }
-               }
-
-                       // Page-browser:
-               $resultsPerPage = 50;
-               $pointer = t3lib_div::_GP('browsePointer');
-               $browseStat = $this->cropWorkspaceOverview_list($pArray,$pointer,$resultsPerPage);
-               $browse = '';
-               $browse .= '<h3>Showing ' . $browseStat['begin'] . ' to ' . ($browseStat['end'] ? $browseStat['end'] . ' out of ' . $browseStat['allItems'] : $browseStat['allItems']) . ' versions:</h3>';
-               if (!($browseStat['begin']==1 && !$browseStat['end']))  {
-                       for($a=0;$a<ceil($browseStat['allItems']/$resultsPerPage);$a++) {
-                               $browse.=($a==(int)$pointer?'<strong>':'').'<a href="'.htmlspecialchars('index.php?browsePointer='.rawurlencode($a)).'">['.($a+1).']</a>'.($a==(int)$pointer?'</strong>':'').' ';
-                       }
-               }
-
-               $workspaceOverviewList = $this->displayWorkspaceOverview_list($pArray);
-               if ($workspaceOverviewList || $this->alwaysDisplayHeader) {
-                       // Make header of overview:
-                       $tableRows = array();
-                       $tableHeader = '
-                               <tr class="t3-row-header">
-                                       <td nowrap="nowrap" width="100">' . $LANG->getLL('label_pagetree') . '</td>
-                                       <td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_live_version') . '</td>
-                                       <td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_draft_versions') . '</td>
-                                       <td nowrap="nowrap">' . $LANG->getLL('label_stage') . '</td>
-                                       <td nowrap="nowrap">' . $LANG->getLL('label_publish') . '</td>
-                                       <td><select name="_with_selected_do" onchange="if (confirm(\'' . $LANG->getLL('submit_apply_action_on_selected_elements') . '\')) {document.forms[0].submit();}">
-                                               <option value="_">' . $LANG->getLL('label_doaction_default') . '</option>';
-
-                       if ($this->publishAccess && !($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1)) {
-                               $tableHeader .= '<option value="publish">' . $LANG->getLL('label_doaction_publish') . '</option>';
-                               if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
-                                       $tableHeader .= '<option value="swap">' . $LANG->getLL('label_doaction_swap') . '</option>';
-                               }
-                       }
-                       if ($GLOBALS['BE_USER']->workspace !== 0) {
-                               $tableHeader .= '<option value="release">' . $LANG->getLL('label_doaction_release') . '</option>';
-                       }
-                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('-1') ? '<option value="stage_-1">' . $LANG->getLL('label_doaction_stage_reject') . '</option>' : '';
-                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('0') ? '<option value="stage_0">' . $LANG->getLL('label_doaction_stage_editing') . '</option>' : '';
-                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('1') ? '<option value="stage_1">' . $LANG->getLL('label_doaction_stage_review') . '</option>' : '';
-                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('10') ? '<option value="stage_10">' . $LANG->getLL('label_doaction_stage_publish') . '</option>' : '';
-
-                       $tableHeader .= '<option value="flush">' . $LANG->getLL('label_doaction_flush') . '</option>
-                                       </select></td>
-                                       <td>' . $LANG->getLL('label_lifecycle') . '</td>
-                                       '.($this->showWorkspaceCol ? '<td>' . $LANG->getLL('label_workspace') . '</td>' : '').'
-                               </tr>';
-                       $tableRows[] = $tableHeader;
-
-                       // Add lines from overview:
-                       $tableRows = array_merge($tableRows, $workspaceOverviewList);
-
-                       $table = '<table border="0" cellpadding="0" cellspacing="0" id="t3-user-ws-wsoverview-table" class="typo3-dblist">' . implode('', $tableRows) . '</table>';
-
-                       // script
-                       if ($this->addHlSubelementsScript && !strstr($this->doc->JScode, 'function hlSubelements(')) {
-                               $table = $this->doc->wrapScriptTags('
-                                       function hlSubelements(origId, verId, over, diffLayer)  {
-                                               if (over)       {
-                                                       document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
-                                                       document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
-                                                       if (diffLayer)  {
-                                                               document.getElementById(\'diff_\'+verId).style.visibility = \'visible\';
-                                                       }
-                                               } else {
-                                                       document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
-                                                       document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
-                                                       if (diffLayer)  {
-                                                               document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\';
-                                                       }
-                                               }
-                                       }
-                               ') . $table;
-                       }
-
-                       return $browse . $table . $this->markupNewOriginals();
-               }
-               return '';
-       }
-
-       /*********************************
-        *
-        * Private functions (do not use outside of this class!)
-        *
-        *********************************/
-
-       /**
-        * Initializes several class variables
-        *
-        * @return      void
-        */
-       function initVars() {
-               // Init users
-               $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
-               $groupArray = array_keys($be_group_Array);
-               // Need 'admin' field for t3lib_iconWorks::getIconImage()
-               $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');
-               if (!$GLOBALS['BE_USER']->isAdmin()) {
-                       $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array,$groupArray,1);
-               }
-
-               // If another page module was specified, replace the default Page module with the new one
-               $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
-               $this->pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
-
-               // Setting publish access permission for workspace:
-               $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace);     // FIXME Should be $this->workspaceId here?
-       }
-
-       /**
-        * Building up of the $pArray variable which is a hierarchical storage of table-rows arranged according to the level in the rootline the element was found
-        * (Internal)
-        * Made for recursive calling
-        *
-        * @param       array           Array that is built up with the page tree structure
-        * @param       array           Root line for element (table / row); The element is stored in pArray according to this root line.
-        * @param       string          Table name
-        * @param       array           Table row
-        * @return      void            $pArray is passed by reference and modified internally
-        */
-       function displayWorkspaceOverview_setInPageArray(&$pArray, $rlArr, $table, $row)        {
-               // Initialize:
-               ksort($rlArr);
-               reset($rlArr);
-               if (!$rlArr[0]['uid']) {
-                       array_shift($rlArr);
-               }
-
-               // Get and remove first element in root line:
-               $cEl = current($rlArr);
-               $pUid = $cEl['t3ver_oid'] ? $cEl['t3ver_oid'] : $cEl['uid'];            // Done to pile up "false versions" in the right branch...
-
-               $pArray[$pUid] = $cEl['title'];
-               array_shift($rlArr);
-
-               // If there are elements left in the root line, call this function recursively (to build $pArray in depth)
-               if (count($rlArr))      {
-                       if (!isset($pArray[$pUid.'.'])) {
-                               $pArray[$pUid.'.'] = array();
-                       }
-                       $this->displayWorkspaceOverview_setInPageArray($pArray[$pUid.'.'], $rlArr, $table, $row);
-               } else {        // If this was the last element, set the value:
-                       $pArray[$pUid.'_'][$table][$row['t3ver_oid']][] = $row;
-               }
-       }
-
-       /**
-        * JavaScript code to mark up new records that are online (in sub element lists)
-        *
-        * @return      string          HTML javascript section
-        */
-       function markupNewOriginals()   {
-
-               if (count($this->targets))      {
-                       $scriptCode = '';
-                       foreach($this->targets as $key => $rec) {
-                               $scriptCode.='
-                                       document.getElementById(\''.$key.'\').attributes.getNamedItem("class").nodeValue = \'typo3-ver-new\';
-                               ';
-                       }
-
-                       return $this->doc->wrapScriptTags($scriptCode);
-               }
-       }
-
-
-       /**
-        * Rendering the content for the publish / review overview:
-        * (Made for internal recursive calling)
-        *
-        * @param       array           Hierarchical storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray())
-        * @param       array           Existing array of table rows to add to
-        * @param       array           Depth counter
-        * @param       boolean         If set, a warning is shown if versions are found (internal flag)
-        * @return      array           Table rows, see displayWorkspaceOverview()
-        */
-       function displayWorkspaceOverview_list($pArray, $tableRows=array(), $c=0, $warnAboutVersions=FALSE)     {
-               global $TCA, $LANG;
-
-               // Initialize:
-               $fullColSpan = $this->showWorkspaceCol ? 10 : 9;
-
-               // Traverse $pArray
-               if (is_array($pArray))  {
-                       foreach($pArray as $k => $v)    {
-                               if (t3lib_div::testInt($k))     {
-
-                                       // If there are elements on this level, output a divider row which just creates a little visual space.
-                                       if (is_array($pArray[$k.'_']))  {
-                                               $tableRows[] = '
-                                                       <tr>
-                                                               <td colspan="'.$fullColSpan.'"><img src="clear.gif" width="1" height="3" alt="" /></td>
-                                                       </tr>';
-                                       }
-
-                                       // Printing a level from the page tree with no additional content:
-                                       // If there are NO elements on this level OR if there are NO pages on a level with elements, then show page tree icon and title (otherwise it is shown with the display of the elements)
-                                       if (!is_array($pArray[$k.'_']) || !is_array($pArray[$k.'_']['pages']))  {
-                                               $tableRows[] = '
-                                                       <tr class="bgColor4-20">
-                                                               <td nowrap="nowrap" colspan="'.$fullColSpan.'">'.
-                                                               $this->displayWorkspaceOverview_pageTreeIconTitle($k,$pArray[$k],$c).
-                                                               '</td>
-                                                       </tr>';
-                                       }
-
-                                       // If there ARE elements on this level, print them:
-                                       $warnAboutVersions_next = $warnAboutVersions;
-                                       $warnAboutVersions_nonPages = FALSE;
-                                       $warnAboutVersions_page = FALSE;
-                                       if (is_array($pArray[$k.'_']))  {
-                                               foreach($pArray[$k.'_'] as $table => $oidArray) {
-                                                       foreach($oidArray as $oid => $recs)     {
-
-                                                               // Get CURRENT online record and icon based on "t3ver_oid":
-                                                               $rec_on = t3lib_BEfunc::getRecord($table,$oid);
-                                                               $icon = t3lib_iconWorks::getIconImage($table, $rec_on, $this->doc->backPath,' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($rec_on,$table).'"');
-                                                               if ($GLOBALS['BE_USER']->workspace===0) {       // Only edit online records if in ONLINE workspace:
-                                                                       $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $rec_on['uid'], 2, '', '+edit,view,info,delete');
-                                                               }
-
-                                                               // MAIN CELL / Online version display:
-                                                               // Create the main cells which will span over the number of versions there is. If the table is "pages" then it will show the page tree icon and title (which was not shown by the code above)
-                                                               $verLinkUrl = t3lib_extMgm::isLoaded('version') && $TCA[$table]['ctrl']['versioningWS'];
-                                                               $origElement = $icon.
-                                                               ($verLinkUrl ? '<a href="'.htmlspecialchars($this->doc->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?table='.$table.'&uid='.$rec_on['uid']).'">' : '').
-                                                                                               t3lib_BEfunc::getRecordTitle($table,$rec_on,TRUE).
-                                                                                               ($verLinkUrl ? '</a>' : '');
-                                                               $mainCell_rowSpan = count($recs)>1 ? ' rowspan="'.count($recs).'"' : '';
-                                                               $mainCell = $table==='pages' ? '
-                                                                                       <td class="bgColor4-20" nowrap="nowrap"'.$mainCell_rowSpan.'>'.
-                                                                                       $this->displayWorkspaceOverview_pageTreeIconTitle($k,$pArray[$k],$c).
-                                                                                       '</td>' : '
-                                                                                       <td class="bgColor"'.$mainCell_rowSpan.'></td>';
-                                                               $mainCell.= '
-                                                                                       <td align="center"'.$mainCell_rowSpan.'>'.$this->formatVerId($rec_on['t3ver_id']).'</td>
-                                                                                       <td nowrap="nowrap"'.$mainCell_rowSpan.'>'.
-                                                               $origElement.
-                                                               '###SUB_ELEMENTS###'.   // For substitution with sub-elements, if any.
-                                                               '</td>';
-
-                                                               // Offline versions display:
-                                                               // Traverse the versions of the element
-                                                               foreach($recs as $rec)  {
-
-                                                                       // Get the offline version record:
-                                                                       $rec_off = t3lib_BEfunc::getRecord($table,$rec['uid']);
-
-                                                                       // Prepare swap-mode values:
-                                                                       if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1) {
-                                                                               if ($rec_off['t3ver_swapmode']>0)       {
-                                                                                       $vType = 'branch';      // Do not translate!
-                                                                               } else {
-                                                                                       $vType = 'page';        // Do not translate!
-                                                                               }
-                                                                       } else {
-                                                                               $vType = 'element';     // Do not translate!
-                                                                       }
-
-                                                                       // Get icon:
-                                                                       $icon = t3lib_iconWorks::getIconImage($table, $rec_off, $this->doc->backPath, ' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($rec_off,$table).'"');
-                                                                       $tempUid = ($table != 'pages' || $vType==='branch' || $GLOBALS['BE_USER']->workspace == 0 ? $rec_off['uid'] : $rec_on['uid']);
-                                                                       $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $tempUid, 2, '', '+edit,' . ($table == 'pages' ? 'view,info,' : '') . 'delete');
-
-                                                                       // Prepare diff-code:
-                                                                       if ($this->diff)        {
-                                                                               $diffCode = '';
-                                                                               list($diffHTML,$diffPct) = $this->createDiffView($table, $rec_off, $rec_on);
-                                                                               if ($rec_on['t3ver_state']==1)  {       // New record:
-                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_newrecord') . '<br />';
-                                                                                       $diffCode.= $diffHTML;
-                                                                               } elseif ($rec_off['t3ver_state']==2)   {
-                                                                                       $diffCode.= $this->doc->icons(2) . $LANG->getLL('label_deletedrecord') . '<br/>';
-                                                                               } elseif ($rec_on['t3ver_state']==3)    {
-                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_moveto_placeholder') . '<br/>';
-                                                                               } elseif ($rec_off['t3ver_state']==4)   {
-                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_moveto_pointer') . '<br/>';
-                                                                               } else {
-                                                                                       $diffCode .= ($diffPct < 0 ? $LANG->getLL('label_notapplicable') :
-                                                                                               ($diffPct ? sprintf($LANG->getLL('label_percentChange'), $diffPct) : ''));
-                                                                                       $diffCode.= $diffHTML;
-                                                                               }
-
-                                                                       } else $diffCode = '';
-
-                                                                       switch($vType) {
-                                                                               case 'element':
-                                                                                       $swapLabel = ' ['.$LANG->getLL('label_element').']';
-                                                                                       $swapClass = 'ver-element';     // Do not translate!
-                                                                                       $warnAboutVersions_nonPages = $warnAboutVersions_page;  // Setting this if sub elements are found with a page+content (must be rendered prior to this of course!)
-                                                                                       break;
-                                                                               case 'page':
-                                                                                       $swapLabel = ' ['.$LANG->getLL('label_page').']';
-                                                                                       $swapClass = 'ver-page';        // Do not translate!
-                                                                                       $warnAboutVersions_page = !$this->showWorkspaceCol;             // This value is true only if multiple workspaces are shown and we need the opposite here.
-                                                                                       break;
-                                                                               case 'branch':
-                                                                                       $swapLabel = ' ['.$LANG->getLL('label_branch').']';
-                                                                                       $swapClass = 'ver-branch';      // Do not translate!
-                                                                                       $warnAboutVersions_next = !$this->showWorkspaceCol;             // This value is true only if multiple workspaces are shown and we need the opposite here.
-                                                                                       break;
-                                                                       }
-
-                                                                       // Modify main cell based on first version shown:
-                                                                       $subElements = array();
-                                                                       if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1 && $mainCell)    {       // For "Page" and "Branch" swap modes where $mainCell is still carrying content (only first version)
-                                                                               $subElements['on'] = $this->subElements($rec_on['uid'], $rec_off['t3ver_swapmode']);
-                                                                               $subElements['off'] = $this->subElements($rec_off['uid'],$rec_off['t3ver_swapmode'],$rec_on['uid']);
-                                                                       }
-                                                                       $mainCell = str_replace('###SUB_ELEMENTS###', $subElements['on'], $mainCell);
-
-                                                                       // Create version element:
-                                                                       $versionsInOtherWS = $this->versionsInOtherWS($table, $rec_on['uid']);
-                                                                       $versionsInOtherWSWarning = $versionsInOtherWS && $GLOBALS['BE_USER']->workspace !== 0 ? '<br />' . $this->doc->icons(2) . $LANG->getLL('label_otherversions') . ' ' . $versionsInOtherWS : '';
-                                                                       $multipleWarning = (!$mainCell && $GLOBALS['BE_USER']->workspace !==0 ? '<br />' . $this->doc->icons(3) . '<strong>' . $LANG->getLL('label_multipleversions') . '</strong>' : '');
-                                                                       $verWarning = $warnAboutVersions || ($warnAboutVersions_nonPages && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages']) ? '<br />' . $this->doc->icons(3) . '<strong>' . $LANG->getLL('label_nestedversions') . '</strong>' : '';
-                                                                       $verElement = $icon.
-                                                                               '<a href="'.htmlspecialchars($this->doc->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?id='.($table==='pages'?$rec_on['uid']:$rec_on['pid']).'&details='.rawurlencode($table.':'.$rec_off['uid']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
-                                                                               t3lib_BEfunc::getRecordTitle($table,$rec_off,TRUE).
-                                                                               '</a>'.
-                                                                               $versionsInOtherWSWarning.
-                                                                               $multipleWarning.
-                                                                               $verWarning;
-                                                                       if ($diffCode)  {
-                                                                               $verElement = '
-                                                                               <table border="0" cellpadding="0" cellspacing="0" class="ver-verElement">
-                                                                                       <tr>
-                                                                                               <td nowrap="nowrap" width="180">'.$verElement.'&nbsp;&nbsp;</td>
-                                                                                               <td class="c-diffCell">'.$diffCode.'</td>
-                                                                                       </tr>
-                                                                               </table>';
-                                                                       }
-
-                                                                       // Create version cell:
-                                                                       $verCell = '
-                                                                                       <td align="center">'.$this->formatVerId($rec_off['t3ver_id']).'</td>
-                                                                                       <td nowrap="nowrap">'.
-                                                                       $verElement.
-                                                                       $subElements['off'].
-                                                                       '</td>';
-
-                                                                       // Compile table row:
-                                                                       $tableRows[] = '
-                                                                               <tr class="bgColor4">
-                                                                                       '.$mainCell.$verCell.'
-                                                                                       <td nowrap="nowrap">'.$this->showStageChangeLog($table,$rec_off['uid'],$this->displayWorkspaceOverview_stageCmd($table,$rec_off)).'</td>
-                                                                                       <td nowrap="nowrap" class="'.$swapClass.'">'.
-                                                                       $this->displayWorkspaceOverview_commandLinks($table,$rec_on,$rec_off,$vType).
-                                                                       htmlspecialchars($swapLabel).
-                                                                       '</td>
-                                                                                       <td nowrap="nowrap" align="center"><input type="checkbox" name="items['.$table.':'.$rec_off['uid'].']" id="items['.$table.':'.$rec_off['uid'].']" value="1"/></td>
-                                                                                       <td nowrap="nowrap">'.htmlspecialchars($this->formatCount($rec_off['t3ver_count'])).'</td>'.            // Lifecycle
-                                                                       ($this->showWorkspaceCol ? '
-                                                                                       <td nowrap="nowrap">'.htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])).'</td>' : '').'
-                                                                               </tr>';
-
-                                                                       // Reset the main cell:
-                                                                       $mainCell = '';
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       // Call recursively for sub-rows:
-                                       $tableRows = $this->displayWorkspaceOverview_list($pArray[$k.'.'], $tableRows, $c+1, $warnAboutVersions_next);
-                               }
-                       }
-               }
-               return $tableRows;
-       }
-
-       /**
-        * Filtering out items in pArray according to pointer and result-per-page setting
-        *
-        * @param       array           Hierarchical storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray())
-        * @return      array           Returns statistics about the pointer state.
-        */
-       function cropWorkspaceOverview_list(&$pArray,$pointer=0,$resPerPage=50,$stat=array())   {
-
-                       // Traverse $pArray
-               if (is_array($pArray))  {
-                       foreach($pArray as $k => $v)    {
-                               if (t3lib_div::testInt($k))     {
-
-                                       if (is_array($pArray[$k.'_']))  {
-                                               foreach($pArray[$k.'_'] as $table => $oidArray) {
-                                                       foreach($oidArray as $oid => $recs)     {
-
-                                                                       // Check, if the item count has reached the point where we want to set the in-point.
-                                                               $beginWasSet = FALSE;
-                                                               if (!isset($stat['begin']) && (int)$stat['allItems'] >= $pointer*$resPerPage)   {
-                                                                       $stat['begin']=(int)$stat['allItems']+1;
-                                                                       $beginWasSet = TRUE;
-                                                               }
-
-                                                                       // If in-point is not set, unset the previous items.
-                                                               if (!isset($stat['begin']))     {
-                                                                       unset($pArray[$k.'_'][$table][$oid]);
-                                                               }
-
-                                                                       // Increase counter:
-                                                               $stat['allItems']+=count($recs);
-
-                                                                       // Check if end-point is reached:
-                                                               if (!$beginWasSet && !isset($stat['end']) && $stat['allItems'] > ($pointer+1)*$resPerPage)      {
-                                                                       $stat['end']=$stat['allItems']-1;
-                                                               }
-
-                                                                       // If end-point is reached, unset following items.
-                                                               if (isset($stat['end']))        {
-                                                                       unset($pArray[$k.'_'][$table][$oid]);
-                                                               }
-                                                       }
-
-                                                               // Clean-up if no more items:
-                                                       if (!count($pArray[$k.'_'][$table]))    {
-                                                               unset($pArray[$k.'_'][$table]);
-                                                       }
-                                               }
-
-                                                       // Clean-up if no more items:
-                                               if (!count($pArray[$k.'_']))    {
-                                                       unset($pArray[$k.'_']);
-                                               }
-                                       }
-
-                                               // Call recursively for sub-rows:
-                                       if (is_array($pArray[$k.'.']))  {
-                                               $stat = $this->cropWorkspaceOverview_list($pArray[$k.'.'],$pointer,$resPerPage,$stat);
-                                       }
-                               }
-                       }
-               }
-               return $stat;
-       }
-
-       /**
-        * Create indentation, icon and title for the page tree identification for the list.
-        *
-        * @param       integer         Page UID (record will be looked up again)
-        * @param       string          Page title
-        * @param       integer         Depth counter from displayWorkspaceOverview_list() used to indent the icon and title
-        * @return      string          HTML content
-        */
-       function displayWorkspaceOverview_pageTreeIconTitle($pageUid, $title, $indentCount)     {
-               $pRec = t3lib_BEfunc::getRecord('pages',$pageUid);
-               return '<img src="clear.gif" width="1" height="1" hspace="'.($indentCount * $this->pageTreeIndent).'" align="top" alt="" />'.   // Indenting page tree
-                       t3lib_iconWorks::getIconImage('pages',$pRec,$this->doc->backPath,' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($pRec,'pages').'"').
-                       htmlspecialchars(t3lib_div::fixed_lgd_cs($title,$this->pageTreeIndent_titleLgd)).
-                       '&nbsp;&nbsp;';
-       }
-
-       /**
-        * Formatting the version number for HTML output
-        *
-        * @param       integer         Version number
-        * @return      string          Version number for output
-        */
-       function formatVerId($verId)    {
-               return '1.'.$verId;
-       }
-
-
-       /**
-        * Formatting workspace ID into a visual label
-        *
-        * @param       integer         Workspace ID
-        * @return      string          Workspace title
-        */
-       function formatWorkspace($wsid) {
-
-               // Render, if not cached:
-               if (!isset($this->formatWorkspace_cache[$wsid]))        {
-                       switch($wsid)   {
-                               case -1:
-                                       $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...
-                                       break;
-                               default:
-                                       list($titleRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('title','sys_workspace','uid='.intval($wsid).t3lib_BEfunc::deleteClause('sys_workspace'));
-                                       $this->formatWorkspace_cache[$wsid] = '['.$wsid.'] '.$titleRec['title'];
-                                       break;
-                       }
-               }
-
-               return $this->formatWorkspace_cache[$wsid];
-       }
-
-
-       /**
-        * Create visual difference view of two records. Using t3lib_diff library
-        *
-        * @param       string          Table name
-        * @param       array           New version record (green)
-        * @param       array           Old version record (red)
-        * @return      array           Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change
-        */
-       function createDiffView($table, $diff_1_record, $diff_2_record) {
-               global $TCA, $LANG;
-
-               // Initialize:
-               $pctChange = 'N/A';
-
-               // Check that records are arrays:
-               if (is_array($diff_1_record) && is_array($diff_2_record))       {
-
-                       // Load full table description and initialize diff-object:
-                       t3lib_div::loadTCA($table);
-                       $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
-
-                       // Add header row:
-                       $tRows = array();
-                       $tRows[] = '
-                               <tr class="bgColor5 tableheader">
-                                       <td>' . $LANG->getLL('diffview_label_field_name') . '</td>
-                                       <td width="98%" nowrap="nowrap">' . $LANG->getLL('diffview_label_colored_diff_view') . '</td>
-                               </tr>
-                       ';
-
-                       // Initialize variables to pick up string lengths in:
-                       $allStrLen = 0;
-                       $diffStrLen = 0;
-
-                       // Traversing the first record and process all fields which are editable:
-                       foreach($diff_1_record as $fN => $fV)   {
-                               if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type']!='passthrough' && !t3lib_div::inList('t3ver_label',$fN))     {
-
-                                       // Check if it is files:
-                                       $isFiles = FALSE;
-                                       if (strcmp(trim($diff_1_record[$fN]),trim($diff_2_record[$fN])) &&
-                                       $TCA[$table]['columns'][$fN]['config']['type']=='group' &&
-                                       $TCA[$table]['columns'][$fN]['config']['internal_type']=='file')        {
-
-                                               // Initialize:
-                                               $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder'];
-                                               $files1 = array_flip(t3lib_div::trimExplode(',', $diff_1_record[$fN],1));
-                                               $files2 = array_flip(t3lib_div::trimExplode(',', $diff_2_record[$fN],1));
-
-                                               // Traverse filenames and read their md5 sum:
-                                               foreach($files1 as $filename => $tmp)   {
-                                                       $files1[$filename] = @is_file(PATH_site.$uploadFolder.'/'.$filename) ? md5(t3lib_div::getUrl(PATH_site.$uploadFolder.'/'.$filename)) : $filename;
-                                               }
-                                               foreach($files2 as $filename => $tmp)   {
-                                                       $files2[$filename] = @is_file(PATH_site.$uploadFolder.'/'.$filename) ? md5(t3lib_div::getUrl(PATH_site.$uploadFolder.'/'.$filename)) : $filename;
-                                               }
-
-                                               // Implode MD5 sums and set flag:
-                                               $diff_1_record[$fN] = implode(' ',$files1);
-                                               $diff_2_record[$fN] = implode(' ',$files2);
-                                               $isFiles = TRUE;
-                                       }
-
-                                       // If there is a change of value:
-                                       if (strcmp(trim($diff_1_record[$fN]),trim($diff_2_record[$fN])))        {
-
-
-                                               // Get the best visual presentation of the value and present that:
-                                               $val1 = t3lib_BEfunc::getProcessedValue($table,$fN,$diff_2_record[$fN],0,1);
-                                               $val2 = t3lib_BEfunc::getProcessedValue($table,$fN,$diff_1_record[$fN],0,1);
-
-                                               // Make diff result and record string lenghts:
-                                               $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1,$val2,$isFiles?'div':'span');
-                                               $diffStrLen+= $t3lib_diff_Obj->differenceLgd;
-                                               $allStrLen+= strlen($val1.$val2);
-
-                                               // If the compared values were files, substituted MD5 hashes:
-                                               if ($isFiles)   {
-                                                       $allFiles = array_merge($files1,$files2);
-                                                       foreach($allFiles as $filename => $token)       {
-                                                               if (strlen($token)==32 && strstr($diffres,$token))      {
-                                                                       $filename =
-                                                                       t3lib_BEfunc::thumbCode(array($fN=>$filename),$table,$fN,$this->doc->backPath).
-                                                                       $filename;
-                                                                       $diffres = str_replace($token,$filename,$diffres);
-                                                               }
-                                                       }
-                                               }
-
-                                               // Add table row with result:
-                                               $tRows[] = '
-                                                       <tr class="bgColor4">
-                                                               <td>'.htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table,$fN))).'</td>
-                                                               <td width="98%">'.$diffres.'</td>
-                                                       </tr>
-                                               ';
-                                       } else {
-                                               // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed:
-                                               $allStrLen+=strlen($diff_1_record[$fN].$diff_2_record[$fN]);
-                                       }
-                               }
-                       }
-
-                       // Calculate final change percentage:
-                       $pctChange = $allStrLen ? ceil($diffStrLen*100/$allStrLen) : -1;
-
-                       // Create visual representation of result:
-                       if (count($tRows)>1)    {
-                               $content.= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">'.implode('',$tRows).'</table>';
-                       } else {
-                               $content.= '<span class="nobr">'.$this->doc->icons(1).$LANG->getLL('diffview_complete_match').'</span>';
-                       }
-               } else $content.= $this->doc->icons(3).$LANG->getLL('diffview_cannot_find_records');
-
-               // Return value:
-               return array($content,$pctChange);
-       }
-
-       /**
-        * Looking for versions of a record in other workspaces than the current
-        *
-        * @param       string          Table name
-        * @param       integer         Record uid
-        * @return      string          List of other workspace IDs
-        */
-       function versionsInOtherWS($table, $uid)        {
-               // Check for duplicates:
-               // Select all versions of record NOT in this workspace:
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                               't3ver_wsid',
-                               $table,
-                               'pid=-1
-                               AND t3ver_oid='.intval($uid).'
-                               AND t3ver_wsid!='.intval($GLOBALS['BE_USER']->workspace).// TODO should be $this->workspaceId here???
-                               ' AND (t3ver_wsid=-1 OR t3ver_wsid>0)'.
-                               t3lib_BEfunc::deleteClause($table),
-                               '',
-                               't3ver_wsid',
-                               '',
-                               't3ver_wsid'
-               );
-               if (count($rows)) {
-                       return implode(',',array_keys($rows));
-               }
-       }
-
-       /**
-        * Looks up stage changes for version and displays a formatted view on mouseover.
-        *
-        * @param       string          Table name
-        * @param       integer         Record ID
-        * @param       string          HTML string to wrap the mouseover around (should be stage change links)
-        * @return      string          HTML code.
-        */
-       function showStageChangeLog($table,$id,$stageCommands)  {
-               global  $LANG;
-
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                               'log_data,tstamp,userid',
-                               'sys_log',
-                               'action=6 and details_nr=30
-                               AND tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_log').'
-                               AND recuid='.intval($id)
-               );
-
-               $entry = array();
-               foreach($rows as $dat)  {
-                       $data = unserialize($dat['log_data']);
-                       $username = $this->be_user_Array[$dat['userid']] ? $this->be_user_Array[$dat['userid']]['username'] : '['.$dat['userid'].']';
-
-                       switch($data['stage'])  {
-                               case 1:
-                                       $text = $LANG->getLL('stage_sent_to_review');
-                                       break;
-                               case 10:
-                                       $text = $LANG->getLL('stage_approved_for_publish');
-                                       break;
-                               case -1:
-                                       $text = $LANG->getLL('stage_rejected');
-                                       break;
-                               case 0:
-                                       $text = $LANG->getLL('stage_reset_to_editing');
-                                       break;
-                               default:
-                                       $text = $LANG->getLL('stage_undefined');
-                                       break;
-                       }
-                       $text = t3lib_BEfunc::datetime($dat['tstamp']).': ' . sprintf($text, htmlspecialchars($username));
-                       $text.= ($data['comment'] ? '<br />' . $LANG->getLL('stage_label_user_comment') . ' <em>' . htmlspecialchars($data['comment']) . '</em>' : '');
-
-                       $entry[] = $text;
-               }
-
-               return count($entry) ? '<span onmouseover="document.getElementById(\'log_'.$table.$id.'\').style.visibility = \'visible\';" onmouseout="document.getElementById(\'log_'.$table.$id.'\').style.visibility = \'hidden\';">'.$stageCommands.' ('.count($entry).')</span>'.
-                       '<div class="logLayer" style="visibility: hidden; position: absolute;" id="log_'.$table.$id.'">'.implode('<hr/>',$entry).'</div>' : $stageCommands;
-       }
-
-       /**
-        * Links to publishing etc of a version
-        *
-        * @param       string          Table name
-        * @param       array           Online record
-        * @param       array           Offline record (version)
-        * @param       string          Swap type, "branch", "page" or "element"
-        * @return      string          HTML content, mainly link tags and images.
-        */
-       function displayWorkspaceOverview_commandLinks($table,&$rec_on,&$rec_off,$vType)        {
-               global  $LANG;
-
-               if ($this->publishAccess && (!($GLOBALS['BE_USER']->workspaceRec['publish_access']&1) || (int)$rec_off['t3ver_stage']===10))    {
-                       $actionLinks =
-                               '<a href="'.htmlspecialchars($this->doc->issueCommand(
-                               '&cmd['.$table.']['.$rec_on['uid'].'][version][action]=swap'.
-                               '&cmd['.$table.']['.$rec_on['uid'].'][version][swapWith]='.$rec_off['uid']
-                               )).' " title="' . $LANG->getLL('img_title_publish') . '">'.
-                                 t3lib_iconWorks::getSpriteIcon('actions-version-swap-version') .
-                               '</a>';
-                       if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
-                               $actionLinks.=
-                                       '<a href="'.htmlspecialchars($this->doc->issueCommand(
-                                       '&cmd['.$table.']['.$rec_on['uid'].'][version][action]=swap'.
-                                       '&cmd['.$table.']['.$rec_on['uid'].'][version][swapWith]='.$rec_off['uid'].
-                                       '&cmd['.$table.']['.$rec_on['uid'].'][version][swapIntoWS]=1'
-                                                               )).'" title="' . $LANG->getLL('img_title_swap') . '">'.
-                                         t3lib_iconWorks::getSpriteIcon('actions-version-swap-workspace') .
-                                       '</a>';
-                       }
-               }
-
-               if (!$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table,$rec_off)) {
-                       if ($GLOBALS['BE_USER']->workspace!==0) {
-                               // Release
-                               $confirm = $LANG->JScharCode($LANG->getLL('remove_from_ws_confirmation'));
-                               $actionLinks.=
-                               '<a href="'.htmlspecialchars($this->doc->issueCommand('&cmd['.$table.']['.$rec_off['uid'].'][version][action]=clearWSID')).'" onclick="return confirm(' . $confirm . ');" title="' . $LANG->getLL('img_title_remove_from_ws') . '">'.
-                                 t3lib_iconWorks::getSpriteIcon('actions-version-document-remove') .
-                               '</a>';
-                       }
-
-                       // Edit
-                       if ($table==='pages' && $vType!=='element')     {
-                               $tempUid = ($vType==='branch' || $GLOBALS['BE_USER']->workspace===0 ? $rec_off['uid'] : $rec_on['uid']);
-                               $actionLinks.=
-                                       '<a href="#" onclick="top.loadEditId('.$tempUid.');top.goToModule(\''.$this->pageModule.'\'); return false;" title="' . $LANG->getLL('img_title_edit_page') . '">'.
-                                         t3lib_iconWorks::getSpriteIcon('actions-page-open') .
-                                       '</a>';
-                       } else {
-                               $params = '&edit['.$table.']['.$rec_off['uid'].']=edit';
-                               $actionLinks.=
-                                       '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->doc->backPath)).'" title="' . $LANG->getLL('img_title_edit_element') . '">'.
-                                         t3lib_iconWorks::getSpriteIcon('actions-document-open') .
-                                       '</a>';
-                       }
-               }
-
-               // History/Log
-               $actionLinks.=
-                       '<a href="'.htmlspecialchars($this->doc->backPath.'show_rechis.php?element='.rawurlencode($table.':'.$rec_off['uid']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'" title="' . $LANG->getLL('img_title_show_log') . '">' .
-                         t3lib_iconWorks::getSpriteIcon('actions-document-history-open') .
-                       '</a>';
-
-               // View
-               if ($table==='pages')   {
-                       $tempUid = ($vType==='branch' || $GLOBALS['BE_USER']->workspace===0 ? $rec_off['uid'] : $rec_on['uid']);
-                       $actionLinks.=
-                               '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($tempUid,$this->doc->backPath,t3lib_BEfunc::BEgetRootLine($tempUid))).'">'.
-                                 t3lib_iconWorks::getSpriteIcon('actions-document-view') .
-                               '</a>';
-               }
-
-               return $actionLinks;
-       }
-
-       /**
-        * Format publishing count for version (lifecycle state)
-        *
-        * @param       integer         t3ver_count value (number of times it has been online)
-        * @return      string          String translation of count.
-        */
-       function formatCount($count)    {
-               global  $LANG;
-
-               // Render, if not cached:
-               if (!isset($this->formatCount_cache[$count]))   {
-                       switch($count)  {
-                               case 0:
-                                       $this->formatCount_cache[$count] = $LANG->getLL('workspace_list_publishing_count_draft');
-                                       break;
-                               case 1:
-                                       $this->formatCount_cache[$count] = $LANG->getLL('workspace_list_publishing_count_archive');
-                                       break;
-                               default:
-                                       $this->formatCount_cache[$count] = sprintf($LANG->getLL('workspace_list_publishing_count'), $count);
-                                       break;
-                       }
-               }
-
-               return $this->formatCount_cache[$count];
-       }
-
-
-       /**
-        * Creates display of sub elements of a page when the swap mode is either "Page" or "Branch" (0 / ALL)
-        *
-        * @param       integer         Page uid (for either online or offline version, but it MUST have swapmode/treeLevel set to >0 (not -1 indicating element versioning)
-        * @param       integer         The treeLevel value, >0 indicates "branch" while 0 means page+content. (-1 would have meant element versioning, but that should never happen for a call to this function!)
-        * @param       integer         For offline versions; This is t3ver_oid, the original ID of the online page.
-        * @return      string          HTML content.
-        */
-       function subElements($uid,$treeLevel,$origId=0) {
-               global $TCA, $LANG;
-
-               if ($GLOBALS['BE_USER']->workspace===0 || !$this->expandSubElements)    {       // In online workspace we have a reduced view because otherwise it will bloat the listing:
-                       return '<br />
-                                       <img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/ol/joinbottom.gif','width="18" height="16"').' align="top" alt="" title="" />'.
-                       ($origId ?
-                       '<a href="'.htmlspecialchars($this->doc->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?id='.$uid.'&details='.rawurlencode('pages:'.$uid).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
-                       '<span class="typo3-dimmed"><em>['.$LANG->getLL('label_subelementsdetails').']</em><span></a>' :
-                       '<span class="typo3-dimmed"><em>['.$LANG->getLL('label_subelements').']</em><span>');
-               } else {        // For an offline workspace, show sub elements:
-
-                       $tCell = array();
-
-                       // Find records that follow pages when swapping versions:
-                       $recList = array();
-                       foreach($TCA as $tN => $tCfg)   {
-                               if ($tN!='pages' && ($treeLevel>0 || $TCA[$tN]['ctrl']['versioning_followPages']))      {
-                                       $this->subElements_getNonPageRecords($tN, $uid, $recList);
-                               }
-                       }
-
-                       // Render records collected above:
-                       $elCount = count($recList)-1;
-                       foreach($recList as $c => $comb)        {
-                               list($tN,$rec) = $comb;
-
-                               $this->subElements_renderItem(
-                                       $tCell,
-                                       $tN,
-                                       $uid,
-                                       $rec,
-                                       $origId,
-                                       $c==$elCount && $treeLevel==0 ? 1 : 0,          // If true, will show bottom-join icon.
-                                       ''
-                               );
-                       }
-
-                       // For branch, dive into the subtree:
-                       if ($treeLevel>0) {
-
-                               // Drawing tree:
-                               $tree = t3lib_div::makeInstance('t3lib_pageTree');
-                               $tree->init('AND '.$GLOBALS['BE_USER']->getPagePermsClause(1));
-                               $tree->makeHTML = 2;            // 2=Also rendering depth-data into the result array
-                               $tree->getTree($uid, 99, '');
-
-                               // Traverse page tree:
-                               foreach($tree->tree as $data)   {
-
-                                       // Render page in table cell:
-                                       $this->subElements_renderItem(
-                                               $tCell,
-                                               'pages',
-                                               $uid,
-                                               t3lib_BEfunc::getRecord('pages',$data['row']['uid']),   // Needs all fields, at least more than what is given in $data['row']...
-                                               $origId,
-                                               2,              // 2=the join icon and icon for the record is not rendered for pages (where all is in $data['HTML']
-                                               $data['HTML']
-                                       );
-
-                                       // Find all records from page and collect in $recList:
-                                       $recList = array();
-                                       foreach($TCA as $tN => $tCfg)   {
-                                               if ($tN!=='pages')      {
-                                                       $this->subElements_getNonPageRecords($tN, $data['row']['uid'], $recList);
-                                               }
-                                       }
-
-                                       // Render records collected above:
-                                       $elCount = count($recList)-1;
-                                       foreach($recList as $c => $comb)        {
-                                               list($tN,$rec) = $comb;
-
-                                               $this->subElements_renderItem(
-                                                       $tCell,
-                                                       $tN,
-                                                       $uid,
-                                                       $rec,
-                                                       $origId,
-                                                       $c==$elCount?1:0,       // If true, will show bottom-join icon.
-                                                       $data['HTML_depthData']
-                                               );
-                                       }
-                               }
-                       }
-
-                       return '
-                                       <!-- Sub-element tree for versions -->
-                                       <table border="0" cellpadding="0" cellspacing="1" class="ver-subtree">
-                                               '.implode('',$tCell).'
-                                       </table>';
-               }
-       }
-
-       /**
-        * Select records from a table and add them to recList
-        *
-        * @param       string          Table name (from TCA)
-        * @param       integer         PID to select records from
-        * @param       array           Array where records are accumulated, passed by reference
-        * @return      void
-        */
-       function subElements_getNonPageRecords($tN, $uid, &$recList)    {
-               global $TCA;
-
-               $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       '*',
-                       $tN,
-                       'pid='.intval($uid).
-                       ($TCA[$tN]['ctrl']['versioningWS'] ? ' AND t3ver_state=0' : '').
-                       t3lib_BEfunc::deleteClause($tN),
-                       '',
-                       $TCA[$tN]['ctrl']['sortby'] ? $TCA[$tN]['ctrl']['sortby'] : $GLOBALS['TYPO3_DB']->stripOrderBy($TCA[$tN]['ctrl']['default_sortby'])
-               );
-
-               foreach($records as $rec)       {
-                       $recList[] = array($tN,$rec);
-               }
-       }
-
-       /**
-        * Render a single item in a subelement list into a table row:
-        *
-        * @param       array           Table rows, passed by reference
-        * @param       string          Table name
-        * @param       integer         Page uid for which the subelements are selected/shown
-        * @param       array           Row of element in list
-        * @param       integer         The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version.
-        * @param       integer         Mode of icon display: 0=not the last, 1= is the last in list (make joinbottom icon then), 2=do not shown icons are all (for pages from the page tree already rendered)
-        * @param       string          Prefix HTML data (icons for tree rendering)
-        * @return      void            (Content accumulated in $tCell!)
-        */
-       function subElements_renderItem(&$tCell,$tN,$uid,$rec,$origId,$iconMode,$HTMLdata)      {
-               global $TCA;
-
-               // Initialize:
-               $origUidFields = $TCA[$tN]['ctrl']['origUid'];
-               $diffCode = '';
-
-               if ($origUidFields)     {       // If there is a field for this table with original uids we will use that to connect records:
-                       if (!$origId)   {       // In case we are displaying the online originals:
-                               $this->targets['orig_'.$uid.'_'.$tN.'_'.$rec['uid']] = $rec;    // Build up target array (important that
-                               $tdParams =  ' id="orig_'.$uid.'_'.$tN.'_'.$rec['uid'].'" class="typo3-ver"';           // Setting ID of the table row
-                       } else {        // Version branch:
-                               if ($this->targets['orig_'.$origId.'_'.$tN.'_'.$rec[$origUidFields]])   {       // If there IS a corresponding original record...:
-
-                                       // Prepare Table row parameters:
-                                       $this->addHlSubelementsScript = true;
-                                       $tdParams =  ' onmouseover="hlSubelements(\''.$origId.'_'.$tN.'_'.$rec[$origUidFields].'\', \''.$uid.'_'.$tN.'_'.$rec[$origUidFields].'\', 1, '.($this->diff==2?1:0).');"'.
-                                               ' onmouseout="hlSubelements(\''.$origId.'_'.$tN.'_'.$rec[$origUidFields].'\', \''.$uid.'_'.$tN.'_'.$rec[$origUidFields].'\', 0, '.($this->diff==2?1:0).');"'.
-                                               ' id="ver_'.$uid.'_'.$tN.'_'.$rec[$origUidFields].'" class="typo3-ver"';
-
-                                       // Create diff view:
-                                       if ($this->diff)        {
-                                               list($diffHTML,$diffPct) = $this->createDiffView($tN, $rec, $this->targets['orig_'.$origId.'_'.$tN.'_'.$rec[$origUidFields]]);
-
-                                               if ($this->diff==2)     {
-                                                       $diffCode =
-                                                               ($diffPct ? '<span class="nobr">'.$diffPct.'% change</span>' : '-').
-                                                               '<div style="visibility: hidden; position: absolute;" id="diff_'.$uid.'_'.$tN.'_'.$rec[$origUidFields].'" class="diffLayer">'.
-                                                               $diffHTML.
-                                                               '</div>';
-                                               } else {
-                                                       $diffCode =
-                                                               ($diffPct<0 ? 'N/A' : ($diffPct ? $diffPct.'% change:' : '')).
-                                                               $diffHTML;
-                                               }
-                                       }
-
-                                       // Unsetting the target fields allows us to mark all originals without a version in the subtree (see ->markupNewOriginals())
-                                       unset($this->targets['orig_'.$origId.'_'.$tN.'_'.$rec[$origUidFields]]);
-                               } else {        // No original record, so must be new:
-                                       $tdParams =  ' class="typo3-ver-new"';
-                               }
-                       }
-               } else {        // If no original uid column is supported for this table we are forced NOT to display any diff or highlighting.
-                       $tdParams = ' class="typo3-ver-noComp"';
-               }
-
-               // Compile the cell:
-               $tCell[] = '
-                                               <tr'.$tdParams.'>
-                                                       <td class="iconTitle">'.
-                                                       $HTMLdata.
-                                                       ($iconMode < 2 ?
-                                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/ol/join'.($iconMode ? 'bottom' : '').'.gif','width="18" height="16"').' alt="" />'.
-                                                       t3lib_iconWorks::getIconImage($tN, $rec, $this->doc->backPath,'') : '').
-                                                       t3lib_BEfunc::getRecordTitle($tN, $rec, TRUE).
-                                                       '</td>
-                                                       <td class="cmdCell">'.
-                                                       $this->displayWorkspaceOverview_commandLinksSub($tN,$rec,$origId).
-                                                       '</td>'.($origId ? '<td class="diffCell">'.
-                                                       $diffCode.
-                                                       '</td>':'').'
-                                               </tr>';
-       }
-
-       /**
-        * Links to publishing etc of a version
-        *
-        * @param       string          Table name
-        * @param       array           Record array
-        * @param       integer         The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version.
-        * @return      string          HTML content, mainly link tags and images.
-        */
-       function displayWorkspaceOverview_commandLinksSub($table,$rec,$origId)  {
-               global $LANG;
-
-               $uid = $rec['uid'];
-               if ($origId || $GLOBALS['BE_USER']->workspace===0)      {
-                       if (!$GLOBALS['BE_USER']->workspaceCannotEditRecord($table,$rec))       {
-                               // Edit
-                               if ($table==='pages')   {
-                                       $actionLinks.=
-                                               '<a href="#" onclick="top.loadEditId('.$uid.');top.goToModule(\''.$this->pageModule.'\'); return false;" title="' . $LANG->getLL('img_title_edit_page') . '">'.
-                                                 t3lib_iconWorks::getSpriteIcon('actions-page-open') .
-                                               '</a>';
-                               } else {
-                                       $params = '&edit['.$table.']['.$uid.']=edit';
-                                       $actionLinks.=
-                                               '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->doc->backPath)).'" title="' . $LANG->getLL('img_title_edit_element') . '">'.
-                                                 t3lib_iconWorks::getSpriteIcon('actions-document-open') .
-                                               '</a>';
-                               }
-                       }
-
-                       // History/Log
-                       $actionLinks.=
-                               '<a href="'.htmlspecialchars($this->doc->backPath.'show_rechis.php?element='.rawurlencode($table.':'.$uid).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'" title="' . $LANG->getLL('img_title_show_log') . '">'.
-                                 t3lib_iconWorks::getSpriteIcon('actions-document-history-open') .
-                               '</a>';
-               }
-
-               // View
-               if ($table==='pages')   {
-                       $actionLinks.=
-                               '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($uid,$this->doc->backPath,t3lib_BEfunc::BEgetRootLine($uid))).'">'.
-                                 t3lib_iconWorks::getSpriteIcon('actions-document-view') .
-                               '</a>';
-               }
-
-               return $actionLinks;
-       }
-
-
-       /**
-        * 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_stageCmd($table,&$rec_off)    {
-               global $LANG;
-
-               switch((int)$rec_off['t3ver_stage'])    {
-                       case 0:
-                               $sId = 1;
-                               $sLabel = $LANG->getLL('stage_editing');
-                               $color = '#666666';     // TODO Use CSS?
-                               $label = $LANG->getLL('label_commentforreviewer');
-                               $titleAttrib = $LANG->getLL('label_sendtoreview');
-                               break;
-                       case 1:
-                               $sId = 10;
-                               $sLabel = $LANG->getLL('label_review');
-                               $color = '#6666cc';     // TODO Use CSS?
-                               $label = $LANG->getLL('label_commentforpublisher');
-                               $titleAttrib = $LANG->getLL('label_approveforpublishing');
-                               break;
-                       case 10:
-                               $sLabel = $LANG->getLL('label_publish');
-                               $color = '#66cc66';     // TODO Use CSS?
-                               break;
-                       case -1:
-                               $sLabel = $this->doc->icons(2).$LANG->getLL('label_rejected');
-                               $sId = 0;
-                               $color = '#ff0000';     // TODO Use CSS?
-                               $label = $LANG->getLL('stage_label_user_comment');
-                               $titleAttrib = $LANG->getLL('label_resetstage');
-                               break;
-                       default:
-                               $sLabel = $LANG->getLL('label_undefined');
-                               $sId = 0;
-                               $color = '';
-                               break;
-               }
-               #debug($sId);
-
-               $raiseOk = !$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table,$rec_off);
-
-               if ($raiseOk && $rec_off['t3ver_stage'] != -1 && $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($sId))      {
-                       $onClick = 'var commentTxt=window.prompt("'.$LANG->getLL('explain_reject').'","");
-                                                       if (commentTxt!=null) {window.location.href="'.$this->doc->issueCommand(
-                       '&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.
-                       '&cmd['.$table.']['.$rec_off['uid'].'][version][stageId]=-1'
-                                                       ).'&cmd['.$table.']['.$rec_off['uid'].'][version][comment]="+escape(commentTxt);}'.
-                       ' return false;';
-                       // Reject:
-                       $actionLinks.=
-                       '<a href="#" onclick="'.htmlspecialchars($onClick).'"title="'.$LANG->getLL('label_reject').'"> '.
-                         t3lib_iconWorks::getSpriteIcon('actions-move-down') .
-                       '</a>';
-               } else {
-                       // Reject:
-                       $actionLinks.=
-                       '<img src="'.$this->doc->backPath.'gfx/clear.gif" width="14" height="14" alt="" align="top" title="" />';
-               }
-
-               // TODO Use CSS?
-               $actionLinks.= '<span style="background-color: '.$color.'; color: white;">'.$sLabel.'</span>';
-
-               // Raise
-               if ($raiseOk && $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($sId))       {
-                       $onClick = 'var commentTxt=window.prompt("'.$label.'","");
-                                                       if (commentTxt!=null) {window.location.href="'.$this->doc->issueCommand(
-                       '&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.
-                       '&cmd['.$table.']['.$rec_off['uid'].'][version][stageId]='.$sId
-                       ).'&cmd['.$table.']['.$rec_off['uid'].'][version][comment]="+escape(commentTxt);}'.
-                       ' return false;';
-                       if ($rec_off['t3ver_stage']!=10)        {
-                               $actionLinks.=
-                               '<a href="#" onclick="'.htmlspecialchars($onClick).'" title="'.htmlspecialchars($titleAttrib).'">'.
-                                 t3lib_iconWorks::getSpriteIcon('actions-move-up') .
-                               '</a>';
-
-                               $this->stageIndex[$sId][$table][] = $rec_off['uid'];
-                       }
-               }
-
-               return $actionLinks;
-       }
-}
-
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.wslib_gui.php'])  {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.wslib_gui.php']);
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/mod/user/ws/clear.gif b/typo3/mod/user/ws/clear.gif
deleted file mode 100755 (executable)
index 9ed1269..0000000
Binary files a/typo3/mod/user/ws/clear.gif and /dev/null differ
diff --git a/typo3/mod/user/ws/cli/conf.php b/typo3/mod/user/ws/cli/conf.php
deleted file mode 100755 (executable)
index e26b992..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-// DO NOT REMOVE OR CHANGE THESE 3 LINES:
-define('TYPO3_MOD_PATH', 'mod/user/ws/cli/');
-$BACK_PATH = '../../../../';
-$MCONF['name'] = '_CLI_user_ws';
-
-?>
\ No newline at end of file
diff --git a/typo3/mod/user/ws/conf.php b/typo3/mod/user/ws/conf.php
deleted file mode 100755 (executable)
index d265c1f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-define('TYPO3_MOD_PATH', 'mod/user/ws/');
-$BACK_PATH='../../../';
-
-$MLANG['default']['tabs_images']['tab'] = 'sys_workspace.gif';
-$MLANG['default']['ll_ref']='LLL:EXT:lang/locallang_mod_user_ws.php';
-
-$MCONF['shy'] = FALSE;
-$MCONF['script'] = 'index.php';
-$MCONF['access']='user,group';
-$MCONF['name']='user_ws';
-?>
\ No newline at end of file
diff --git a/typo3/mod/user/ws/index.php b/typo3/mod/user/ws/index.php
deleted file mode 100755 (executable)
index 8cec38b..0000000
+++ /dev/null
@@ -1,1088 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2010 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.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Module: Workspace manager
- *
- * $Id$
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @author     Dmitry Dulepov <typo3@accio.lv>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *  101: class SC_mod_user_ws_index extends t3lib_SCbase
- *
- *              SECTION: Standard module initialization
- *  128:     function menuConfig()
- *  175:     function init()
- *  233:     function main()
- *  280:     function printContent()
- *
- *              SECTION: Module content: Publish
- *  310:     function moduleContent_publish()
- *  411:     function displayVersionDetails($details)
- *  420:     function displayWorkspaceOverview()
- *
- *              SECTION: Module content: Workspace list
- *  461:     function moduleContent_workspaceList()
- *  476:     function workspaceList_displayUserWorkspaceList()
- *  553:     function workspaceList_getUserWorkspaceList()
- *  592:     function workspaceList_formatWorkspaceData(&$wksp)
- *  634:     function workspaceList_getWebMountPoints(&$wksp)
- *  683:     function workspaceList_getFileMountPoints(&$wksp)
- *  736:     function workspaceList_displayUserWorkspaceListHeader()
- *  756:     function workspaceList_getUserList(&$wksp)
- *  783:     function workspaceList_getUserListForSysWorkspace(&$wksp)
- *  810:     function workspaceList_getUserListWithAccess(&$list, $access)
- *  883:     function workspaceList_displayIcons($currentWorkspace, &$wksp)
- *  931:     function workspaceList_hasEditAccess(&$wksp)
- *  943:     function workspaceList_createFakeWorkspaceRecord($uid)
- *
- * TOTAL FUNCTIONS: 20
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-       // Initialize module:
-unset($MCONF);
-require ('conf.php');
-require ($BACK_PATH.'init.php');
-require ($BACK_PATH.'template.php');
-$BE_USER->modAccess($MCONF,1);
-
-       // Include libraries of various kinds used inside:
-$LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
-$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
-require_once(PATH_typo3.'mod/user/ws/class.wslib.php');
-require_once(PATH_typo3.'mod/user/ws/class.wslib_gui.php');
-
-
-
-
-/**
- * Module: Workspace manager
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage core
- */
-class SC_mod_user_ws_index extends t3lib_SCbase {
-
-               // Default variables for backend modules
-       var $MCONF = array();                           // Module configuration
-       var $MOD_MENU = array();                        // Module menu items
-       var $MOD_SETTINGS = array();            // Module session settings
-
-       /**
-        * Document Template Object
-        *
-        * @var noDoc
-        */
-       var $doc;
-       var $content;                                           // Accumulated content
-
-
-               // Internal:
-       var $publishAccess = FALSE;
-       var $be_user_Array = array();
-       var $be_user_Array_full = array();      // not blinded, used by workspace listing
-       protected $showDraftWorkspace = FALSE;  // Determines whether the draft workspace is shown
-
-
-       /*********************************
-        *
-        * Standard module initialization
-        *
-        *********************************/
-
-       /**
-        * Initialize menu configuration
-        *
-        * @return      void
-        */
-       function menuConfig()   {
-               global  $LANG;
-
-                       // fetches the configuration of the version extension
-               $versionExtconf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['version']);
-                       // show draft workspace only if enabled in the version extensions config
-               if($versionExtconf['showDraftWorkspace']) {
-                       $this->showDraftWorkspace = TRUE;
-               }
-
-                       // Menu items:
-               $this->MOD_MENU = array(
-                       'function' => array(
-                               'publish' => $LANG->getLL('menuitem_review'),
-                               'workspaces' => $LANG->getLL('menuitem_workspaces'),
-                       ),
-                       'filter' => array(
-                               1 => $LANG->getLL('filter_drafts'),
-                               2 => $LANG->getLL('filter_archive'),
-                               0 => $LANG->getLL('filter_all'),
-                       ),
-                       'display' => array(
-                               0 => '['.$LANG->getLL('shortcut_onlineWS').']',
-                               -98 => $LANG->getLL('label_offlineWSes'),
-                               -99 => $LANG->getLL('label_allWSes')
-                       ),
-                       'diff' => array(
-                               0 => $LANG->getLL('diff_no_diff'),
-                               1 => $LANG->getLL('diff_show_inline'),
-                               2 => $LANG->getLL('diff_show_popup'),
-                       ),
-                       'expandSubElements' => '',
-               );
-
-               if($this->showDraftWorkspace === TRUE) {
-                       $this->MOD_MENU['display'][-1] = '[' . $LANG->getLL('shortcut_offlineWS') . ']';
-               }
-                       // Add workspaces:
-               if ($GLOBALS['BE_USER']->workspace===0) {       // Spend time on this only in online workspace because it might take time:
-                       $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers','sys_workspace','pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'),'','title');
-                       foreach($workspaces as $rec)    {
-                               if ($GLOBALS['BE_USER']->checkWorkspace($rec))  {
-                                       $this->MOD_MENU['display'][$rec['uid']] = '[' . $rec['uid'] . '] ' . htmlspecialchars($rec['title']);
-                               }
-                       }
-               }
-
-                       // CLEANSE SETTINGS
-               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name'], 'ses');
-       }
-
-       /**
-        * Executes action for selected elements, if any is sent:
-        */
-       function execute()      {
-               $post = t3lib_div::_POST();
-
-#              debug($post);
-
-               if ($post['_with_selected_do']) {
-                       if (is_array($post['items']) && count($post['items']))  {
-                               $cmdArray = array();
-
-                               foreach($post['items'] as $item => $v)  {
-                                       list($table,$uid) = explode(':',$item,2);
-
-                                       if ($GLOBALS['TCA'][$table] && t3lib_div::testInt($uid))        {
-                                               switch($post['_with_selected_do'])      {
-                                                       case "stage_-1":
-                                                               $cmdArray[$table][$uid]['version']['action'] = 'setStage';
-                                                               $cmdArray[$table][$uid]['version']['stageId'] = -1;
-                                                       break;
-                                                       case "stage_0":
-                                                               $cmdArray[$table][$uid]['version']['action'] = 'setStage';
-                                                               $cmdArray[$table][$uid]['version']['stageId'] = 0;
-                                                       break;
-                                                       case "stage_1":
-                                                               $cmdArray[$table][$uid]['version']['action'] = 'setStage';
-                                                               $cmdArray[$table][$uid]['version']['stageId'] = 1;
-                                                       break;
-                                                       case "stage_10":
-                                                               $cmdArray[$table][$uid]['version']['action'] = 'setStage';
-                                                               $cmdArray[$table][$uid]['version']['stageId'] = 10;
-                                                       break;
-                                                       case "publish":
-                                                               if ($onlineRec = t3lib_BEfunc::getLiveVersionOfRecord($table,$uid,'uid'))       {
-                                                                       $cmdArray[$table][$onlineRec['uid']]['version']['action'] = 'swap';
-                                                                       $cmdArray[$table][$onlineRec['uid']]['version']['swapWith'] = $uid;
-                                                               }
-                                                       break;
-                                                       case "swap":
-                                                       if ($onlineRec = t3lib_BEfunc::getLiveVersionOfRecord($table,$uid,'uid'))       {
-                                                               $cmdArray[$table][$onlineRec['uid']]['version']['action'] = 'swap';
-                                                               $cmdArray[$table][$onlineRec['uid']]['version']['swapWith'] = $uid;
-                                                               $cmdArray[$table][$onlineRec['uid']]['version']['swapIntoWS'] = 1;
-                                                       }
-                                                       break;
-                                                       case "release":
-                                                               $cmdArray[$table][$uid]['version']['action'] = 'clearWSID';
-                                                       break;
-                                                       case "flush":
-                                                               $cmdArray[$table][$uid]['version']['action'] = 'flush';
-                                                       break;
-                                               }
-                                       }
-                               }
-
-               #               debug($cmdArray);
-
-                               $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                               $tce->stripslashes_values = 0;
-                               $tce->start(array(), $cmdArray);
-                               $tce->process_cmdmap();
-                       }
-               }
-       }
-
-       /**
-        * Standard init function of a module.
-        *
-        * @return      void
-        */
-       function init() {
-               global $BACK_PATH, $BE_USER;
-
-                       // Setting module configuration:
-               $this->MCONF = $GLOBALS['MCONF'];
-
-                       // Initialize Document Template object:
-               $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->backPath = $BACK_PATH;
-               $this->doc->setModuleTemplate('templates/ws.html');
-
-                       // JavaScript
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-                       script_ended = 0;
-                       function jumpToUrl(URL) {       //
-                               window.location.href = URL;
-                       }
-
-                       function expandCollapse(rowNumber) {
-                               elementId = "wl_" + rowNumber;
-                               element = document.getElementById(elementId);
-                               image = document.getElementById("spanw1_" + rowNumber);
-                               if (element.style)      {
-                                       if (element.style.display == "none")    {
-                                               element.style.display = "table-row";
-                                               image.className = "t3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-table-collapse";
-                                       } else {
-                                               element.style.display = "none";
-                                               image.className = "t3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-table-expand";
-                                       }
-                               }
-                       }
-               ');
-               $this->doc->form = '<form action="index.php" method="post" name="pageform">';
-
-                       // Setting up the context sensitive menu:
-               $this->doc->getContextMenuCode();
-
-                       // Add JS for dynamic tabs:
-               $this->doc->JScode.= $this->doc->getDynTabMenuJScode();
-
-                       // Setting publish access permission for workspace:
-               $this->publishAccess = $BE_USER->workspacePublishAccess($BE_USER->workspace);
-
-                       // Parent initialization:
-               parent::init();
-       }
-
-       /**
-        * Main function for Workspace Manager module.
-        *
-        * @return      void
-        */
-       function main() {
-               global $LANG, $BE_USER, $BACK_PATH;
-
-               // See if we need to switch workspace
-               $changeWorkspace = t3lib_div::_GET('changeWorkspace');
-               if ($changeWorkspace != '') {
-                       $BE_USER->setWorkspace($changeWorkspace);
-                       $this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . t3lib_BEfunc::getBackendScript() . '";');
-               } else {
-                               // Starting page:
-                       $this->content.=$this->doc->header($LANG->getLL('title'));
-                       $this->content.=$this->doc->spacer(5);
-
-                       // Get usernames and groupnames
-                       $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
-                       $groupArray = array_keys($be_group_Array);
-                       // Need 'admin' field for t3lib_iconWorks::getIconImage()
-                       $this->be_user_Array_full = $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');
-                       if (!$GLOBALS['BE_USER']->isAdmin()) {
-                               $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array,$groupArray,1);
-                       }
-
-                       // Build top menu:
-                       $menuItems = array();
-                       $menuItems[] = array(
-                               'label' => $LANG->getLL('menuitem_review'),
-                               'content' => $this->moduleContent_publish()
-                       );
-                       $menuItems[] = array(
-                               'label' => $LANG->getLL('menuitem_workspaces'),
-                               'content' => $this->moduleContent_workspaceList()
-                       );
-
-                               // Add hidden fields and create tabs:
-                       $content = $this->doc->getDynTabMenu($menuItems,'user_ws');
-                       $this->content.=$this->doc->section('',$content,0,1);
-
-                               // Setting up the buttons and markers for docheader
-                       $docHeaderButtons = $this->getButtons();
-                       // $markers['CSH'] = $docHeaderButtons['csh'];
-
-               }
-               $markers['CONTENT'] = $this->content;
-
-                       // Build the <body> for the module
-               $this->content = $this->doc->startPage($LANG->getLL('title'));
-               $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
-               $this->content.= $this->doc->endPage();
-               $this->content = $this->doc->insertStylesAndJS($this->content);
-
-       }
-
-       /**
-        * Print module content. Called as last thing in the global scope.
-        *
-        * @return      void
-        */
-       function printContent() {
-               echo $this->content;
-       }
-
-       /**
-        * Create the panel of buttons for submitting the form or otherwise perform operations.
-        *
-        * @return      array   all available buttons as an assoc. array
-        */
-       protected function getButtons() {
-               global $LANG, $BACK_PATH;
-
-               $buttons = array(
-                       'new_record' => '',
-               );
-
-               $newWkspUrl = 'workspaceforms.php?action=new';
-
-                       // workspace creation link
-               if ($GLOBALS['BE_USER']->isAdmin() || 0 != ($GLOBALS['BE_USER']->groupData['workspace_perms'] & 4))     {
-                       $buttons['new_record'] = '<a href="' . $newWkspUrl . '">' .
-                                               '<img ' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/add_workspaces.gif') . ' alt="' . $LANG->getLL('img_title_create_new_workspace') . '" id="ver-wl-new-workspace-icon" />' .
-                                               '</a>';
-               }
-               return $buttons;
-       }
-
-
-
-
-
-
-
-
-
-
-
-       /*********************************
-        *
-        * Module content: Publish
-        *
-        *********************************/
-
-       /**
-        * Rendering the content for the publish and review panel in the workspace manager
-        *
-        * @return      string          HTML content
-        */
-       function moduleContent_publish()        {
-               global  $LANG;
-
-                       // Initialize:
-               $content = '';
-               $details = t3lib_div::_GP('details');
-
-                       // Create additional menus:
-               $menu = '';
-               if ($GLOBALS['BE_USER']->workspace===0) {
-                       $menu.= t3lib_BEfunc::getFuncMenu(0,'SET[filter]',$this->MOD_SETTINGS['filter'],$this->MOD_MENU['filter']);
-                       $menu.= t3lib_BEfunc::getFuncMenu(0,'SET[display]',$this->MOD_SETTINGS['display'],$this->MOD_MENU['display']);
-               }
-               $menu.= t3lib_BEfunc::getFuncMenu(0,'SET[diff]',$this->MOD_SETTINGS['diff'],$this->MOD_MENU['diff']);
-               if ($GLOBALS['BE_USER']->workspace!==0) {
-                       $menu.= t3lib_BEfunc::getFuncCheck(0,'SET[expandSubElements]',$this->MOD_SETTINGS['expandSubElements'],'','','id="checkExpandSubElements"').' <label for="checkExpandSubElements">'.$LANG->getLL('label_showsubelements').'</label> ';
-               }
-
-                       // Create header:
-               $title = '';
-               $description = '';
-               switch($GLOBALS['BE_USER']->workspace)  {
-                       case 0:
-                               $title = t3lib_iconWorks::getIconImage('sys_workspace', array(), $this->doc->backPath, ' align="top"').'['.$LANG->getLL('shortcut_onlineWS').']';
-                               $description = $LANG->getLL('workspace_description_live');
-                       break;
-                       case -1:
-                               $title = t3lib_iconWorks::getIconImage('sys_workspace', array(), $this->doc->backPath, ' align="top"').'['.$LANG->getLL('shortcut_offlineWS').']';
-                               $description = $LANG->getLL('workspace_description_draft');
-                       break;
-                       case -99:
-                               $title = $this->doc->icons(3).'[' . $LANG->getLL('shortcut_noWSfound') . ']';
-                               $description = $LANG->getLL('workspace_description_no_access');
-                       break;
-                       default:
-                               $title = t3lib_iconWorks::getIconImage('sys_workspace', $GLOBALS['BE_USER']->workspaceRec, $this->doc->backPath, ' align="top"').
-                                                       '['.$GLOBALS['BE_USER']->workspace.'] '.t3lib_BEfunc::getRecordTitle('sys_workspace',$GLOBALS['BE_USER']->workspaceRec,TRUE);
-                               $description = ($GLOBALS['BE_USER']->workspaceRec['description'] ? htmlspecialchars($GLOBALS['BE_USER']->workspaceRec['description']) : '<em>[' . $LANG->getLL('shortcut_noWSfound') . ']</em>');
-                       break;
-               }
-
-                       // Buttons for publish / swap:
-               $actionLinks = '';
-               if ($GLOBALS['BE_USER']->workspace!==0) {
-                       if ($this->publishAccess)       {
-                               $confirmation = $LANG->JScharCode($LANG->getLL(($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1) ? 'submit_publish_workspace_confirmation_1' :  'submit_publish_workspace_confirmation_2'));
-                               $actionLinks.= '<input type="submit" name="_publish" value="' . $LANG->getLL('submit_publish_workspace') . '" onclick="if (confirm(' . $confirmation . ')) window.location.href=\'publish.php?swap=0\';return false"/>';
-                               if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
-                                       $confirmation = $LANG->JScharCode($LANG->getLL(($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1) ? 'submit_swap_workspace_confirmation_1' :  'submit_swap_workspace_confirmation_2'));
-                                       $actionLinks.= '<input type="submit" name="_swap" value="' . $LANG->getLL('submit_swap_workspace') . '" onclick="if (confirm(' . $confirmation . ')) window.location.href=\'publish.php?swap=1\';return false ;" />';
-                               }
-                       } else {
-                               $actionLinks.= $this->doc->icons(1) . $LANG->getLL('no_publish_permission');
-                       }
-
-                               // Preview of workspace link
-                       if (t3lib_div::_POST('_previewLink'))   {
-                               $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours'));
-                               $ttlHours = ($ttlHours ? $ttlHours : 24*2);
-                               $previewUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.t3lib_BEfunc::compilePreviewKeyword('', $GLOBALS['BE_USER']->user['uid'],60*60*$ttlHours,$GLOBALS['BE_USER']->workspace).'&id='.intval($GLOBALS['BE_USER']->workspaceRec['db_mountpoints']);
-                               $actionLinks.= '<br />Any user can browse the workspace frontend using this link for the next ' . $ttlHours . ' hours (does not require backend login):<br /><br /><a target="_blank" href="' . htmlspecialchars($previewUrl) . '">' . $previewUrl . '</a>';
-                       } else {
-                               $actionLinks.= '<input type="submit" name="_previewLink" value="Generate Workspace Preview Link" />';
-                       }
-               }
-
-               $wsAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspaceRec);
-
-                       // Add header to content variable:
-               $content = '
-               <table border="0" cellpadding="0" cellspacing="0" id="t3-user-ws-wsinfotable" class="t3-table t3-table-info">
-                       <tr>
-                               <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_workspace') . '&nbsp;</th>
-                               <td nowrap="nowrap">' . $title . '</td>
-                       </tr>
-                       <tr>
-                               <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_description') . '&nbsp;</td>
-                               <td>' . $description . '</td>
-                       </tr>'.($GLOBALS['BE_USER']->workspace!=-99 && !$details ? '
-                       <tr>
-                               <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_options') . '&nbsp;</td>
-                               <td>' . $menu . $actionLinks . '</td>
-                       </tr>
-                       <tr>
-                               <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_status') . '&nbsp;</td>
-                               <td>' . $LANG->getLL('label_access_level') . ' ' . $GLOBALS['LANG']->getLL('workspace_list_access_' . $wsAccess['_ACCESS']) . '</td>
-                       </tr>' : '').'
-               </table>
-               <br />
-               ';
-
-                       // Add publishing and review overview:
-               if ($GLOBALS['BE_USER']->workspace!=-99)        {
-                       if ($details)   {
-                               $content.= $this->displayVersionDetails($details);
-                       } else {
-                               $content.= $this->displayWorkspaceOverview();
-                       }
-                       $content .= '<br />';
-               }
-
-                       // Return content:
-               return $content;
-       }
-
-       /**
-        * Display details for a single version from workspace
-        *
-        * @param       string          Version identification, made of table and uid
-        * @return      string          HTML string
-        */
-       function displayVersionDetails($details)        {
-               return 'TODO: Show details for version "'.$details.'"<hr/><a href="index.php">BACK</a>';
-       }
-
-       /**
-        * Rendering the overview of versions in the current workspace
-        *
-        * @return      string          HTML (table)
-        */
-       function displayWorkspaceOverview()     {
-
-                       // Initialize Workspace ID and filter-value:
-               if ($GLOBALS['BE_USER']->workspace===0) {
-                       $wsid = $this->MOD_SETTINGS['display'];         // Set wsid to the value from the menu (displaying content of other workspaces)
-                       $filter = $this->MOD_SETTINGS['filter'];
-               } else {
-                       $wsid = $GLOBALS['BE_USER']->workspace;
-                       $filter = 0;
-               }
-
-                       // Instantiate workspace GUI library and generate workspace overview
-               $wslibGuiObj = t3lib_div::makeInstance('wslib_gui');
-               $wslibGuiObj->diff = $this->MOD_SETTINGS['diff'];
-               $wslibGuiObj->expandSubElements = $this->MOD_SETTINGS['expandSubElements'];
-               $wslibGuiObj->alwaysDisplayHeader = true;
-               return $wslibGuiObj->getWorkspaceOverview($this->doc, $wsid, $filter);
-       }
-
-
-
-
-
-
-
-
-
-
-
-
-
-       /********************************
-        *
-        * Module content: Workspace list
-        *
-        ********************************/
-
-       /**
-        * Rendering of the workspace list
-        *
-        * @return      string          HTML
-        */
-       function moduleContent_workspaceList()  {
-               // Original Kasper's TODO: Workspace listing
-               //
-               //      - LISTING: Shows list of available workspaces for user. Used can see title, description, publication time, freeze-state, db-mount, member users/groups etc. Current workspace is indicated.
-               //      - SWITCHING: Switching between available workspaces is done by a button shown for each in the list
-               //      - ADMIN: Administrator of a workspace can click an edit-button linking to a form where he can edit the workspace. Users and groups should be selected based on some filtering so he cannot select groups he is not a member off himself (or some other rule... like for permission display with blinded users/groups)
-               //      - CREATE: If allowed, the user can create a new workspace which brings up a form where he can enter basic data. This is saved by a local instance of tcemain with forced admin-rights (creation in pid=0!).
-               return $this->workspaceList_displayUserWorkspaceList();
-       }
-
-       /**
-        * Generates HTML to display a list of workspaces.
-        *
-        * @return      string          Generated HTML code
-        */
-       function workspaceList_displayUserWorkspaceList()       {
-               global  $BACK_PATH, $LANG;
-
-                       // table header
-               $content = $this->workspaceList_displayUserWorkspaceListHeader();
-
-                       // get & walk workspace list generating content
-               $wkspList = $this->workspaceList_getUserWorkspaceList();
-               $rowNum = 1;
-               foreach ($wkspList as $wksp)    {
-                       $currentWksp = ($GLOBALS['BE_USER']->workspace == $wksp['uid']);
-
-                       // Each workspace data occupies two rows:
-                       // (1) Folding + Icons + Title + Description
-                       // (2) Information about workspace (initially hidden)
-
-                       $cssClass = ($currentWksp ? 't3-row t3-row-active bgColor3' : 't3-row bgColor4');
-                               // Start first row
-                       $content .= '<tr class="' . $cssClass . '">';
-
-                               // row #1, column #1: expand icon
-                       $content .= '<td>' .
-                                               '<a href="javascript:expandCollapse(' . $rowNum . ')">' .
-                                               t3lib_iconWorks::getSpriteIcon('actions-view-table-expand', array(
-                                                       'title' => $LANG->getLL('img_title_show_more'),
-                                                       'id' => 'spanw1_' . $rowNum
-                                               )) .
-                                               '</a></td>';
-
-                               // row #1, column #2: icon panel
-                       $content .= '<td nowrap="nowrap">';     // Mozilla Firefox will attempt wrap due to `width="1"` on topmost column
-                       $content .= $this->workspaceList_displayIcons($currentWksp, $wksp);
-                       $content .= '</td>';
-
-                               // row #1, column #3: current workspace indicator
-                       $content .= '<td nowrap="nowrap" style="text-align: center">';  // Mozilla Firefox will attempt wrap due to `width="1"` on topmost column
-                       $content .= (!$currentWksp ? '&nbsp;' : '<img ' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/icon_ok.gif', 'width="18" height="16"') . ' id="wl_' . $rowNum . 'i" border="0" hspace="1" alt="' . $LANG->getLL('img_title_current_workspace') . '" />');
-                       $content .= '</td>';
-
-                               // row #1, column #4 and 5: title and description
-                       $content .= '<td nowrap="nowrap">' . htmlspecialchars($wksp['title']) . '</td>' .
-                                               '<td>' . nl2br(htmlspecialchars($wksp['description'])) . '</td>';
-                       $content .= '</tr>';
-
-                               // row #2, column #1 and #2
-                       $content .= '<tr id="wl_' . $rowNum . '" class="bgColor" style="display: none">';
-                       $content .= '<td colspan="2" style="border-right: none;">&nbsp;</td>';
-
-                               // row #2, column #3, #4 and #4
-                       $content .= '<td colspan="3" style="border-left: none;">' .
-                                               $this->workspaceList_formatWorkspaceData($wksp) .
-                                               '</td>';
-
-                       $content .= '</tr>';
-                       $rowNum++;
-               }
-               $content .= '</table>';
-
-               return $content;
-       }
-
-
-
-
-
-       /**
-        * Retrieves a list of workspaces where user has access.
-        *
-        * @return      array           A list of workspaces available to the current BE user
-        */
-       function workspaceList_getUserWorkspaceList()   {
-
-                       // Get list of all workspaces. Note: system workspaces will be always displayed before custom ones!
-               $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','sys_workspace','pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'),'','title');
-               $availableWorkspaces = array();
-
-                       // Live
-               $wksp = $this->workspaceList_createFakeWorkspaceRecord(0);
-               $wksp = $GLOBALS['BE_USER']->checkWorkspace($wksp);
-               if (false !== $wksp) {
-                       $availableWorkspaces[] = $wksp;
-               }
-
-                       // Draft
-               $wksp = $this->workspaceList_createFakeWorkspaceRecord(-1);
-               $wksp = $GLOBALS['BE_USER']->checkWorkspace($wksp);
-               if (false !== $wksp) {
-                       $availableWorkspaces[] = $wksp;
-               }
-
-                       // Custom
-               foreach($workspaces as $rec)    {
-                               // see if user can access this workspace in any way
-                       if (false !== ($result = $GLOBALS['BE_USER']->checkWorkspace($rec)))    {
-                               $availableWorkspaces[] = $result;       // `$result` contains `$rec` plus access type through '_ACCESS' key
-                       }
-               }
-               return $availableWorkspaces;
-       }
-
-       /**
-        * Create inner information panel for workspace list. This panel is
-        * initially hidden and becomes visible when user click on the expand
-        * icon on the very left of workspace list against the workspace he
-        * wants to explore.
-        *
-        * @param       array           Workspace information
-        * @return      string          Formatted workspace information
-        */
-       function workspaceList_formatWorkspaceData(&$wksp)      {
-               global $LANG;
-
-               $content = '<table cellspacing="0" cellpadding="0" width="100%" class="ver-wl-details-table">' .
-                               '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_file_mountpoints') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . $this->workspaceList_getFileMountPoints($wksp) . '</td></tr>' .
-                               '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_db_mountpoints') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . $this->workspaceList_getWebMountPoints($wksp) . '</td></tr>';
-               if ($wksp['uid'] > 0) {
-                       // Displaying information below makes sence only for custom workspaces
-                       $content .=
-                               '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_frozen') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . $LANG->getLL($wksp['freeze'] ? 'workspace_list_label_frozen_yes' : 'workspace_list_label_frozen_no') . '</td></tr>' .
-                               '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_publish_date') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . ($wksp['publish_time'] == 0 ? '&nbsp;&ndash;' : t3lib_BEfunc::datetime($wksp['publish_time'])) . '</td></tr>' .
-                               '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_unpublish_date') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . ($wksp['unpublish_time'] == 0 ? '&nbsp;&ndash;' : t3lib_BEfunc::datetime($wksp['unpublish_time'])) . '</td></tr>' .
-                               '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_your_access') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . $LANG->getLL('workspace_list_access_' . $wksp['_ACCESS']) . '</td></tr>' .
-                               '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_workspace_users') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . $this->workspaceList_getUserList($wksp) . '</td></tr>';
-               }
-               else if ($GLOBALS['BE_USER']->isAdmin()) {
-                       // show users for draft/live workspace only to admin users
-                       $content .=     '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_workspace_users') . '</strong></td>' .
-                               '<td class="ver-wl-details">' . $this->workspaceList_getUserList($wksp) . '</td></tr>';
-               }
-               $content .= '</table>';
-
-               return $content;
-       }
-
-
-
-
-
-       /**
-        * Retrieves and formats database mount points lists.
-        *
-        * @param       array           &$wksp  Workspace record
-        * @return      string          Generated HTML
-        */
-       function workspaceList_getWebMountPoints(&$wksp)        {
-               if ($wksp['uid'] <= 0) {
-                       // system workspaces
-                       return $GLOBALS['LANG']->getLL($wksp['uid'] == 0 ? 'workspace_list_db_mount_point_live' : 'workspace_list_db_mount_point_draft');
-               }
-
-               // here only if obtaining mount points for custom workspaces
-
-               // Warning: all fields needed for t3lib_iconWorks::getIconImage()!
-               $MPs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'pages', 'deleted=0 AND uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($wksp['db_mountpoints']) . ')', '', 'title');
-               $content_array = array();
-               if (count($MPs) > 0)    {
-                       $isAdmin = $GLOBALS['BE_USER']->isAdmin();
-                       if (!$isAdmin) {
-                               // We need to fetch user's mount point list (including MPS mounted from groups).
-                               // This list must not be affects by current user's workspace. It means we cannot use
-                               // $BE_USER->isInWebMount() to check mount points.
-                               $userMPs = explode(',', $GLOBALS['BE_USER']->dataLists['webmount_list']); // includes group data if necessary!
-                       }
-                       foreach ($MPs as $mp)   {
-                               if (!$isAdmin && !in_array($mp['uid'], $userMPs)) {
-                                       // Show warning icon
-                                       $title = $GLOBALS['LANG']->getLL('workspace_list_mount_point_inaccessible');
-                                       $str = t3lib_iconWorks::getSpriteIcon('status-warning');
-                                       $classAttr = 'class="ver-wl-mp-inacessible" ';
-                               }
-                               else {
-                                       // normal icon
-                                       $str = t3lib_iconWorks::getIconImage('pages', $mp, $GLOBALS['BACK_PATH'], ' align="absmiddle"');
-                                       $classAttr = '';
-                               }
-                               // Will show UID on hover. Just convinient to user.
-                               $content_array[] = $str . '<span ' . $classAttr . 'title="UID: ' . $mp['uid'] . '">' . $mp['title'] . '</span>';
-                       }
-               }
-               if (count($content_array) > 0) {
-                       return implode('<br />', $content_array);
-               }
-               // no mount points
-               return $GLOBALS['LANG']->getLL('workspace_list_db_mount_point_custom');
-       }
-
-       /**
-        * Retrieves and formats file mount points lists.
-        *
-        * @param       array           &$wksp  Workspace record
-        * @return      string          Generated HTML
-        */
-       function workspaceList_getFileMountPoints(&$wksp)       {
-               if ($wksp['uid'] == -1) {
-                       // draft workspace - none!
-                       return $GLOBALS['LANG']->getLL('workspace_list_file_mount_point_draft');
-               }
-               else if ($wksp['uid'] == 0) {
-                       // live workspace
-                       return $GLOBALS['LANG']->getLL('workspace_list_file_mount_point_live');
-               }
-
-               // Here if displaying information for custom workspace
-
-               // Warning: all fields needed for t3lib_iconWorks::getIconImage()!
-               $MPs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_filemounts', 'deleted=0 AND hidden=0 AND uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($wksp['file_mountpoints']) . ')', '', 'title');
-               if (count($MPs) != 0)   {
-                       // Has mount points
-                       $isAdmin = $GLOBALS['BE_USER']->isAdmin();
-                       if (!$isAdmin) {
-                               // We need to fetch user's mount point list (including MPS mounted from groups).
-                               // This list must not be affects by current user's workspace. It means we cannot use
-                               // $BE_USER->isInWebMount() to check mount points.
-                               $userMPs = explode(',', $GLOBALS['BE_USER']->dataLists['filemount_list']); // includes group data if necessary!
-                       }
-                       foreach ($MPs as $mp)   {
-                               if (!$isAdmin && !in_array($mp['uid'], $userMPs)) {
-                                       // Show warning icon
-                                       $title = $GLOBALS['LANG']->getLL('workspace_list_mount_point_inaccessible');
-                                       $str = t3lib_iconWorks::getSpriteIcon('status-warning');
-                                       $classAttr = 'class="ver-wl-mp-inacessible" ';
-                               }
-                               else {
-                                       // normal icon
-                                       $str = t3lib_iconWorks::getIconImage('sys_filemounts', $mp, $GLOBALS['BACK_PATH'], ' align="absmiddle"');
-                                       $classAttr = '';
-                               }
-                               // Will show UID on hover. Just convinient to user.
-                               $content_array[] = $str . '<span ' . $classAttr . 'title="UID: ' . $mp['uid'] . '">' . $mp['title'] . '</span>';
-                       }
-               }
-               if (count($content_array) > 0) {
-                       return implode('<br />', $content_array);
-               }
-               // No file mount points
-               return $GLOBALS['LANG']->getLL('workspace_list_file_mount_point_custom');
-       }
-
-       /**
-        * Creates a header for the workspace list table. This function only makes
-        * <code>workspaceList_displayUserWorkspaceList()</code> smaller.
-        *
-        * @return      string          Generated content
-        */
-       function workspaceList_displayUserWorkspaceListHeader() {
-               global  $LANG;
-               // TODO CSH lables?
-               return '<table border="0" cellpadding="0" cellspacing="0" class="workspace-overview">
-                       <tr class="t3-row-header">
-                               <td width="1">&nbsp;</td>
-                               <td width="1">&nbsp;</td>
-                               <td nowrap="nowrap">' . $LANG->getLL('workspace_list_label_current_workspace') . '</td>
-                               <td nowrap="nowrap">' . $LANG->getLL('workspace_list_label_workspace_title') . '</td>
-                               <td nowrap="nowrap">' . $LANG->getLL('workspace_list_label_workspace_description') . '</td>
-                       </tr>';
-       }
-
-
-       /**
-        * Generates a list of <code>&lt;option&gt;</code> tags with user names.
-        *
-        * @param       array           Workspace record
-        * @return      string          Generated content
-        */
-       function workspaceList_getUserList(&$wksp) {
-               global  $LANG;
-
-               if ($wksp['uid'] > 0) {
-                       // custom workspaces
-                       $content = $this->workspaceList_getUserListWithAccess($wksp['adminusers'], $LANG->getLL('workspace_list_label_owners')); // owners
-                       $content .= $this->workspaceList_getUserListWithAccess($wksp['members'], $LANG->getLL('workspace_list_label_members')); // members
-                       $content .= $this->workspaceList_getUserListWithAccess($wksp['reviewers'], $LANG->getLL('workspace_list_label_reviewers')); // reviewers
-                       if ($content != '')     {
-                               $content = '<table cellpadding="0" cellspacing="1" width="100%" class="lrPadding workspace-overview">' . $content . '</table>';
-                       } else {
-                               $content = $LANG->getLL($wksp['uid'] > 0 ? 'workspace_list_access_admins_only' : 'workspace_list_access_anyone');
-                       }
-               }
-               else {
-                       // live and draft workspace
-                       $content = $this->workspaceList_getUserListForSysWorkspace($wksp);
-               }
-               return $content;
-       }
-
-       /**
-        * Generates a list of user names that has access to the system workspace.
-        *
-        * @param       array           &$wksp  Workspace record
-        * @return      string          Generated content
-        */
-       function workspaceList_getUserListForSysWorkspace(&$wksp) {
-               $option = ($wksp['uid'] == 0 ? 1 : 2);
-               $content_array = array();
-               foreach ($this->be_user_Array_full as $uid => $user) {
-                       if ($user['admin'] != 0 || 0 != ($user['workspace_perms'] & $option)) {
-                               if ($uid == $GLOBALS['BE_USER']->user['uid']) {
-                                       // highlight current user
-                                       $tag0 = '<span class="ver-wl-current-user">';
-                                       $tag1 = '</span>';
-                               }
-                               else {
-                                       $tag0 = $tag1 = '';
-                               }
-                               $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage('be_users', $uid, $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $uid . '"'), 'be_users', $uid, 2).
-                                       $tag0 . htmlspecialchars($user['username']) . $tag1;
-                       }
-               }
-               return implode('<br />', $content_array);
-       }
-
-       /**
-        * Generates a list of user names that has access to the workspace.
-        *
-        * @param       array           A list of user IDs separated by comma
-        * @param       string          Access string
-        * @return      string          Generated content
-        */
-       function workspaceList_getUserListWithAccess(&$list, $access)   {
-               $content_array = array();
-               if ($list != '')        {
-                       $userIDs = explode(',', $list);
-
-                               // get user names and sort
-                       $regExp = '/^(be_[^_]+)_(\d+)$/';
-                       $groups = false;
-                       foreach ($userIDs as $userUID)  {
-                               $id = $userUID;
-
-                               if (preg_match($regExp, $userUID)) {
-                                       $table = preg_replace($regExp, '\1', $userUID);
-                                       $id = intval(preg_replace($regExp, '\2', $userUID));
-                                       if ($table == 'be_users') {
-                                               // user
-                                               $icon = $GLOBALS['TCA']['be_users']['typeicons'][$this->be_user_Array[$id]['admin']];
-                                               if ($id == $GLOBALS['BE_USER']->user['uid']) {
-                                                       // highlight current user
-                                                       $tag0 = '<span class="ver-wl-current-user">';
-                                                       $tag1 = '</span>';
-                                               }
-                                               else {
-                                                       $tag0 = $tag1 = '';
-                                               }
-                                               $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage($table, $this->be_user_Array[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"'), $table, $id, 2) .
-                                                                                       $tag0 . htmlspecialchars($this->be_user_Array_full[$id]['username']) . $tag1;
-                                       }
-                                       else {
-                                               // group
-                                               if (false === $groups) {
-                                                       $groups = t3lib_BEfunc::getGroupNames();
-                                               }
-                                               $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage($table, $groups[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"'), $table, $id, 2) .
-                                                                                       $groups[$id]['title'];
-                                       }
-                               }
-                               else {
-                                       // user id
-                                       if ($userUID == $GLOBALS['BE_USER']->user['uid']) {
-                                               // highlight current user
-                                               $tag0 = '<span class="ver-wl-current-user">';
-                                               $tag1 = '</span>';
-                                       }
-                                       else {
-                                               $tag0 = $tag1 = '';
-                                       }
-                                       $content_array[] = t3lib_iconWorks::getIconImage('be_users', $this->be_user_Array[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"') .
-                                                                               $tag0 . htmlspecialchars($this->be_user_Array_full[$userUID]['username']) . $tag1;
-                               }
-                       }
-                       sort($content_array);
-               }
-               else {
-                       $content_array[] = '&nbsp;&ndash;';
-               }
-
-               $content = '<tr><td class="ver-wl-details-label ver-wl-details-user-list-label">';
-               // TODO CSH lable explaining access here?
-               $content .= '<strong>' . $access . '</strong></td>';
-               $content .= '<td class="ver-wl-details">' . implode('<br />', $content_array) . '</td></tr>';
-               return $content;
-       }
-
-
-
-       /**
-        * Creates a list of icons for workspace.
-        *
-        * @param       boolean         <code>true</code> if current workspace
-        * @param       array           Workspace record
-        * @return      string          Generated content
-        */
-       function workspaceList_displayIcons($currentWorkspace, &$wksp)  {
-               global  $BACK_PATH, $LANG;
-
-               $content = '';
-                       // `edit workspace` button
-               if ($this->workspaceList_hasEditAccess($wksp))  {
-                               // User can modify workspace parameters, display corresponding link and icon
-                       $editUrl = 'workspaceforms.php?action=edit&amp;wkspId=' . $wksp['uid'];
-
-                       $content .= '<a href="' . $editUrl . '" title="'. $LANG->getLL('workspace_list_icon_title_edit_workspace') .'"/>' .
-                                       t3lib_iconWorks::getSpriteIcon('actions-document-open') .
-                       '</a>';
-               } else {
-                               // User can NOT modify workspace parameters, display space
-                               // Get only withdth and height from skinning API
-                       $content .= '<img src="clear.gif" ' .
-                                       t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/edit2.gif', 'width="11" height="12"', 2) .
-                                       ' border="0" alt="" hspace="1" align="middle" />';
-               }
-                       // `switch workspace` button
-               if (!$currentWorkspace) {
-                               // Workspace switching button
-                       $content .= '<a href="' .
-                                       t3lib_div::getIndpEnv('SCRIPT_NAME') .
-                                       '?changeWorkspace=' . $wksp['uid'] . '" title="'. $LANG->getLL('workspace_list_icon_title_switch_workspace') . '"/>' .
-                                       t3lib_iconWorks::getSpriteIcon('actions-version-swap-workspace') .
-                                       '</a>';
-               } else {
-                               // Current workspace: empty space instead of workspace switching button
-                               //
-                               // Here get only width and height from skinning API
-                       $content .= '<img src="clear.gif" ' .
-                                       t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/switch.png', 'width="18" height="16"', 2) .
-                                       ' border="0" alt="" hspace="1" align="middle" alt="" />';
-               }
-               return $content;
-       }
-
-       /**
-        * Checks if user has edit access to workspace. Access is granted if
-        * workspace is custom and user is admin or the the owner of the workspace.
-        * This function assumes that <code>$wksp</code> were passed through
-        * <code>$GLOBALS['BE_USER']->checkWorkspace()</code> function to obtain
-        * <code>_ACCESS</code> attribute of the workspace.
-        *
-        * @param       array           Workspace record
-        * @return      boolean         <code>true</code> if user can modify workspace parameters
-        */
-       function workspaceList_hasEditAccess(&$wksp)    {
-               $access = &$wksp['_ACCESS'];
-               return ($wksp['uid'] > 0 && ($access == 'admin' || $access == 'owner'));
-       }
-
-       /**
-        * Creates a fake workspace record for system workspaces. Record contains
-        * all fields found in <code>sys_workspaces</code>.
-        *
-        * @param       integer         System workspace ID. Currently <code>0</code> and <code>-1</code> are accepted.
-        * @return      array           Generated record (see <code>sys_workspaces</code> for structure)
-        */
-       function workspaceList_createFakeWorkspaceRecord($uid)  {
-               global  $BE_USER, $LANG;
-
-               $record = array(
-                       'uid' => $uid,
-                       'pid' => 0,                             // always 0!
-                       'tstamp' => 0,                  // does not really matter
-                       'deleted' => 0,
-                       'title' => ($uid == 0 ? '['.$LANG->getLL('shortcut_onlineWS').']' : '['.$LANG->getLL('shortcut_offlineWS').']'),
-                       'description' => ($uid == 0 ? $LANG->getLL('shortcut_onlineWS') : $LANG->getLL('shortcut_offlineWS')),
-                       'adminusers' => '',
-                       'members' => '',
-                       'reviewers' => '',
-                       'db_mountpoints' => '',         // TODO get mount points from user profile
-                       'file_mountpoints' => '',       // TODO get mount points from user profile for live workspace only (uid == 0)
-                       'publish_time' => 0,
-                       'unpublish_time' => 0,
-                       'freeze' => 0,
-                       'live_edit' => ($uid == 0),
-                       'vtypes' => 0,
-                       'disable_autocreate' => 0,
-                       'swap_modes' => 0,
-                       'publish_access' => 0,
-                       'stagechg_notification' => 0
-               );
-               return $record;
-       }
-}
-
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/index.php'])    {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/index.php']);
-}
-
-
-
-// Make instance:
-$SOBE = t3lib_div::makeInstance('SC_mod_user_ws_index');
-$SOBE->execute();
-$SOBE->init();
-$SOBE->main();
-$SOBE->printContent();
-
-?>
\ No newline at end of file
diff --git a/typo3/mod/user/ws/progress.gif b/typo3/mod/user/ws/progress.gif
deleted file mode 100644 (file)
index d9a0a6f..0000000
Binary files a/typo3/mod/user/ws/progress.gif and /dev/null differ
diff --git a/typo3/mod/user/ws/publish.php b/typo3/mod/user/ws/publish.php
deleted file mode 100644 (file)
index 62629b1..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2010 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.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Module: Workspace publisher
- *
- * $Id$
- *
- * @author     Dmitry Dulepov <typo3@accio.lv>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   70: class SC_mod_user_ws_publish extends t3lib_SCbase
- *   83:     function init()
- *   95:     function closeAndReload()
- *  106:     function nextPortion(val)
- *  127:     function main()
- *  142:     function printContent()
- *  151:     function getContent()
- *  227:     function getRecords()
- *  243:     function formatProgressBlock($messageLabel)
- *
- * TOTAL FUNCTIONS: 8
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-// Initialize module:
-unset($MCONF);
-require('conf.php');
-require($BACK_PATH . 'init.php');
-require($BACK_PATH . 'template.php');
-$BE_USER->modAccess($MCONF, 1);
-
-// Include libraries of various kinds used inside:
-$LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
-require_once(PATH_typo3 . 'mod/user/ws/class.wslib.php');
-
-define('MAX_RECORDS_TO_PUBLISH', 30);
-
-class SC_mod_user_ws_publish extends t3lib_SCbase {
-
-       var     $isSwap;
-       var     $title;
-       var     $nextRecordNumber;
-       var     $publishData;
-       var     $recordCount;
-
-       /**
-        * Document Template Object
-        *
-        * @var mediumDoc
-        */
-       var $doc;
-
-       /**
-        * Initializes the module. See <code>t3lib_SCbase::init()</code> for more information.
-        *
-        * @return      void
-        */
-       function init() {
-               // Setting module configuration:
-               $this->MCONF = $GLOBALS['MCONF'];
-
-               $this->isSwap = t3lib_div::_GP('swap');
-               $this->nextRecordNumber = t3lib_div::_GP('continue_publish');
-
-               // Initialize Document Template object:
-               $this->doc = t3lib_div::makeInstance('mediumDoc');
-               $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->JScode = '<script type="text/javascript">/*<![CDATA[*/
-                       function closeAndReload() {
-                               //window.opener.location.reload(); window.close();
-                               window.location.href = \'index.php\';
-                       }
-
-                       function nextPortion(val) {
-                               setTimeout(\'window.location.href = "publish.php?continue_publish=\' + val + \'&swap=' . ($this->isSwap ? 1 : 0) . '"\', 750);
-                       }
-               /*]]>*/</script>
-               ';
-               $this->doc->inDocStyles = '
-               #progress-block { width: 450px; margin: 50px auto; text-align: center; }
-               H3 { margin-bottom: 20px; }
-               P, IMG { margin-bottom: 20px; }
-               #progress-block A { text-decoration: underline; }
-';
-
-               // Parent initialization:
-               t3lib_SCbase::init();
-       }
-
-       /**
-        * Creates module content.
-        *
-        * @return      void
-        */
-       function main() {
-               $this->title = $GLOBALS['LANG']->getLL($this->isSwap ? 'swap_title' : 'publish_title');
-
-               $content = $this->getContent(); // sets body parts to doc!
-
-               $this->content .= $this->doc->startPage($this->title);
-               $this->content .= $content;
-               $this->content .= $this->doc->endPage();
-       }
-
-       /**
-        * Outputs content.
-        *
-        * @return      void
-        */
-       function printContent() {
-               echo $this->content;
-       }
-
-       /**
-        * Performs action and generates content.
-        *
-        * @return      string          Generated content
-        */
-       function getContent() {
-               $content = '';
-               if ($this->nextRecordNumber) {
-                       // Prepare limited set of records
-                       $this->publishData = $GLOBALS['BE_USER']->getSessionData('workspacePublisher');
-                       $this->recordCount = $GLOBALS['BE_USER']->getSessionData('workspacePublisher_count');
-                       $limitedCmd = array(); $numRecs = 0;
-                       foreach ($this->publishData as $table => $recs) {
-                               foreach ($recs as $key => $value) {
-                                       $numRecs++;
-                                       $limitedCmd[$table][$key] = $value;
-                                       //$this->content .= $table.':'.$key.'<br />';
-                                       if ($numRecs == MAX_RECORDS_TO_PUBLISH) {
-                                               break;
-                                       }
-                               }
-                               if ($numRecs == MAX_RECORDS_TO_PUBLISH) {
-                                       break;
-                               }
-                       }
-
-                       if ($numRecs == 0) {
-                               // All done
-                               $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher', null);
-                               $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher_count', 0);
-                               $content .= '<div id="progress-block"><h3>' . $this->title . '</h3><p>';
-                               $content .= $GLOBALS['LANG']->getLL($this->isSwap ? 'workspace_swapped' : 'workspace_published');
-                               $content .= '</p><p><a href="index.php">' . $GLOBALS['LANG']->getLL('return_to_index') . '</a>';
-                               $content .= '</p></div>';
-                       }
-                       else {
-                               // Execute the commands:
-                               $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                               $tce->stripslashes_values = 0;
-                               $tce->start(array(), $limitedCmd);
-                               $tce->process_cmdmap();
-
-                               $errors = $tce->errorLog;
-                               if (count($errors) > 0) {
-                                       $content .= '<h3>' . $GLOBALS['LANG']->getLL('label_errors') . '</h3><br />' . implode('<br />', $errors);
-                                       $content .= '<br /><br /><a href="index.php">' . $GLOBALS['LANG']->getLL('return_to_index') . '</a>';
-                               }
-                               else {
-
-                                       // Unset processed records
-                                       foreach ($limitedCmd as $table => $recs) {
-                                               foreach ($recs as $key => $value) {
-                                                       unset($this->publishData[$table][$key]);
-                                               }
-                                       }
-                                       $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher', $this->publishData);
-                                       $content .= $this->formatProgressBlock($this->isSwap ? 'swap_status' : 'publish_status');
-                                       $this->doc->bodyTagAdditions = 'onload="nextPortion(' . ($this->nextRecordNumber + MAX_RECORDS_TO_PUBLISH) . ')"';
-                               }
-                       }
-               }
-               else {
-                       $this->getRecords();
-                       if ($this->recordCount > 0) {
-                               $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher', $this->publishData);
-                               $GLOBALS['BE_USER']->setAndSaveSessionData('workspacePublisher_count', $this->recordCount);
-                               $content .= $this->formatProgressBlock($this->isSwap ? 'swap_prepare' : 'publish_prepare');
-                               $this->doc->bodyTagAdditions = 'onload="nextPortion(1)"';
-                       }
-                       else {
-                               $this->doc->bodyTagAdditions = 'onload="closeAndReload()"';
-                       }
-               }
-               return $content;
-       }
-
-       /**
-        * Fetches command array for publishing and calculates number of records in it. Sets class members accordingly.
-        *
-        * @return      void
-        */
-       function getRecords() {
-               $wslibObj = t3lib_div::makeInstance('wslib');
-               $this->publishData = $wslibObj->getCmdArrayForPublishWS($GLOBALS['BE_USER']->workspace, $this->isSwap);
-
-               $this->recordCount = 0;
-               foreach ($this->publishData as $table => $recs) {
-                       $this->recordCount += count($recs);
-               }
-       }
-
-       /**
-        * Creates block with progress bar
-        *
-        * @param       string          $messageLabel Message label to display
-        * @return      string          Generated content
-        */
-       function formatProgressBlock($messageLabel) {
-               return '<div id="progress-block"><h3>' . $this->title . '</h3><p>' .
-                               sprintf($GLOBALS['LANG']->getLL($messageLabel),
-                               $this->nextRecordNumber,
-                               min($this->recordCount, $this->nextRecordNumber - 1 + MAX_RECORDS_TO_PUBLISH),
-                               $this->recordCount) . '<br />' .
-                               $GLOBALS['LANG']->getLL('please_wait') .
-                               '</p><img src="progress.gif" width="225" height="20" alt="" />' .
-                               '<p>' .
-                               $GLOBALS['LANG']->getLL('do_not_interrupt_publishing_1') .
-                               '<br />' .
-                               $GLOBALS['LANG']->getLL('do_not_interrupt_publishing_2') .
-                               '</p></div>';
-       }
-}
-
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/publish.php'])  {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/publish.php']);
-}
-
-// Make instance:
-$SOBE = t3lib_div::makeInstance('SC_mod_user_ws_publish');
-$SOBE->init();
-$SOBE->main();
-$SOBE->printContent();
-
-?>
\ No newline at end of file
diff --git a/typo3/mod/user/ws/sys_workspace.gif b/typo3/mod/user/ws/sys_workspace.gif
deleted file mode 100644 (file)
index d389a76..0000000
Binary files a/typo3/mod/user/ws/sys_workspace.gif and /dev/null differ
diff --git a/typo3/mod/user/ws/sys_workspace.png b/typo3/mod/user/ws/sys_workspace.png
deleted file mode 100755 (executable)
index e2bd4a2..0000000
Binary files a/typo3/mod/user/ws/sys_workspace.png and /dev/null differ
diff --git a/typo3/mod/user/ws/workspaceforms.php b/typo3/mod/user/ws/workspaceforms.php
deleted file mode 100644 (file)
index 9241e5e..0000000
+++ /dev/null
@@ -1,660 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2010 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.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Module: Workspace manager
- *
- * $Id$
- *
- * @author     Dmitry Dulepov <typo3@accio.lv>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   93: class SC_mod_user_ws_workspaceForms extends t3lib_SCbase
- *
- *              SECTION: PUBLIC MODULE METHODS
- *  123:     function init()
- *  158:     function main()
- *  233:     function printContent()
- *
- *              SECTION: PRIVATE FUNCTIONS
- *  257:     function initTCEForms()
- *  284:     function getModuleParameters()
- *  302:     function getTitle()
- *  321:     function buildForm()
- *  330:     function buildEditForm()
- *  395:     function buildNewForm()
- *  458:     function createButtons()
- *  484:     function getOwnerUser($uid)
- *  510:     function processData()
- *  554:     function fixVariousTCAFields()
- *  566:     function fixTCAUserField($fieldName)
- *  593:     function checkWorkspaceAccess()
- *
- *
- *  606: class user_SC_mod_user_ws_workspaceForms
- *  615:     function processUserAndGroups($conf, $tceforms)
- *
- * TOTAL FUNCTIONS: 16
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-// Initialize module:
-unset($MCONF);
-require('conf.php');
-require($BACK_PATH.'init.php');
-require($BACK_PATH.'template.php');
-$BE_USER->modAccess($MCONF,1);
-
-// Include libraries of various kinds used inside:
-$LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
-//require_once(PATH_typo3.'mod/user/ws/class.wslib.php');
-
-/**
- * Module: Workspace forms for editing/creating workspaces.
- *
- * @author     Dmitry Dulepov <typo3@fm-world.ru>
- * @package TYPO3
- * @subpackage core
- */
-class SC_mod_user_ws_workspaceForms extends t3lib_SCbase {
-
-       // Default variables for backend modules
-       var $MCONF = array();                           // Module configuration
-       var $MOD_MENU = array();                        // Module menu items
-       var $MOD_SETTINGS = array();            // Module session settings
-
-       /**
-        * Document Template Object
-        *
-        * @var mediumDoc
-        */
-       var $doc;
-       var $content;                                           // Accumulated content
-
-       // internal variables
-       var     $isEditAction = false;                  // true if about to edit workspace
-       var $workspaceId;                                       // ID of the workspace that we will edit. Set only if $isEditAction is true.
-
-       /**
-        * An instance of t3lib_TCEForms
-        *
-        * @var t3lib_TCEforms
-        */
-       var $tceforms;
-
-
-
-
-
-
-       /*************************
-        *
-        * PUBLIC MODULE METHODS
-        *
-        *************************/
-
-       /**
-        * Initializes the module. See <code>t3lib_SCbase::init()</code> for more information.
-        *
-        * @return      void
-        */
-       function init() {
-               // Setting module configuration:
-               $this->MCONF = $GLOBALS['MCONF'];
-
-               // Initialize Document Template object:
-               $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->setModuleTemplate('templates/ws_forms.html');
-               $this->doc->form = '<form action="' . t3lib_div::getIndpEnv('SCRIPT_NAME').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
-
-               $this->doc->getContextMenuCode();
-               $this->doc->JScode.= $this->doc->getDynTabMenuJScode();
-
-               // Parent initialization:
-               t3lib_SCbase::init();
-       }
-
-
-
-
-
-
-
-
-
-
-
-       /**
-        * Creates module content.
-        *
-        * @return      void
-        */
-       function main() {
-               global  $LANG;
-
-               // see what we have to do and get parameters (call before processing data!!!)
-               $this->getModuleParameters();
-
-               $hasAccess = (
-                       $GLOBALS['BE_USER']->isAdmin() ||
-                       0 != ($GLOBALS['BE_USER']->groupData['workspace_perms'] & 4) ||
-                       ($this->isEditAction && $this->checkWorkspaceAccess())
-               );
-
-               if (!$hasAccess) {
-                       $title = $this->getTitle();
-                       $this->content .= $this->doc->startPage($title);
-                       $this->content .= $this->doc->header($title);
-                       $this->content .= $this->doc->spacer(5);
-                       $this->content .= $LANG->getLL($this->isEditAction ? 'edit_workspace_no_permission' : 'create_workspace_no_permission');
-                       $this->content .= $this->doc->spacer(5);
-                       $goBack = $GLOBALS['LANG']->getLL('edit_workspace_go_back');
-                       $this->content .= t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
-                                               '<a href="javascript:history.back()" title="'. $goBack . '">' .
-                                               $goBack .
-                                               '</a>';
-                       $this->content .= $this->doc->endPage();
-                       return;
-               }
-
-               // process submission (this may override action and workspace ID!)
-               if (t3lib_div::_GP('workspace_form_submited')) {
-                       $this->processData();
-                       // if 'Save&Close' was pressed, redirect to main module script
-                       if (t3lib_div::_GP('_saveandclosedok_x')) {
-                               // `n` below is to prevent caching
-                               t3lib_utility_Http::redirect('index.php?n=' . uniqid(''));
-                       }
-               }
-
-               $this->initTCEForms();
-
-               //
-               // start page
-               //
-               $this->content .= $this->doc->header($this->getTitle());
-               $this->content .= $this->doc->spacer(5);
-
-               //
-               // page content
-               //
-               $this->content .= $this->tceforms->printNeededJSFunctions_top();
-               $this->content .= $this->buildForm();
-               $this->content .= $this->tceforms->printNeededJSFunctions();
-
-                       // Setting up the buttons and markers for docheader
-               $docHeaderButtons = $this->getButtons();
-               // $markers['CSH'] = $docHeaderButtons['csh'];
-               $markers['CONTENT'] = $this->content;
-
-                       // Build the <body> for the module
-               $this->content = $this->doc->startPage($this->getTitle());
-               $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
-               $this->content.= $this->doc->endPage();
-               $this->content = $this->doc->insertStylesAndJS($this->content);
-       }
-
-       /**
-        * Outputs module content to the browser.
-        *
-        * @return      void
-        */
-       function printContent() {
-               echo $this->content;
-       }
-
-       /**
-        * Create the panel of buttons for submitting the form or otherwise perform operations.
-        *
-        * @return      array   all available buttons as an assoc. array
-        */
-       protected function getButtons() {
-               global $LANG;
-
-               $buttons = array(
-                       'close' => '',
-                       'save' => '',
-                       'save_close' => ''
-               );
-
-                       // Close,  `n` below is simply to prevent caching
-               $buttons['close'] = '<a href="index.php?n=' . uniqid('wksp') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>';
-                       // Save
-               $buttons['save'] = '<input type="image" class="c-inputButton" name="_savedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" value="_savedok" />';
-                       // Save & Close
-               $buttons['save_close'] = '<input type="image" class="c-inputButton" name="_saveandclosedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" value="_saveandclosedok" />';
-
-               return $buttons;
-       }
-
-
-
-
-
-
-
-
-       /*************************
-        *
-        * PRIVATE FUNCTIONS
-        *
-        *************************/
-
-       /**
-        * Initializes <code>t3lib_TCEform</code> class for use in this module.
-        *
-        * @return      void
-        */
-       function initTCEForms() {
-               $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
-               $this->tceforms->initDefaultBEMode();
-               $this->tceforms->backPath = $GLOBALS['BACK_PATH'];
-               $this->tceforms->doSaveFieldName = 'doSave';
-               $this->tceforms->localizationMode = t3lib_div::inList('text,media',$this->localizationMode) ? $this->localizationMode : '';     // text,media is keywords defined in TYPO3 Core API..., see "l10n_cat"
-               $this->tceforms->returnUrl = $this->R_URI;
-               $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
-               $this->tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
-               $this->tceforms->enableClickMenu = true;
-               $this->tceforms->enableTabMenu = true;
-
-                       // Setting external variables:
-               if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions'])   $this->tceforms->edit_showFieldHelp='text';
-       }
-
-
-
-
-
-
-
-       /**
-        * Retrieves module parameters from the <code>t3lib_div::_GP</code>. The following arguments are retrieved: <ul><li>action</li><li>workspace id (if action == 'edit')</li></ul>
-        *
-        * @return      void
-        */
-       function getModuleParameters(){
-               $this->isEditAction = (t3lib_div::_GP('action') == 'edit');
-               if ($this->isEditAction) {
-                       $this->workspaceId = intval(t3lib_div::_GP('wkspId'));
-               }
-       }
-
-
-
-
-
-
-
-       /**
-        * Retrieves a title of the module according to action.
-        *
-        * @return      string          A title for the module
-        */
-       function getTitle() {
-               $label = ($this->isEditAction ? 'edit_workspace_title_edit' : 'edit_workspace_title_new');
-               return $GLOBALS['LANG']->getLL($label);
-       }
-
-
-
-
-
-
-
-
-
-
-       /**
-        * Creates form for workspace. This function is a wrapper around <code>buildEditForm()</code> and <code>buildNewForm()</code>.
-        *
-        * @return      string          Generated form
-        */
-       function buildForm() {
-               return $this->isEditAction ? $this->buildEditForm() : $this->buildNewForm();
-       }
-
-       /**
-        * Creates a form for editing workspace. Parts were adopted from <code>alt_doc.php</code>.
-        *
-        * @return      string          Generated form
-        */
-       function buildEditForm() {
-               $content = '';
-               $table = 'sys_workspace';
-               $prevPageID = '';
-               $trData = t3lib_div::makeInstance('t3lib_transferData');
-               $trData->addRawData = TRUE;
-               $trData->defVals = $this->defVals;
-               $trData->lockRecords=1;
-               $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
-               $trData->prevPageID = $prevPageID;
-               $trData->fetchRecord($table, $this->workspaceId, '');
-               reset($trData->regTableItems_data);
-               $rec = current($trData->regTableItems_data);
-
-               // Setting variables in TCEforms object:
-               $this->tceforms->hiddenFieldList = '';
-               // Register default language labels, if any:
-               $this->tceforms->registerDefaultLanguageData($table,$rec);
-
-               $this->fixVariousTCAFields();
-               if (!$GLOBALS['BE_USER']->isAdmin()) {
-                       // Non-admins cannot select users from the root. We "fix" it for them.
-                       $this->fixTCAUserField('adminusers');
-                       $this->fixTCAUserField('members');
-                       $this->fixTCAUserField('reviewers');
-               }
-
-               // Create form for the record (either specific list of fields or the whole record):
-               $form = '';
-               $form .= $this->tceforms->getMainFields($table,$rec);
-               $form .= '<input type="hidden" name="data['.$table.']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
-               $form .= '<input type="hidden" name="workspace_form_submited" value="1" />';
-               $form .= '<input type="hidden" name="returnUrl" value="index.php" />';
-               $form .= '<input type="hidden" name="action" value="edit" />';
-               $form .= '<input type="hidden" name="closeDoc" value="0" />';
-               $form .= '<input type="hidden" name="doSave" value="0" />';
-               $form .= '<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
-               $form .= '<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
-               $form .= '<input type="hidden" name="wkspId" value="' . htmlspecialchars($this->workspaceId) . '" />';
-               $form = $this->tceforms->wrapTotal($form, $rec, $table);
-
-               // Combine it all:
-               $content .= $form;
-               return $content;
-       }
-
-
-
-
-
-
-
-
-
-
-
-
-       /**
-        * Creates a form for new workspace. Parts are adopted from <code>alt_doc.php</code>.
-        *
-        * @return      string          Generated form
-        */
-       function buildNewForm() {
-               $content = '';
-               $table = 'sys_workspace';
-               $prevPageID = '';
-               $trData = t3lib_div::makeInstance('t3lib_transferData');
-               $trData->addRawData = TRUE;
-               $trData->defVals = $this->defVals;
-               $trData->lockRecords=1;
-               $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
-               $trData->prevPageID = $prevPageID;
-               $trData->fetchRecord($table, 0, 'new');
-               reset($trData->regTableItems_data);
-               $rec = current($trData->regTableItems_data);
-               $rec['uid'] = uniqid('NEW');
-               $rec['pid'] = 0;
-               $rec['adminusers'] = $this->getOwnerUser($rec['uid']);
-
-               // Setting variables in TCEforms object:
-               $this->tceforms->hiddenFieldList = '';
-               // Register default language labels, if any:
-               $this->tceforms->registerDefaultLanguageData($table,$rec);
-
-               $this->fixVariousTCAFields();
-               if (!$GLOBALS['BE_USER']->isAdmin()) {
-                       // Non-admins cannot select users from the root. We "fix" it for them.
-                       $this->fixTCAUserField('adminusers');
-                       $this->fixTCAUserField('members');
-                       $this->fixTCAUserField('reviewers');
-               }
-
-
-               // Create form for the record (either specific list of fields or the whole record):
-               $form = '';
-               $form .= $this->doc->spacer(5);
-               $form .= $this->tceforms->getMainFields($table,$rec);
-
-               $form .= '<input type="hidden" name="workspace_form_submited" value="1" />';
-               $form .= '<input type="hidden" name="data['.$table.']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
-               $form .= '<input type="hidden" name="returnUrl" value="index.php" />';
-               $form .= '<input type="hidden" name="action" value="new" />';
-               $form .= '<input type="hidden" name="closeDoc" value="0" />';
-               $form .= '<input type="hidden" name="doSave" value="0" />';
-               $form .= '<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
-               $form .= '<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
-               $form = $this->tceforms->wrapTotal($form, $rec, $table);
-
-               // Combine it all:
-               $content .= $form;
-               return $content;
-       }
-
-
-
-
-
-
-
-
-
-
-
-
-       /**
-        * Returns owner user (i.e. current BE user) in the format suitable for TCE forms. This function uses <code>t3lib_loadDBGroup</code> to create value. Code is adopted from <code>t3lib_transferdata::renderRecord_groupProc()</code>.
-        *
-        * @param       string          $uid    UID of the record (as <code>NEW...</code>)
-        * @return      string          User record formatted for TCEForms
-        */
-       function getOwnerUser($uid) {
-               $loadDB = t3lib_div::makeInstance('t3lib_loadDBGroup');
-               // Make sure that `sys_workspace` is in $TCA
-               t3lib_div::loadTCA('sys_workspace');
-               // shortcut to `config` of `adminusers` field -- shorter code and better PHP performance
-               $config = &$GLOBALS['TCA']['sys_workspace']['columns']['adminusers']['config'];
-               // Notice: $config['MM'] is not set in the current version of $TCA but
-               // we still pass it to ensure compatibility with feature versions!
-               $loadDB->start($GLOBALS['BE_USER']->user['uid'], $config['allowed'], $config['MM'], $uid, 'sys_workspace', $config);
-               $loadDB->getFromDB();
-               return $loadDB->readyForInterface();
-       }
-
-
-
-
-
-
-
-
-
-       /**
-        * Processes submitted data. This function uses <code>t3lib_TCEmain::process_datamap()</code> to create/update records in the <code>sys_workspace</code> table. It will print error messages just like any other Typo3 module with similar functionality. Function also changes workspace ID and module mode to 'edit' if new record was just created.
-        *
-        * @return      void
-        */
-       function processData() {
-               $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-               $tce->stripslashes_values = 0;
-
-               $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
-               if (is_array($TCAdefaultOverride))      {
-                       $tce->setDefaultsFromUserTS($TCAdefaultOverride);
-               }
-               $tce->stripslashes_values = 0;
-
-                       // The following is a security precaution; It makes sure that the input data array can ONLY contain data for the sys_workspace table and ONLY one record.
-                       // If this is not present it could be mis-used for nasty XSS attacks which can escalate rights to admin for even non-admin users.
-               $inputData_tmp = t3lib_div::_GP('data');
-               $inputData = array();
-               if (is_array($inputData_tmp['sys_workspace']))  {
-                       reset($inputData_tmp['sys_workspace']);
-                       $inputData['sys_workspace'][key($inputData_tmp['sys_workspace'])] = current($inputData_tmp['sys_workspace']);
-               }
-
-               $tce->start($inputData, array(), $GLOBALS['BE_USER']);
-               $tce->admin = 1;        // Bypass table restrictions
-               $tce->bypassWorkspaceRestrictions = true;
-               $tce->process_datamap();
-
-                       // print error messages (if any)
-               $script = t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT');
-               $tce->printLogErrorMessages($script . '?' .
-                       ($this->isEditAction ? 'action=edit&wkspId=' . $this->workspaceId : 'action=new'));
-
-               // If there was saved any new items, load them and update mode and workspace id
-               if (count($tce->substNEWwithIDs_table)) {
-                       reset($tce->substNEWwithIDs_table);     // not really necessary but better be safe...
-                       $this->workspaceId = current($tce->substNEWwithIDs);
-                       $this->isEditAction = true;
-               }
-       }
-
-
-
-       /**
-        * Fixes various <code>$TCA</code> fields for better visual representation of workspace editor.
-        *
-        * @return      void
-        */
-       function fixVariousTCAFields() {
-               // enable tabs
-               $GLOBALS['TCA']['sys_workspace']['ctrl']['dividers2tabs'] = true;
-       }
-
-
-       /**
-        * "Fixes" <code>$TCA</code> to enable blinding for users/groups for non-admin users only.
-        *
-        * @param       string          $fieldName      Name of the field to change
-        * @return      void
-        */
-       function fixTCAUserField($fieldName) {
-               // fix fields for non-admin
-               if (!$GLOBALS['BE_USER']->isAdmin()) {
-                       // make a shortcut to field
-                       t3lib_div::loadTCA('sys_workspace');
-                       $field = &$GLOBALS['TCA']['sys_workspace']['columns'][$fieldName];
-                       $newField = array (
-                               'label' => $field['label'],
-                               'config' => Array (
-                                       'type' => 'select',
-                                       'itemsProcFunc' => 'user_SC_mod_user_ws_workspaceForms->processUserAndGroups',
-                                       //'iconsInOptionTags' => true,
-                                       'size' => 10,
-                                       'maxitems' => $field['config']['maxitems'],
-                                       'autoSizeMax' => $field['config']['autoSizeMax'],
-                                       'mod_ws_allowed' => $field['config']['allowed'] // let us know what we can use in itemProcFunc
-                               )
-                       );
-                       $field = $newField;
-               }
-       }
-
-       /**
-        * Checks if use has editing access to the workspace.
-        *
-        * @return      boolean         Returns true if user can edit workspace
-        */
-       function checkWorkspaceAccess() {
-               $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers','sys_workspace','uid=' . intval($this->workspaceId) . ' AND pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'));
-               if (is_array($workspaces) && count($workspaces) != 0 && false !== ($rec = $GLOBALS['BE_USER']->checkWorkspace($workspaces[0]))) {
-                       return ($rec['_ACCESS'] == 'owner' || $rec['_ACCESS'] == 'admin');
-               }
-               return false;
-       }
-}
-
-/**
- * This class contains Typo3 callback functions. Class name must start from <code>user_</code> thus we use a separate class.
- *
- */
-class user_SC_mod_user_ws_workspaceForms {
-
-       /**
-        * Callback function to blind user and group accounts. Used as <code>itemsProcFunc</code> in <code>$TCA</code>.
-        *
-        * @param       array           $conf   Configuration array. The following elements are set:<ul><li>items - initial set of items (empty in our case)</li><li>config - field config from <code>$TCA</code></li><li>TSconfig - this function name</li><li>table - table name</li><li>row - record row (???)</li><li>field - field name</li></ul>
-        * @param       object          $tceforms       <code>t3lib_div::TCEforms</code> object
-        * @return      void
-        */
-       function processUserAndGroups($conf, $tceforms) {
-                       // Get usernames and groupnames
-               $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
-               $groupArray = array_keys($be_group_Array);
-
-               $be_user_Array = t3lib_BEfunc::getUserNames();
-               $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array,$groupArray,1);
-
-               // users
-               $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_users']['ctrl']['title']);
-               foreach ($be_user_Array as $uid => $user) {
-                       $conf['items'][] = array(
-                               $user['username'] . ' (' . $title . ')',
-                               'be_users_' . $user['uid'],
-                               t3lib_iconWorks::getIcon('be_users', $user)
-                       );
-               }
-
-               // Process groups only if necessary -- save time!
-               if (strstr($conf['config']['mod_ws_allowed'], 'be_groups')) {
-                       // groups
-
-                       $be_group_Array = $be_group_Array_o = t3lib_BEfunc::getGroupNames();
-                       $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array_o,$groupArray,1);
-
-                       $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_groups']['ctrl']['title']);
-                       foreach ($be_group_Array as $uid => $group) {
-                               $conf['items'][] = array(
-                                       $group['title'] . ' (' . $title . ')',
-                                       'be_groups_' . $group['uid'],
-                                       t3lib_iconWorks::getIcon('be_groups', $user)
-                               );
-                       }
-               }
-       }
-}
-
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/workspaceforms.php'])   {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/workspaceforms.php']);
-}
-
-// Make instance:
-$SOBE = t3lib_div::makeInstance('SC_mod_user_ws_workspaceForms');
-$SOBE->init();
-$SOBE->main();
-$SOBE->printContent();
-
-?>
\ No newline at end of file
diff --git a/typo3/mod/user/ws/wsol_preview.php b/typo3/mod/user/ws/wsol_preview.php
deleted file mode 100755 (executable)
index 59f0517..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2004-2010 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()
- *  133:     function generateUrls()
- *  164:     function printFrameset()
- *  206:     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 of class
-        *
-        * @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.'">
-                                               <strong style="font-family:Verdana, Arial;font-size:80%;color:white;">'.$headerText.'</strong>
-                                       </body>
-                               </html>';
-               } elseif ($msg = t3lib_div::_GP('msg')) {
-                       switch($msg)    {
-                               case 'branchpoint':
-                                       $message = '<strong>No live page available!</strong><br /><br />
-                                       The previewed page was inside a "Branch" type version and has no traceable counterpart in the live workspace.';
-                               break;
-                               case 'newpage':
-                                       $message = '<strong>New page!</strong><br /><br />
-                                       The previewed page is created in the workspace and has no counterpart in the live workspace.';
-                               break;
-                               default:
-                                       $message = 'Unknown message code "' . htmlspecialchars($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 in $this->URL array
-        *
-        * @return      void
-        */
-       function generateUrls() {
-                       // Live URL:
-               $pageId = intval(t3lib_div::_GP('id'));
-               $language = intval(t3lib_div::_GP('L'));
-
-               $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.'&L='.$language.'&ADMCMD_noBeUser=1',
-                       'draft' => t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$pageId.'&L='.$language.'&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 HTML code
-        *
-        * @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);
-       }
-}
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/wsol_preview.php']) {
-    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/wsol_preview.php']);
-}
-
-$previewObject = t3lib_div::makeInstance('wsol_preview');
-$previewObject->main();
-?>
\ No newline at end of file
diff --git a/typo3/sysext/version/ws/.htaccess b/typo3/sysext/version/ws/.htaccess
new file mode 100644 (file)
index 0000000..bc54bf1
--- /dev/null
@@ -0,0 +1,7 @@
+<FilesMatch "\.(gif|png)$">
+       <IfModule mod_expires.c>
+               ExpiresActive on
+               ExpiresDefault "access plus 7 days"
+       </IfModule>
+       FileETag MTime Size
+</FilesMatch>
diff --git a/typo3/sysext/version/ws/class.wslib.php b/typo3/sysext/version/ws/class.wslib.php
new file mode 100755 (executable)
index 0000000..dea0c67
--- /dev/null
@@ -0,0 +1,240 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2005-2010 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.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Library with Workspace related functionality
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   68: class wslib
+ *   81:     function getCmdArrayForPublishWS($wsid, $doSwap,$pageId=0)
+ *  127:     function selectVersionsInWorkspace($wsid,$filter=0,$stage=-99,$pageId=-1)
+ *
+ *              SECTION: CLI functions
+ *  183:     function CLI_main()
+ *  193:     function autoPublishWorkspaces()
+ *
+ * TOTAL FUNCTIONS: 4
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+/**
+ * Library with Workspace related functionality
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @package TYPO3
+ * @subpackage core
+ */
+class wslib {
+
+
+
+
+       /**
+        * Building tcemain CMD-array for swapping all versions in a workspace.
+        *
+        * @param       integer         Real workspace ID, cannot be ONLINE (zero).
+        * @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.
+        * @param       [type]          $pageId: ...
+        * @return      array           Command array for tcemain
+        */
+       function getCmdArrayForPublishWS($wsid, $doSwap,$pageId=0)      {
+
+               $wsid = intval($wsid);
+               $cmd = array();
+
+               if ($wsid>=-1 && $wsid!==0)     {
+
+                               // Define stage to select:
+                       $stage = -99;
+                       if ($wsid>0)    {
+                               $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace',$wsid);
+                               if ($workspaceRec['publish_access']&1)  {
+                                       $stage = 10;
+                               }
+                       }
+
+                               // Select all versions to swap:
+                       $versions = $this->selectVersionsInWorkspace($wsid,0,$stage,($pageId?$pageId:-1));
+
+                               // Traverse the selection to build CMD array:
+                       foreach($versions as $table => $records)        {
+                               foreach($records as $rec)       {
+
+                                               // Build the cmd Array:
+                                       $cmd[$table][$rec['t3ver_oid']]['version'] = array(
+                                               'action' => 'swap',
+                                               'swapWith' => $rec['uid'],
+                                               'swapIntoWS' => $doSwap ? 1 : 0
+                                       );
+                               }
+                       }
+               }
+               return $cmd;
+       }
+
+       /**
+        * Select all records from workspace pending for publishing
+        * Used from backend to display workspace overview
+        * User for auto-publishing for selecting versions for publication
+        *
+        * @param       integer         Workspace ID. If -99, will select ALL versions from ANY workspace. If -98 will select all but ONLINE. >=-1 will select from the actual workspace
+        * @param       integer         Lifecycle filter: 1 = select all drafts (never-published), 2 = select all published one or more times (archive/multiple), anything else selects all.
+        * @param       integer         Stage filter: -99 means no filtering, otherwise it will be used to select only elements with that stage. For publishing, that would be "10"
+        * @param       integer         Page id: Live page for which to find versions in workspace!
+        * @return      array           Array of 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 REAL pid of the online record is found as "realpid"
+        */
+       function selectVersionsInWorkspace($wsid,$filter=0,$stage=-99,$pageId=-1)       {
+               global $TCA;
+
+               $wsid = intval($wsid);
+               $filter = intval($filter);
+               $output = array();
+
+                       // Traversing all tables supporting versioning:
+               foreach($TCA as $table => $cfg) {
+                       if ($TCA[$table]['ctrl']['versioningWS'])       {
+
+                                       // Select all records from this table in the database from the workspace
+                                       // This joins the online version with the offline version as tables A and B
+                               $recs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows (
+                                       'A.uid, A.t3ver_oid,'.($table==='pages' ? ' A.t3ver_swapmode,':'').' B.pid AS realpid',
+                                       $table.' A,'.$table.' B',
+                                       'A.pid=-1'.     // Table A is the offline version and pid=-1 defines offline
+                                               ($pageId!=-1 ? ($table==='pages' ? ' AND B.uid='.intval($pageId) : ' AND B.pid='.intval($pageId)) : '').
+                                               ($wsid>-98 ? ' AND A.t3ver_wsid='.$wsid : ($wsid===-98 ? ' AND A.t3ver_wsid!=0' : '')). // For "real" workspace numbers, select by that. If = -98, select all that are NOT online (zero). Anything else below -1 will not select on the wsid and therefore select all!
+                                               ($filter===1 ? ' AND A.t3ver_count=0' : ($filter===2 ? ' AND A.t3ver_count>0' : '')).   // lifecycle filter: 1 = select all drafts (never-published), 2 = select all published one or more times (archive/multiple)
+                                               ($stage!=-99 ? ' AND A.t3ver_stage='.intval($stage) : '').
+                                               ' AND B.pid>=0'.        // Table B (online) must have PID >= 0 to signify being online.
+                                               ' AND A.t3ver_oid=B.uid'.       // ... and finally the join between the two tables.
+                                               t3lib_BEfunc::deleteClause($table,'A').
+                                               t3lib_BEfunc::deleteClause($table,'B'),
+                                       '',
+                                       'B.uid'         // Order by UID, mostly to have a sorting in the backend overview module which doesn't "jump around" when swapping.
+                               );
+                               if (count($recs)) {
+                                       $output[$table] = $recs;
+                               }
+                       }
+               }
+
+               return $output;
+       }
+
+
+
+
+
+
+
+
+
+
+
+
+       /****************************
+        *
+        * Scheduler methods
+        *
+        ****************************/
+
+       /**
+        * Main function to call from cli-script
+        *
+        * @return      void
+        * @deprecated since TYPO3 4.5 - This was meant for an obsolete CLI script. You shouldn't be calling this.
+        */
+       function CLI_main()     {
+               self::logDeprecatedFunction();
+               $this->autoPublishWorkspaces();
+       }
+
+       /**
+        * This method is called by the Scheduler task that triggers
+        * the autopublication process
+        * It searches for workspaces whose publication date is in the past
+        * and publishes them
+        *
+        * @return      void
+        */
+       function autoPublishWorkspaces()        {
+               global $TYPO3_CONF_VARS;
+
+                       // Temporarily set high power...
+               $GLOBALS['BE_USER']->user['admin'] = 1;
+
+                       // Select all workspaces that needs to be published / unpublished:
+               $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       'uid,swap_modes,publish_time,unpublish_time',
+                       'sys_workspace',
+                       'pid=0
+                               AND
+                               ((publish_time!=0 AND publish_time<='.intval($GLOBALS['EXEC_TIME']).')
+                               OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<='.intval($GLOBALS['EXEC_TIME']).'))'.
+                               t3lib_BEfunc::deleteClause('sys_workspace')
+               );
+
+               foreach($workspaces as $rec)    {
+
+                               // First, clear start/end time so it doesn't get select once again:
+                       $fieldArray = $rec['publish_time']!=0 ? array('publish_time'=>0) : array('unpublish_time'=>0);
+                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace','uid='.intval($rec['uid']),$fieldArray);
+
+                               // Get CMD array:
+                       $cmd = $this->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes']==1);      // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
+
+                               // Execute CMD array:
+                       $tce = t3lib_div::makeInstance('t3lib_TCEmain');
+                       $tce->stripslashes_values = 0;
+                       $tce->start(array(),$cmd);
+                       $tce->process_cmdmap();
+               }
+       }
+}
+
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.wslib.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.wslib.php']);
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/version/ws/class.wslib_gui.php b/typo3/sysext/version/ws/class.wslib_gui.php
new file mode 100644 (file)
index 0000000..e2968ed
--- /dev/null
@@ -0,0 +1,1309 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005-2010 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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Library with Workspace GUI related functionality. It is used by main workspace
+ * module but also can be used from extensions. Originally 99.9%% of the code
+ * was written by Kasper and only transfered here by Dmitry.
+ *
+ * $Id$
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Dmitry Dulepov <dmitry@typo3.org>
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   84: class wslib_gui
+ *
+ *              SECTION: Public functions
+ *  128:     function getWorkspaceOverview(&$doc, $wsid = null, $filter = 0, $pageId = -1)
+ *  192:     function hlSubelements(origId, verId, over, diffLayer)
+ *
+ *              SECTION: Private functions (do not use outside of this class!)
+ *  224:     function initVars()
+ *  253:     function displayWorkspaceOverview_setInPageArray(&$pArray, $rlArr, $table, $row)
+ *  284:     function markupNewOriginals()
+ *  309:     function displayWorkspaceOverview_list($pArray, $tableRows=array(), $c=0, $warnAboutVersions=FALSE)
+ *  504:     function displayWorkspaceOverview_pageTreeIconTitle($pageUid, $title, $indentCount)
+ *  518:     function formatVerId($verId)
+ *  529:     function formatWorkspace($wsid)
+ *  559:     function createDiffView($table, $diff_1_record, $diff_2_record)
+ *  676:     function versionsInOtherWS($table, $uid)
+ *  705:     function showStageChangeLog($table,$id,$stageCommands)
+ *  757:     function displayWorkspaceOverview_commandLinks($table,&$rec_on,&$rec_off,$vType)
+ *  830:     function formatCount($count)
+ *  860:     function subElements($uid,$treeLevel,$origId=0)
+ *  963:     function subElements_getNonPageRecords($tN, $uid, &$recList)
+ *  993:     function subElements_renderItem(&$tCell,$tN,$uid,$rec,$origId,$iconMode,$HTMLdata)
+ * 1066:     function displayWorkspaceOverview_commandLinksSub($table,$rec,$origId)
+ * 1113:     function displayWorkspaceOverview_stageCmd($table,&$rec_off)
+ *
+ * TOTAL FUNCTIONS: 19
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+require_once(PATH_typo3 . 'mod/user/ws/class.wslib.php');
+$LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
+$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
+
+/**
+ * Library with Workspace GUI related functionality. It is used by main workspace
+ * module but also can be used from extensions. Originally 99.9%% of the code
+ * was written by Kasper and only transfered here by Dmitry.
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Dmitry Dulepov <dmitry@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class wslib_gui {
+
+       // Static:
+       var $pageTreeIndent = 8;
+       var $pageTreeIndent_titleLgd = 30;
+
+       // Options
+       var     $diff = false;
+       var     $expandSubElements = false;
+       var     $alwaysDisplayHeader = false;
+
+       // Internal
+       var     $showWorkspaceCol = 0;
+       var     $doc;
+       var     $formatWorkspace_cache = array();
+       var     $targets = array();                                             // Accumulation of online targets.
+       var     $be_user_Array = array();
+       var     $pageModule = '';
+       var $formatCount_cache = array();
+       var $stageIndex = array();
+       var     $addHlSubelementsScript = false;
+
+       /*********************************
+        *
+        * Public functions
+        *
+        *********************************/
+
+       /**
+        * Creates HTML to display workspace overview. Can be used to display overview for all possible records or only for single page.
+        *
+        * The following code is <strong>required</strong> in BE module when this function is used:
+        * <code>
+        *      $this->doc->getContextMenuCode();
+        * </code>
+        * or click-menu will not be generated properly!
+        *
+        * @param       object          $doc    Document (to use for formatting)
+        * @param       int             $wsid   Workspace ID, If <code>null</code>, the value is obtained from current BE user
+        * @param       int             $filter If 0, than no filtering, if 10 than select for publishing, otherwise stage value
+        * @param       int             $pageId If greater than zero, than it is UID of page in LIVE workspaces to select records for
+        * @return      string          Generated HTML
+        */
+       function getWorkspaceOverview(&$doc, $wsid = null, $filter = 0, $pageId = -1) {
+               global  $LANG;
+
+               // Setup
+               $this->workspaceId = (!is_null($wsid) ? $wsid : $GLOBALS['BE_USER']->workspace);
+               $this->showWorkspaceCol = $GLOBALS['BE_USER']->workspace == 0 && $this->workspaceId <= -98;
+               $this->doc = $doc;
+               $this->initVars();
+
+               // Initialize workspace object and request all pending versions:
+               $wslibObj = t3lib_div::makeInstance('wslib');
+
+               // Selecting ALL versions belonging to the workspace:
+               $versions = $wslibObj->selectVersionsInWorkspace($this->workspaceId, $filter, -99, $pageId);
+
+               // Traverse versions and build page-display array:
+               $pArray = array();
+               $wmArray = array();     // is page in web mount?
+               $rlArray = array();     // root line of page
+               $pagePermsClause = $GLOBALS['BE_USER']->getPagePermsClause(1);
+               foreach($versions as $table => $records)        {
+                       if (is_array($records)) {
+                               foreach($records as $rec)       {
+                                       $pageIdField = $table==='pages' ? 't3ver_oid' : 'realpid';
+                                       $recPageId = $rec[$pageIdField];
+                                       if (!isset($wmArray[$recPageId]))       {
+                                               $wmArray[$recPageId] = $GLOBALS['BE_USER']->isInWebMount($recPageId,$pagePermsClause);
+                                       }
+                                       if ($wmArray[$recPageId])       {
+                                               if (!isset($rlArray[$recPageId]))       {
+                                                       $rlArray[$recPageId] = t3lib_BEfunc::BEgetRootLine($recPageId, 'AND 1=1');
+                                               }
+                                               $this->displayWorkspaceOverview_setInPageArray(
+                                                       $pArray,
+                                                       $rlArray[$recPageId],
+                                                       $table,
+                                                       $rec
+                                               );
+                                       }
+                               }
+                       }
+               }
+
+                       // Page-browser:
+               $resultsPerPage = 50;
+               $pointer = t3lib_div::_GP('browsePointer');
+               $browseStat = $this->cropWorkspaceOverview_list($pArray,$pointer,$resultsPerPage);
+               $browse = '';
+               $browse .= '<h3>Showing ' . $browseStat['begin'] . ' to ' . ($browseStat['end'] ? $browseStat['end'] . ' out of ' . $browseStat['allItems'] : $browseStat['allItems']) . ' versions:</h3>';
+               if (!($browseStat['begin']==1 && !$browseStat['end']))  {
+                       for($a=0;$a<ceil($browseStat['allItems']/$resultsPerPage);$a++) {
+                               $browse.=($a==(int)$pointer?'<strong>':'').'<a href="'.htmlspecialchars('index.php?browsePointer='.rawurlencode($a)).'">['.($a+1).']</a>'.($a==(int)$pointer?'</strong>':'').' ';
+                       }
+               }
+
+               $workspaceOverviewList = $this->displayWorkspaceOverview_list($pArray);
+               if ($workspaceOverviewList || $this->alwaysDisplayHeader) {
+                       // Make header of overview:
+                       $tableRows = array();
+                       $tableHeader = '
+                               <tr class="t3-row-header">
+                                       <td nowrap="nowrap" width="100">' . $LANG->getLL('label_pagetree') . '</td>
+                                       <td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_live_version') . '</td>
+                                       <td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_draft_versions') . '</td>
+                                       <td nowrap="nowrap">' . $LANG->getLL('label_stage') . '</td>
+                                       <td nowrap="nowrap">' . $LANG->getLL('label_publish') . '</td>
+                                       <td><select name="_with_selected_do" onchange="if (confirm(\'' . $LANG->getLL('submit_apply_action_on_selected_elements') . '\')) {document.forms[0].submit();}">
+                                               <option value="_">' . $LANG->getLL('label_doaction_default') . '</option>';
+
+                       if ($this->publishAccess && !($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1)) {
+                               $tableHeader .= '<option value="publish">' . $LANG->getLL('label_doaction_publish') . '</option>';
+                               if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
+                                       $tableHeader .= '<option value="swap">' . $LANG->getLL('label_doaction_swap') . '</option>';
+                               }
+                       }
+                       if ($GLOBALS['BE_USER']->workspace !== 0) {
+                               $tableHeader .= '<option value="release">' . $LANG->getLL('label_doaction_release') . '</option>';
+                       }
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('-1') ? '<option value="stage_-1">' . $LANG->getLL('label_doaction_stage_reject') . '</option>' : '';
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('0') ? '<option value="stage_0">' . $LANG->getLL('label_doaction_stage_editing') . '</option>' : '';
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('1') ? '<option value="stage_1">' . $LANG->getLL('label_doaction_stage_review') . '</option>' : '';
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('10') ? '<option value="stage_10">' . $LANG->getLL('label_doaction_stage_publish') . '</option>' : '';
+
+                       $tableHeader .= '<option value="flush">' . $LANG->getLL('label_doaction_flush') . '</option>
+                                       </select></td>
+                                       <td>' . $LANG->getLL('label_lifecycle') . '</td>
+                                       '.($this->showWorkspaceCol ? '<td>' . $LANG->getLL('label_workspace') . '</td>' : '').'
+                               </tr>';
+                       $tableRows[] = $tableHeader;
+
+                       // Add lines from overview:
+                       $tableRows = array_merge($tableRows, $workspaceOverviewList);
+
+                       $table = '<table border="0" cellpadding="0" cellspacing="0" id="t3-user-ws-wsoverview-table" class="typo3-dblist">' . implode('', $tableRows) . '</table>';
+
+                       // script
+                       if ($this->addHlSubelementsScript && !strstr($this->doc->JScode, 'function hlSubelements(')) {
+                               $table = $this->doc->wrapScriptTags('
+                                       function hlSubelements(origId, verId, over, diffLayer)  {
+                                               if (over)       {
+                                                       document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
+                                                       document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
+                                                       if (diffLayer)  {
+                                                               document.getElementById(\'diff_\'+verId).style.visibility = \'visible\';
+                                                       }
+                                               } else {
+                                                       document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
+                                                       document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
+                                                       if (diffLayer)  {
+                                                               document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\';
+                                                       }
+                                               }
+                                       }
+                               ') . $table;
+                       }
+
+                       return $browse . $table . $this->markupNewOriginals();
+               }
+               return '';
+       }
+
+       /*********************************
+        *
+        * Private functions (do not use outside of this class!)
+        *
+        *********************************/
+
+       /**
+        * Initializes several class variables
+        *
+        * @return      void
+        */
+       function initVars() {
+               // Init users
+               $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
+               $groupArray = array_keys($be_group_Array);
+               // Need 'admin' field for t3lib_iconWorks::getIconImage()
+               $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');
+               if (!$GLOBALS['BE_USER']->isAdmin()) {
+                       $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array,$groupArray,1);
+               }
+
+               // If another page module was specified, replace the default Page module with the new one
+               $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
+               $this->pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
+
+               // Setting publish access permission for workspace:
+               $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace);     // FIXME Should be $this->workspaceId here?
+       }
+
+       /**
+        * Building up of the $pArray variable which is a hierarchical storage of table-rows arranged according to the level in the rootline the element was found
+        * (Internal)
+        * Made for recursive calling
+        *
+        * @param       array           Array that is built up with the page tree structure
+        * @param       array           Root line for element (table / row); The element is stored in pArray according to this root line.
+        * @param       string          Table name
+        * @param       array           Table row
+        * @return      void            $pArray is passed by reference and modified internally
+        */
+       function displayWorkspaceOverview_setInPageArray(&$pArray, $rlArr, $table, $row)        {
+               // Initialize:
+               ksort($rlArr);
+               reset($rlArr);
+               if (!$rlArr[0]['uid']) {
+                       array_shift($rlArr);
+               }
+
+               // Get and remove first element in root line:
+               $cEl = current($rlArr);
+               $pUid = $cEl['t3ver_oid'] ? $cEl['t3ver_oid'] : $cEl['uid'];            // Done to pile up "false versions" in the right branch...
+
+               $pArray[$pUid] = $cEl['title'];
+               array_shift($rlArr);
+
+               // If there are elements left in the root line, call this function recursively (to build $pArray in depth)
+               if (count($rlArr))      {
+                       if (!isset($pArray[$pUid.'.'])) {
+                               $pArray[$pUid.'.'] = array();
+                       }
+                       $this->displayWorkspaceOverview_setInPageArray($pArray[$pUid.'.'], $rlArr, $table, $row);
+               } else {        // If this was the last element, set the value:
+                       $pArray[$pUid.'_'][$table][$row['t3ver_oid']][] = $row;
+               }
+       }
+
+       /**
+        * JavaScript code to mark up new records that are online (in sub element lists)
+        *
+        * @return      string          HTML javascript section
+        */
+       function markupNewOriginals()   {
+
+               if (count($this->targets))      {
+                       $scriptCode = '';
+                       foreach($this->targets as $key => $rec) {
+                               $scriptCode.='
+                                       document.getElementById(\''.$key.'\').attributes.getNamedItem("class").nodeValue = \'typo3-ver-new\';
+                               ';
+                       }
+
+                       return $this->doc->wrapScriptTags($scriptCode);
+               }
+       }
+
+
+       /**
+        * Rendering the content for the publish / review overview:
+        * (Made for internal recursive calling)
+        *
+        * @param       array           Hierarchical storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray())
+        * @param       array           Existing array of table rows to add to
+        * @param       array           Depth counter
+        * @param       boolean         If set, a warning is shown if versions are found (internal flag)
+        * @return      array           Table rows, see displayWorkspaceOverview()
+        */
+       function displayWorkspaceOverview_list($pArray, $tableRows=array(), $c=0, $warnAboutVersions=FALSE)     {
+               global $TCA, $LANG;
+
+               // Initialize:
+               $fullColSpan = $this->showWorkspaceCol ? 10 : 9;
+
+               // Traverse $pArray
+               if (is_array($pArray))  {
+                       foreach($pArray as $k => $v)    {
+                               if (t3lib_div::testInt($k))     {
+
+                                       // If there are elements on this level, output a divider row which just creates a little visual space.
+                                       if (is_array($pArray[$k.'_']))  {
+                                               $tableRows[] = '
+                                                       <tr>
+                                                               <td colspan="'.$fullColSpan.'"><img src="clear.gif" width="1" height="3" alt="" /></td>
+                                                       </tr>';
+                                       }
+
+                                       // Printing a level from the page tree with no additional content:
+                                       // If there are NO elements on this level OR if there are NO pages on a level with elements, then show page tree icon and title (otherwise it is shown with the display of the elements)
+                                       if (!is_array($pArray[$k.'_']) || !is_array($pArray[$k.'_']['pages']))  {
+                                               $tableRows[] = '
+                                                       <tr class="bgColor4-20">
+                                                               <td nowrap="nowrap" colspan="'.$fullColSpan.'">'.
+                                                               $this->displayWorkspaceOverview_pageTreeIconTitle($k,$pArray[$k],$c).
+                                                               '</td>
+                                                       </tr>';
+                                       }
+
+                                       // If there ARE elements on this level, print them:
+                                       $warnAboutVersions_next = $warnAboutVersions;
+                                       $warnAboutVersions_nonPages = FALSE;
+                                       $warnAboutVersions_page = FALSE;
+                                       if (is_array($pArray[$k.'_']))  {
+                                               foreach($pArray[$k.'_'] as $table => $oidArray) {
+                                                       foreach($oidArray as $oid => $recs)     {
+
+                                                               // Get CURRENT online record and icon based on "t3ver_oid":
+                                                               $rec_on = t3lib_BEfunc::getRecord($table,$oid);
+                                                               $icon = t3lib_iconWorks::getIconImage($table, $rec_on, $this->doc->backPath,' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($rec_on,$table).'"');
+                                                               if ($GLOBALS['BE_USER']->workspace===0) {       // Only edit online records if in ONLINE workspace:
+                                                                       $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $rec_on['uid'], 2, '', '+edit,view,info,delete');
+                                                               }
+
+                                                               // MAIN CELL / Online version display:
+                                                               // Create the main cells which will span over the number of versions there is. If the table is "pages" then it will show the page tree icon and title (which was not shown by the code above)
+                                                               $verLinkUrl = t3lib_extMgm::isLoaded('version') && $TCA[$table]['ctrl']['versioningWS'];
+                                                               $origElement = $icon.
+                                                               ($verLinkUrl ? '<a href="'.htmlspecialchars($this->doc->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?table='.$table.'&uid='.$rec_on['uid']).'">' : '').
+                                                                                               t3lib_BEfunc::getRecordTitle($table,$rec_on,TRUE).
+                                                                                               ($verLinkUrl ? '</a>' : '');
+                                                               $mainCell_rowSpan = count($recs)>1 ? ' rowspan="'.count($recs).'"' : '';
+                                                               $mainCell = $table==='pages' ? '
+                                                                                       <td class="bgColor4-20" nowrap="nowrap"'.$mainCell_rowSpan.'>'.
+                                                                                       $this->displayWorkspaceOverview_pageTreeIconTitle($k,$pArray[$k],$c).
+                                                                                       '</td>' : '
+                                                                                       <td class="bgColor"'.$mainCell_rowSpan.'></td>';
+                                                               $mainCell.= '
+                                                                                       <td align="center"'.$mainCell_rowSpan.'>'.$this->formatVerId($rec_on['t3ver_id']).'</td>
+                                                                                       <td nowrap="nowrap"'.$mainCell_rowSpan.'>'.
+                                                               $origElement.
+                                                               '###SUB_ELEMENTS###'.   // For substitution with sub-elements, if any.
+                                                               '</td>';
+
+                                                               // Offline versions display:
+                                                               // Traverse the versions of the element
+                                                               foreach($recs as $rec)  {
+
+                                                                       // Get the offline version record:
+                                                                       $rec_off = t3lib_BEfunc::getRecord($table,$rec['uid']);
+
+                                                                       // Prepare swap-mode values:
+                                                                       if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1) {
+                                                                               if ($rec_off['t3ver_swapmode']>0)       {
+                                                                                       $vType = 'branch';      // Do not translate!
+                                                                               } else {
+                                                                                       $vType = 'page';        // Do not translate!
+                                                                               }
+                                                                       } else {
+                                                                               $vType = 'element';     // Do not translate!
+                                                                       }
+
+                                                                       // Get icon:
+                                                                       $icon = t3lib_iconWorks::getIconImage($table, $rec_off, $this->doc->backPath, ' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($rec_off,$table).'"');
+                                                                       $tempUid = ($table != 'pages' || $vType==='branch' || $GLOBALS['BE_USER']->workspace == 0 ? $rec_off['uid'] : $rec_on['uid']);
+                                                                       $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $tempUid, 2, '', '+edit,' . ($table == 'pages' ? 'view,info,' : '') . 'delete');
+
+                                                                       // Prepare diff-code:
+                                                                       if ($this->diff)        {
+                                                                               $diffCode = '';
+                                                                               list($diffHTML,$diffPct) = $this->createDiffView($table, $rec_off, $rec_on);
+                                                                               if ($rec_on['t3ver_state']==1)  {       // New record:
+                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_newrecord') . '<br />';
+                                                                                       $diffCode.= $diffHTML;
+                                                                               } elseif ($rec_off['t3ver_state']==2)   {
+                                                                                       $diffCode.= $this->doc->icons(2) . $LANG->getLL('label_deletedrecord') . '<br/>';
+                                                                               } elseif ($rec_on['t3ver_state']==3)    {
+                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_moveto_placeholder') . '<br/>';
+                                                                               } elseif ($rec_off['t3ver_state']==4)   {
+                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_moveto_pointer') . '<br/>';
+                                                                               } else {
+                                                                                       $diffCode .= ($diffPct < 0 ? $LANG->getLL('label_notapplicable') :
+                                                                                               ($diffPct ? sprintf($LANG->getLL('label_percentChange'), $diffPct) : ''));
+                                                                                       $diffCode.= $diffHTML;
+                                                                               }
+
+                                                                       } else $diffCode = '';
+
+                                                                       switch($vType) {
+                                                                               case 'element':
+                                                                                       $swapLabel = ' ['.$LANG->getLL('label_element').']';
+                                                                                       $swapClass = 'ver-element';     // Do not translate!
+                                                                                       $warnAboutVersions_nonPages = $warnAboutVersions_page;  // Setting this if sub elements are found with a page+content (must be rendered prior to this of course!)
+                                                                                       break;
+                                                                               case 'page':
+                                                                                       $swapLabel = ' ['.$LANG->getLL('label_page').']';
+                                                                                       $swapClass = 'ver-page';        // Do not translate!
+                                                                                       $warnAboutVersions_page = !$this->showWorkspaceCol;             // This value is true only if multiple workspaces are shown and we need the opposite here.
+                                                                                       break;
+                                                                               case 'branch':
+                                                                                       $swapLabel = ' ['.$LANG->getLL('label_branch').']';
+                                                                                       $swapClass = 'ver-branch';      // Do not translate!
+                                                                                       $warnAboutVersions_next = !$this->showWorkspaceCol;             // This value is true only if multiple workspaces are shown and we need the opposite here.
+                                                                                       break;
+                                                                       }
+
+                                                                       // Modify main cell based on first version shown:
+                                                                       $subElements = array();
+                                                                       if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1 && $mainCell)    {       // For "Page" and "Branch" swap modes where $mainCell is still carrying content (only first version)
+                                                                               $subElements['on'] = $this->subElements($rec_on['uid'], $rec_off['t3ver_swapmode']);
+                                                                               $subElements['off'] = $this->subElements($rec_off['uid'],$rec_off['t3ver_swapmode'],$rec_on['uid']);
+                                                                       }
+                                                                       $mainCell = str_replace('###SUB_ELEMENTS###', $subElements['on'], $mainCell);
+
+                                                                       // Create version element:
+                                                                       $versionsInOtherWS = $this->versionsInOtherWS($table, $rec_on['uid']);
+                                                                       $versionsInOtherWSWarning = $versionsInOtherWS && $GLOBALS['BE_USER']->workspace !== 0 ? '<br />' . $this->doc->icons(2) . $LANG->getLL('label_otherversions') . ' ' . $versionsInOtherWS : '';
+                                                                       $multipleWarning = (!$mainCell && $GLOBALS['BE_USER']->workspace !==0 ? '<br />' . $this->doc->icons(3) . '<strong>' . $LANG->getLL('label_multipleversions') . '</strong>' : '');
+                                                                       $verWarning = $warnAboutVersions || ($warnAboutVersions_nonPages && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages']) ? '<br />' . $this->doc->icons(3) . '<strong>' . $LANG->getLL('label_nestedversions') . '</strong>' : '';
+                                                                       $verElement = $icon.
+                                                                               '<a href="'.htmlspecialchars($this->doc->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?id='.($table==='pages'?$rec_on['uid']:$rec_on['pid']).'&details='.rawurlencode($table.':'.$rec_off['uid']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
+                                                                               t3lib_BEfunc::getRecordTitle($table,$rec_off,TRUE).
+                                                                               '</a>'.
+                                                                               $versionsInOtherWSWarning.
+                                                                               $multipleWarning.
+                                                                               $verWarning;
+                                                                       if ($diffCode)  {
+                                                                               $verElement = '
+                                                                               <table border="0" cellpadding="0" cellspacing="0" class="ver-verElement">
+                                                                                       <tr>
+                                                                                               <td nowrap="nowrap" width="180">'.$verElement.'&nbsp;&nbsp;</td>
+                                                                                               <td class="c-diffCell">'.$diffCode.'</td>
+                                                                                       </tr>
+                                                                               </table>';
+                                                                       }
+
+                                                                       // Create version cell:
+                                                                       $verCell = '
+                                                                                       <td align="center">'.$this->formatVerId($rec_off['t3ver_id']).'</td>
+                                                                                       <td nowrap="nowrap">'.
+                                                                       $verElement.
+                                                                       $subElements['off'].
+                                                                       '</td>';
+
+                                                                       // Compile table row:
+                                                                       $tableRows[] = '
+                                                                               <tr class="bgColor4">
+                                                                                       '.$mainCell.$verCell.'
+                                                                                       <td nowrap="nowrap">'.$this->showStageChangeLog($table,$rec_off['uid'],$this->displayWorkspaceOverview_stageCmd($table,$rec_off)).'</td>
+                                                                                       <td nowrap="nowrap" class="'.$swapClass.'">'.
+                                                                       $this->displayWorkspaceOverview_commandLinks($table,$rec_on,$rec_off,$vType).
+                                                                       htmlspecialchars($swapLabel).
+                                                                       '</td>
+                                                                                       <td nowrap="nowrap" align="center"><input type="checkbox" name="items['.$table.':'.$rec_off['uid'].']" id="items['.$table.':'.$rec_off['uid'].']" value="1"/></td>
+                                                                                       <td nowrap="nowrap">'.htmlspecialchars($this->formatCount($rec_off['t3ver_count'])).'</td>'.            // Lifecycle
+                                                                       ($this->showWorkspaceCol ? '
+                                                                                       <td nowrap="nowrap">'.htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])).'</td>' : '').'
+                                                                               </tr>';
+
+                                                                       // Reset the main cell:
+                                                                       $mainCell = '';
+                                                               }
+                                                       }
+                                               }
+                                       }
+                                       // Call recursively for sub-rows:
+                                       $tableRows = $this->displayWorkspaceOverview_list($pArray[$k.'.'], $tableRows, $c+1, $warnAboutVersions_next);
+                               }
+                       }
+               }
+               return $tableRows;
+       }
+
+       /**
+        * Filtering out items in pArray according to pointer and result-per-page setting
+        *
+        * @param       array           Hierarchical storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray())
+        * @return      array           Returns statistics about the pointer state.
+        */
+       function cropWorkspaceOverview_list(&$pArray,$pointer=0,$resPerPage=50,$stat=array())   {
+
+                       // Traverse $pArray
+               if (is_array($pArray))  {
+                       foreach($pArray as $k => $v)    {
+                               if (t3lib_div::testInt($k))     {
+
+                                       if (is_array($pArray[$k.'_']))  {
+                                               foreach($pArray[$k.'_'] as $table => $oidArray) {
+                                                       foreach($oidArray as $oid => $recs)     {
+
+                                                                       // Check, if the item count has reached the point where we want to set the in-point.
+                                                               $beginWasSet = FALSE;
+                                                               if (!isset($stat['begin']) && (int)$stat['allItems'] >= $pointer*$resPerPage)   {
+                                                                       $stat['begin']=(int)$stat['allItems']+1;
+                                                                       $beginWasSet = TRUE;
+                                                               }
+
+                                                                       // If in-point is not set, unset the previous items.
+                                                               if (!isset($stat['begin']))     {
+                                                                       unset($pArray[$k.'_'][$table][$oid]);
+                                                               }
+
+                                                                       // Increase counter:
+                                                               $stat['allItems']+=count($recs);
+
+                                                                       // Check if end-point is reached:
+                                                               if (!$beginWasSet && !isset($stat['end']) && $stat['allItems'] > ($pointer+1)*$resPerPage)      {
+                                                                       $stat['end']=$stat['allItems']-1;
+                                                               }
+
+                                                                       // If end-point is reached, unset following items.
+                                                               if (isset($stat['end']))        {
+                                                                       unset($pArray[$k.'_'][$table][$oid]);
+                                                               }
+                                                       }
+
+                                                               // Clean-up if no more items:
+                                                       if (!count($pArray[$k.'_'][$table]))    {
+                                                               unset($pArray[$k.'_'][$table]);
+                                                       }
+                                               }
+
+                                                       // Clean-up if no more items:
+                                               if (!count($pArray[$k.'_']))    {
+                                                       unset($pArray[$k.'_']);
+                                               }
+                                       }
+
+                                               // Call recursively for sub-rows:
+                                       if (is_array($pArray[$k.'.']))  {
+                                               $stat = $this->cropWorkspaceOverview_list($pArray[$k.'.'],$pointer,$resPerPage,$stat);
+                                       }
+                               }
+                       }
+               }
+               return $stat;
+       }
+
+       /**
+        * Create indentation, icon and title for the page tree identification for the list.
+        *
+        * @param       integer         Page UID (record will be looked up again)
+        * @param       string          Page title
+        * @param       integer         Depth counter from displayWorkspaceOverview_list() used to indent the icon and title
+        * @return      string          HTML content
+        */
+       function displayWorkspaceOverview_pageTreeIconTitle($pageUid, $title, $indentCount)     {
+               $pRec = t3lib_BEfunc::getRecord('pages',$pageUid);
+               return '<img src="clear.gif" width="1" height="1" hspace="'.($indentCount * $this->pageTreeIndent).'" align="top" alt="" />'.   // Indenting page tree
+                       t3lib_iconWorks::getIconImage('pages',$pRec,$this->doc->backPath,' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($pRec,'pages').'"').
+                       htmlspecialchars(t3lib_div::fixed_lgd_cs($title,$this->pageTreeIndent_titleLgd)).
+                       '&nbsp;&nbsp;';
+       }
+
+       /**
+        * Formatting the version number for HTML output
+        *
+        * @param       integer         Version number
+        * @return      string          Version number for output
+        */
+       function formatVerId($verId)    {
+               return '1.'.$verId;
+       }
+
+
+       /**
+        * Formatting workspace ID into a visual label
+        *
+        * @param       integer         Workspace ID
+        * @return      string          Workspace title
+        */
+       function formatWorkspace($wsid) {
+
+               // Render, if not cached:
+               if (!isset($this->formatWorkspace_cache[$wsid]))        {
+                       switch($wsid)   {
+                               case -1:
+                                       $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...
+                                       break;
+                               default:
+                                       list($titleRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('title','sys_workspace','uid='.intval($wsid).t3lib_BEfunc::deleteClause('sys_workspace'));
+                                       $this->formatWorkspace_cache[$wsid] = '['.$wsid.'] '.$titleRec['title'];
+                                       break;
+                       }
+               }
+
+               return $this->formatWorkspace_cache[$wsid];
+       }
+
+
+       /**
+        * Create visual difference view of two records. Using t3lib_diff library
+        *
+        * @param       string          Table name
+        * @param       array           New version record (green)
+        * @param       array           Old version record (red)
+        * @return      array           Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change
+        */
+       function createDiffView($table, $diff_1_record, $diff_2_record) {
+               global $TCA, $LANG;
+
+               // Initialize:
+               $pctChange = 'N/A';
+
+               // Check that records are arrays:
+               if (is_array($diff_1_record) && is_array($diff_2_record))       {
+
+                       // Load full table description and initialize diff-object:
+                       t3lib_div::loadTCA($table);
+                       $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
+
+                       // Add header row:
+                       $tRows = array();
+                       $tRows[] = '
+                               <tr class="bgColor5 tableheader">
+                                       <td>' . $LANG->getLL('diffview_label_field_name') . '</td>
+                                       <td width="98%" nowrap="nowrap">' . $LANG->getLL('diffview_label_colored_diff_view') . '</td>
+                               </tr>
+                       ';
+
+                       // Initialize variables to pick up string lengths in:
+                       $allStrLen = 0;
+                       $diffStrLen = 0;
+
+                       // Traversing the first record and process all fields which are editable:
+                       foreach($diff_1_record as $fN => $fV)   {
+                               if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type']!='passthrough' && !t3lib_div::inList('t3ver_label',$fN))     {
+
+                                       // Check if it is files:
+                                       $isFiles = FALSE;
+                                       if (strcmp(trim($diff_1_record[$fN]),trim($diff_2_record[$fN])) &&
+                                       $TCA[$table]['columns'][$fN]['config']['type']=='group' &&
+                                       $TCA[$table]['columns'][$fN]['config']['internal_type']=='file')        {
+
+                                               // Initialize:
+                                               $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder'];
+                                               $files1 = array_flip(t3lib_div::trimExplode(',', $diff_1_record[$fN],1));
+                                               $files2 = array_flip(t3lib_div::trimExplode(',', $diff_2_record[$fN],1));
+
+                                               // Traverse filenames and read their md5 sum:
+                                               foreach($files1 as $filename => $tmp)   {
+                                                       $files1[$filename] = @is_file(PATH_site.$uploadFolder.'/'.$filename) ? md5(t3lib_div::getUrl(PATH_site.$uploadFolder.'/'.$filename)) : $filename;
+                                               }
+                                               foreach($files2 as $filename => $tmp)   {
+                                                       $files2[$filename] = @is_file(PATH_site.$uploadFolder.'/'.$filename) ? md5(t3lib_div::getUrl(PATH_site.$uploadFolder.'/'.$filename)) : $filename;
+                                               }
+
+                                               // Implode MD5 sums and set flag:
+                                               $diff_1_record[$fN] = implode(' ',$files1);
+                                               $diff_2_record[$fN] = implode(' ',$files2);
+                                               $isFiles = TRUE;
+                                       }
+
+                                       // If there is a change of value:
+                                       if (strcmp(trim($diff_1_record[$fN]),trim($diff_2_record[$fN])))        {
+
+
+                                               // Get the best visual presentation of the value and present that:
+                                               $val1 = t3lib_BEfunc::getProcessedValue($table,$fN,$diff_2_record[$fN],0,1);
+                                               $val2 = t3lib_BEfunc::getProcessedValue($table,$fN,$diff_1_record[$fN],0,1);
+
+                                               // Make diff result and record string lenghts:
+                                               $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1,$val2,$isFiles?'div':'span');
+                                               $diffStrLen+= $t3lib_diff_Obj->differenceLgd;
+                                               $allStrLen+= strlen($val1.$val2);
+
+                                               // If the compared values were files, substituted MD5 hashes:
+                                               if ($isFiles)   {
+                                                       $allFiles = array_merge($files1,$files2);
+                                                       foreach($allFiles as $filename => $token)       {
+                                                               if (strlen($token)==32 && strstr($diffres,$token))      {
+                                                                       $filename =
+                                                                       t3lib_BEfunc::thumbCode(array($fN=>$filename),$table,$fN,$this->doc->backPath).
+                                                                       $filename;
+                                                                       $diffres = str_replace($token,$filename,$diffres);
+                                                               }
+                                                       }
+                                               }
+
+                                               // Add table row with result:
+                                               $tRows[] = '
+                                                       <tr class="bgColor4">
+                                                               <td>'.htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table,$fN))).'</td>
+                                                               <td width="98%">'.$diffres.'</td>
+                                                       </tr>
+                                               ';
+                                       } else {
+                                               // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed:
+                                               $allStrLen+=strlen($diff_1_record[$fN].$diff_2_record[$fN]);
+                                       }
+                               }
+                       }
+
+                       // Calculate final change percentage:
+                       $pctChange = $allStrLen ? ceil($diffStrLen*100/$allStrLen) : -1;
+
+                       // Create visual representation of result:
+                       if (count($tRows)>1)    {
+                               $content.= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">'.implode('',$tRows).'</table>';
+                       } else {
+                               $content.= '<span class="nobr">'.$this->doc->icons(1).$LANG->getLL('diffview_complete_match').'</span>';
+                       }
+               } else $content.= $this->doc->icons(3).$LANG->getLL('diffview_cannot_find_records');
+
+               // Return value:
+               return array($content,$pctChange);
+       }
+
+       /**
+        * Looking for versions of a record in other workspaces than the current
+        *
+        * @param       string          Table name
+        * @param       integer         Record uid
+        * @return      string          List of other workspace IDs
+        */
+       function versionsInOtherWS($table, $uid)        {
+               // Check for duplicates:
+               // Select all versions of record NOT in this workspace:
+               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                               't3ver_wsid',
+                               $table,
+                               'pid=-1
+                               AND t3ver_oid='.intval($uid).'
+                               AND t3ver_wsid!='.intval($GLOBALS['BE_USER']->workspace).// TODO should be $this->workspaceId here???
+                               ' AND (t3ver_wsid=-1 OR t3ver_wsid>0)'.
+                               t3lib_BEfunc::deleteClause($table),
+                               '',
+                               't3ver_wsid',
+                               '',
+                               't3ver_wsid'
+               );
+               if (count($rows)) {
+                       return implode(',',array_keys($rows));
+               }
+       }
+
+       /**
+        * Looks up stage changes for version and displays a formatted view on mouseover.
+        *
+        * @param       string          Table name
+        * @param       integer         Record ID
+        * @param       string          HTML string to wrap the mouseover around (should be stage change links)
+        * @return      string          HTML code.
+        */
+       function showStageChangeLog($table,$id,$stageCommands)  {
+               global  $LANG;
+
+               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                               'log_data,tstamp,userid',
+                               'sys_log',
+                               'action=6 and details_nr=30
+                               AND tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_log').'