TYPO3 API  SVNRelease
index.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Module: Workspace manager
00029  *
00030  * $Id: index.php 10334 2011-01-26 15:02:44Z tolleiv $
00031  *
00032  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00033  * @author  Dmitry Dulepov <typo3@accio.lv>
00034  */
00035 /**
00036  * [CLASS/FUNCTION INDEX of SCRIPT]
00037  *
00038  *
00039  *
00040  *  101: class SC_mod_user_ws_index extends t3lib_SCbase
00041  *
00042  *              SECTION: Standard module initialization
00043  *  128:     function menuConfig()
00044  *  175:     function init()
00045  *  233:     function main()
00046  *  280:     function printContent()
00047  *
00048  *              SECTION: Module content: Publish
00049  *  310:     function moduleContent_publish()
00050  *  411:     function displayVersionDetails($details)
00051  *  420:     function displayWorkspaceOverview()
00052  *
00053  *              SECTION: Module content: Workspace list
00054  *  461:     function moduleContent_workspaceList()
00055  *  476:     function workspaceList_displayUserWorkspaceList()
00056  *  553:     function workspaceList_getUserWorkspaceList()
00057  *  592:     function workspaceList_formatWorkspaceData(&$wksp)
00058  *  634:     function workspaceList_getWebMountPoints(&$wksp)
00059  *  683:     function workspaceList_getFileMountPoints(&$wksp)
00060  *  736:     function workspaceList_displayUserWorkspaceListHeader()
00061  *  756:     function workspaceList_getUserList(&$wksp)
00062  *  783:     function workspaceList_getUserListForSysWorkspace(&$wksp)
00063  *  810:     function workspaceList_getUserListWithAccess(&$list, $access)
00064  *  883:     function workspaceList_displayIcons($currentWorkspace, &$wksp)
00065  *  931:     function workspaceList_hasEditAccess(&$wksp)
00066  *  943:     function workspaceList_createFakeWorkspaceRecord($uid)
00067  *
00068  * TOTAL FUNCTIONS: 20
00069  * (This index is automatically created/updated by the extension "extdeveval")
00070  *
00071  */
00072 
00073     // Initialize module:
00074 unset($MCONF);
00075 require ('conf.php');
00076 require ($BACK_PATH.'init.php');
00077 require ($BACK_PATH.'template.php');
00078 $BE_USER->modAccess($MCONF,1);
00079 
00080     // Include libraries of various kinds used inside:
00081 $LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
00082 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
00083 require_once('class.wslib.php');
00084 require_once('class.wslib_gui.php');
00085 
00086 
00087 
00088 
00089 /**
00090  * Module: Workspace manager
00091  *
00092  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00093  * @package TYPO3
00094  * @subpackage core
00095  */
00096 class SC_mod_user_ws_index extends t3lib_SCbase {
00097 
00098         // Default variables for backend modules
00099     var $MCONF = array();               // Module configuration
00100     var $MOD_MENU = array();            // Module menu items
00101     var $MOD_SETTINGS = array();        // Module session settings
00102 
00103     /**
00104      * Document Template Object
00105      *
00106      * @var noDoc
00107      */
00108     var $doc;
00109     var $content;                       // Accumulated content
00110 
00111 
00112         // Internal:
00113     var $publishAccess = FALSE;
00114     var $be_user_Array = array();
00115     var $be_user_Array_full = array();  // not blinded, used by workspace listing
00116     protected $showDraftWorkspace = FALSE;  // Determines whether the draft workspace is shown
00117 
00118 
00119     /*********************************
00120      *
00121      * Standard module initialization
00122      *
00123      *********************************/
00124 
00125     /**
00126      * Initialize menu configuration
00127      *
00128      * @return  void
00129      */
00130     function menuConfig()   {
00131         global  $LANG;
00132 
00133             // fetches the configuration of the version extension
00134         $versionExtconf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['version']);
00135             // show draft workspace only if enabled in the version extensions config
00136         if($versionExtconf['showDraftWorkspace']) {
00137             $this->showDraftWorkspace = TRUE;
00138         }
00139 
00140             // Menu items:
00141         $this->MOD_MENU = array(
00142             'function' => array(
00143                 'publish' => $LANG->getLL('menuitem_review'),
00144                 'workspaces' => $LANG->getLL('menuitem_workspaces'),
00145             ),
00146             'filter' => array(
00147                 1 => $LANG->getLL('filter_drafts'),
00148                 2 => $LANG->getLL('filter_archive'),
00149                 0 => $LANG->getLL('filter_all'),
00150             ),
00151             'display' => array(
00152                 0 => '['.$LANG->getLL('shortcut_onlineWS').']',
00153                 -98 => $LANG->getLL('label_offlineWSes'),
00154                 -99 => $LANG->getLL('label_allWSes')
00155             ),
00156             'diff' => array(
00157                 0 => $LANG->getLL('diff_no_diff'),
00158                 1 => $LANG->getLL('diff_show_inline'),
00159                 2 => $LANG->getLL('diff_show_popup'),
00160             ),
00161             'expandSubElements' => '',
00162         );
00163 
00164             // check if draft workspace was enabled, and if the user has access to it
00165         if ($this->showDraftWorkspace === TRUE && $GLOBALS['BE_USER']->checkWorkspace(array('uid' => -1))) {
00166             $this->MOD_MENU['display'][-1] = '[' . $LANG->getLL('shortcut_offlineWS') . ']';
00167         }
00168 
00169             // Add workspaces:
00170         if ($GLOBALS['BE_USER']->workspace===0) {   // Spend time on this only in online workspace because it might take time:
00171             $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers','sys_workspace','pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'),'','title');
00172             foreach($workspaces as $rec)    {
00173                 if ($GLOBALS['BE_USER']->checkWorkspace($rec))  {
00174                     $this->MOD_MENU['display'][$rec['uid']] = '[' . $rec['uid'] . '] ' . htmlspecialchars($rec['title']);
00175                 }
00176             }
00177         }
00178 
00179             // CLEANSE SETTINGS
00180         $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name'], 'ses');
00181     }
00182 
00183     /**
00184      * Executes action for selected elements, if any is sent:
00185      */
00186     function execute()  {
00187         $post = t3lib_div::_POST();
00188 
00189 #       debug($post);
00190 
00191         if ($post['_with_selected_do']) {
00192             if (is_array($post['items']) && count($post['items']))  {
00193                 $cmdArray = array();
00194 
00195                 foreach($post['items'] as $item => $v)  {
00196                     list($table,$uid) = explode(':',$item,2);
00197 
00198                     if ($GLOBALS['TCA'][$table] && t3lib_div::testInt($uid))    {
00199                         switch($post['_with_selected_do'])  {
00200                             case "stage_-1":
00201                                 $cmdArray[$table][$uid]['version']['action'] = 'setStage';
00202                                 $cmdArray[$table][$uid]['version']['stageId'] = -1;
00203                             break;
00204                             case "stage_0":
00205                                 $cmdArray[$table][$uid]['version']['action'] = 'setStage';
00206                                 $cmdArray[$table][$uid]['version']['stageId'] = 0;
00207                             break;
00208                             case "stage_1":
00209                                 $cmdArray[$table][$uid]['version']['action'] = 'setStage';
00210                                 $cmdArray[$table][$uid]['version']['stageId'] = 1;
00211                             break;
00212                             case "stage_10":
00213                                 $cmdArray[$table][$uid]['version']['action'] = 'setStage';
00214                                 $cmdArray[$table][$uid]['version']['stageId'] = 10;
00215                             break;
00216                             case "publish":
00217                                 if ($onlineRec = t3lib_BEfunc::getLiveVersionOfRecord($table,$uid,'uid'))   {
00218                                     $cmdArray[$table][$onlineRec['uid']]['version']['action'] = 'swap';
00219                                     $cmdArray[$table][$onlineRec['uid']]['version']['swapWith'] = $uid;
00220                                 }
00221                             break;
00222                             case "swap":
00223                             if ($onlineRec = t3lib_BEfunc::getLiveVersionOfRecord($table,$uid,'uid'))   {
00224                                 $cmdArray[$table][$onlineRec['uid']]['version']['action'] = 'swap';
00225                                 $cmdArray[$table][$onlineRec['uid']]['version']['swapWith'] = $uid;
00226                                 $cmdArray[$table][$onlineRec['uid']]['version']['swapIntoWS'] = 1;
00227                             }
00228                             break;
00229                             case "release":
00230                                 $cmdArray[$table][$uid]['version']['action'] = 'clearWSID';
00231                             break;
00232                             case "flush":
00233                                 $cmdArray[$table][$uid]['version']['action'] = 'flush';
00234                             break;
00235                         }
00236                     }
00237                 }
00238 
00239                 /** @var $tce t3lib_TCEmain */
00240                 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00241                 $tce->stripslashes_values = 0;
00242                 $tce->start(array(), $cmdArray);
00243                 $tce->process_cmdmap();
00244                 $tce->printLogErrorMessages('');
00245             }
00246         }
00247     }
00248 
00249     /**
00250      * Standard init function of a module.
00251      *
00252      * @return  void
00253      */
00254     function init() {
00255         global $BACK_PATH, $BE_USER;
00256 
00257             // Setting module configuration:
00258         $this->MCONF = $GLOBALS['MCONF'];
00259 
00260             // Initialize Document Template object:
00261         $this->doc = t3lib_div::makeInstance('template');
00262         $this->doc->backPath = $BACK_PATH;
00263         $this->doc->setModuleTemplate('templates/ws.html');
00264 
00265             // JavaScript
00266         $this->doc->JScode = $this->doc->wrapScriptTags('
00267             script_ended = 0;
00268             function jumpToUrl(URL) {   //
00269                 window.location.href = URL;
00270             }
00271 
00272             function expandCollapse(rowNumber) {
00273                 elementId = "wl_" + rowNumber;
00274                 element = document.getElementById(elementId);
00275                 image = document.getElementById("spanw1_" + rowNumber);
00276                 if (element.style)  {
00277                     if (element.style.display == "none")    {
00278                         element.style.display = "table-row";
00279                         image.className = "t3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-table-collapse";
00280                     } else {
00281                         element.style.display = "none";
00282                         image.className = "t3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-table-expand";
00283                     }
00284                 }
00285             }
00286         ');
00287         $this->doc->form = '<form action="index.php" method="post" name="pageform">';
00288 
00289             // Setting up the context sensitive menu:
00290         $this->doc->getContextMenuCode();
00291 
00292             // Setting publish access permission for workspace:
00293         $this->publishAccess = $BE_USER->workspacePublishAccess($BE_USER->workspace);
00294 
00295             // Parent initialization:
00296         parent::init();
00297     }
00298 
00299     /**
00300      * Main function for Workspace Manager module.
00301      *
00302      * @return  void
00303      */
00304     function main() {
00305         global $LANG, $BE_USER, $BACK_PATH;
00306 
00307         // See if we need to switch workspace
00308         $changeWorkspace = t3lib_div::_GET('changeWorkspace');
00309         if ($changeWorkspace != '') {
00310             $BE_USER->setWorkspace($changeWorkspace);
00311             $this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . t3lib_BEfunc::getBackendScript() . '";');
00312         } else {
00313                 // Starting page:
00314             $this->content.=$this->doc->header($LANG->getLL('title'));
00315             $this->content.=$this->doc->spacer(5);
00316 
00317             // Get usernames and groupnames
00318             $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
00319             $groupArray = array_keys($be_group_Array);
00320             // Need 'admin' field for t3lib_iconWorks::getIconImage()
00321             $this->be_user_Array_full = $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');
00322             if (!$GLOBALS['BE_USER']->isAdmin()) {
00323                 $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array,$groupArray,1);
00324             }
00325 
00326             // Build top menu:
00327             $menuItems = array();
00328             $menuItems[] = array(
00329                 'label' => $LANG->getLL('menuitem_review'),
00330                 'content' => $this->moduleContent_publish()
00331             );
00332             $menuItems[] = array(
00333                 'label' => $LANG->getLL('menuitem_workspaces'),
00334                 'content' => $this->moduleContent_workspaceList()
00335             );
00336 
00337                 // Add hidden fields and create tabs:
00338             $content = $this->doc->getDynTabMenu($menuItems, 'user_ws');
00339             $this->content.=$this->doc->section('',$content,0,1);
00340 
00341                 // Setting up the buttons and markers for docheader
00342             $docHeaderButtons = $this->getButtons();
00343             // $markers['CSH'] = $docHeaderButtons['csh'];
00344 
00345         }
00346         $markers['CONTENT'] = $this->content;
00347 
00348             // Build the <body> for the module
00349         $this->content = $this->doc->startPage($LANG->getLL('title'));
00350         $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00351         $this->content.= $this->doc->endPage();
00352         $this->content = $this->doc->insertStylesAndJS($this->content);
00353 
00354     }
00355 
00356     /**
00357      * Print module content. Called as last thing in the global scope.
00358      *
00359      * @return  void
00360      */
00361     function printContent() {
00362         echo $this->content;
00363     }
00364 
00365     /**
00366      * Create the panel of buttons for submitting the form or otherwise perform operations.
00367      *
00368      * @return  array   all available buttons as an assoc. array
00369      */
00370     protected function getButtons() {
00371         global $LANG, $BACK_PATH;
00372 
00373         $buttons = array(
00374             'new_record' => '',
00375         );
00376 
00377         $newWkspUrl = 'workspaceforms.php?action=new';
00378 
00379             // workspace creation link
00380         if ($GLOBALS['BE_USER']->isAdmin() || 0 != ($GLOBALS['BE_USER']->groupData['workspace_perms'] & 4)) {
00381             $buttons['new_record'] = '<a href="' . $newWkspUrl . '">' .
00382                         '<img ' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/add_workspaces.gif') . ' alt="' . $LANG->getLL('img_title_create_new_workspace') . '" id="ver-wl-new-workspace-icon" />' .
00383                         '</a>';
00384         }
00385         return $buttons;
00386     }
00387 
00388 
00389 
00390 
00391 
00392 
00393 
00394 
00395 
00396 
00397 
00398     /*********************************
00399      *
00400      * Module content: Publish
00401      *
00402      *********************************/
00403 
00404     /**
00405      * Rendering the content for the publish and review panel in the workspace manager
00406      *
00407      * @return  string      HTML content
00408      */
00409     function moduleContent_publish()    {
00410         global  $LANG;
00411 
00412             // Initialize:
00413         $content = '';
00414         $details = t3lib_div::_GP('details');
00415 
00416             // Create additional menus:
00417         $menu = '';
00418         if ($GLOBALS['BE_USER']->workspace===0) {
00419             $menu.= t3lib_BEfunc::getFuncMenu(0,'SET[filter]',$this->MOD_SETTINGS['filter'],$this->MOD_MENU['filter']);
00420             $menu.= t3lib_BEfunc::getFuncMenu(0,'SET[display]',$this->MOD_SETTINGS['display'],$this->MOD_MENU['display']);
00421         }
00422         $menu.= t3lib_BEfunc::getFuncMenu(0,'SET[diff]',$this->MOD_SETTINGS['diff'],$this->MOD_MENU['diff']);
00423         if ($GLOBALS['BE_USER']->workspace!==0) {
00424             $menu.= t3lib_BEfunc::getFuncCheck(0,'SET[expandSubElements]',$this->MOD_SETTINGS['expandSubElements'],'','','id="checkExpandSubElements"').' <label for="checkExpandSubElements">'.$LANG->getLL('label_showsubelements').'</label> ';
00425         }
00426 
00427             // Create header:
00428         $title = '';
00429         $description = '';
00430         switch($GLOBALS['BE_USER']->workspace)  {
00431             case 0:
00432                 $title = t3lib_iconWorks::getIconImage('sys_workspace', array(), $this->doc->backPath, ' align="top"').'['.$LANG->getLL('shortcut_onlineWS').']';
00433                 $description = $LANG->getLL('workspace_description_live');
00434             break;
00435             case -1:
00436                 $title = t3lib_iconWorks::getIconImage('sys_workspace', array(), $this->doc->backPath, ' align="top"').'['.$LANG->getLL('shortcut_offlineWS').']';
00437                 $description = $LANG->getLL('workspace_description_draft');
00438             break;
00439             case -99:
00440                 $title = $this->doc->icons(3).'[' . $LANG->getLL('shortcut_noWSfound') . ']';
00441                 $description = $LANG->getLL('workspace_description_no_access');
00442             break;
00443             default:
00444                 $title = t3lib_iconWorks::getIconImage('sys_workspace', $GLOBALS['BE_USER']->workspaceRec, $this->doc->backPath, ' align="top"').
00445                             '['.$GLOBALS['BE_USER']->workspace.'] '.t3lib_BEfunc::getRecordTitle('sys_workspace',$GLOBALS['BE_USER']->workspaceRec,TRUE);
00446                 $description = $GLOBALS['BE_USER']->workspaceRec['description'];
00447             break;
00448         }
00449 
00450             // Buttons for publish / swap:
00451         $actionLinks = '';
00452         if ($GLOBALS['BE_USER']->workspace!==0) {
00453             if ($this->publishAccess)   {
00454                 $confirmation = $LANG->JScharCode($LANG->getLL(($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1) ? 'submit_publish_workspace_confirmation_1' :  'submit_publish_workspace_confirmation_2'));
00455                 $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"/>';
00456                 if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
00457                     $confirmation = $LANG->JScharCode($LANG->getLL(($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1) ? 'submit_swap_workspace_confirmation_1' :  'submit_swap_workspace_confirmation_2'));
00458                     $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 ;" />';
00459                 }
00460             } else {
00461                 $actionLinks.= $this->doc->icons(1) . $LANG->getLL('no_publish_permission');
00462             }
00463 
00464                 // Preview of workspace link
00465             if (t3lib_div::_POST('_previewLink'))   {
00466                 $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours'));
00467                 $ttlHours = ($ttlHours ? $ttlHours : 24*2);
00468                 $previewUrl = t3lib_BEfunc::getViewDomain($this->id) . '/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']);
00469                 $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>';
00470             } else {
00471                 $actionLinks.= '<input type="submit" name="_previewLink" value="Generate Workspace Preview Link" />';
00472             }
00473         }
00474 
00475         $wsAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspaceRec);
00476 
00477             // Add header to content variable:
00478         $content = '
00479         <table border="0" cellpadding="0" cellspacing="0" id="t3-user-ws-wsinfotable" class="t3-table t3-table-info">
00480             <tr>
00481                 <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_workspace') . '&nbsp;</th>
00482                 <td nowrap="nowrap">' . $title . '</td>
00483             </tr>
00484             <tr>' . ($description ? '
00485                 <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_description') . '&nbsp;</td>
00486                 <td>' . $description . '</td>
00487             </tr>' : '') . ($GLOBALS['BE_USER']->workspace!=-99 && !$details ? '
00488             <tr>
00489                 <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_options') . '&nbsp;</td>
00490                 <td>' . $menu . $actionLinks . '</td>
00491             </tr>
00492             <tr>
00493                 <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_status') . '&nbsp;</td>
00494                 <td>' . $LANG->getLL('label_access_level') . ' ' . $GLOBALS['LANG']->getLL('workspace_list_access_' . $wsAccess['_ACCESS']) . '</td>
00495             </tr>' : '').'
00496         </table>
00497         <br />
00498         ';
00499 
00500             // Add publishing and review overview:
00501         if ($GLOBALS['BE_USER']->workspace!=-99)    {
00502             if ($details)   {
00503                 $content.= $this->displayVersionDetails($details);
00504             } else {
00505                 $content.= $this->displayWorkspaceOverview();
00506             }
00507             $content .= '<br />';
00508         }
00509 
00510             // Return content:
00511         return $content;
00512     }
00513 
00514     /**
00515      * Display details for a single version from workspace
00516      *
00517      * @param   string      Version identification, made of table and uid
00518      * @return  string      HTML string
00519      */
00520     function displayVersionDetails($details)    {
00521         return 'TODO: Show details for version "'.$details.'"<hr/><a href="index.php">BACK</a>';
00522     }
00523 
00524     /**
00525      * Rendering the overview of versions in the current workspace
00526      *
00527      * @return  string      HTML (table)
00528      */
00529     function displayWorkspaceOverview() {
00530 
00531             // Initialize Workspace ID and filter-value:
00532         if ($GLOBALS['BE_USER']->workspace===0) {
00533             $wsid = $this->MOD_SETTINGS['display'];     // Set wsid to the value from the menu (displaying content of other workspaces)
00534             $filter = $this->MOD_SETTINGS['filter'];
00535         } else {
00536             $wsid = $GLOBALS['BE_USER']->workspace;
00537             $filter = 0;
00538         }
00539 
00540             // Instantiate workspace GUI library and generate workspace overview
00541         $wslibGuiObj = t3lib_div::makeInstance('wslib_gui');
00542         $wslibGuiObj->diff = $this->MOD_SETTINGS['diff'];
00543         $wslibGuiObj->expandSubElements = $this->MOD_SETTINGS['expandSubElements'];
00544         $wslibGuiObj->alwaysDisplayHeader = true;
00545         return $wslibGuiObj->getWorkspaceOverview($this->doc, $wsid, $filter);
00546     }
00547 
00548 
00549 
00550 
00551 
00552 
00553 
00554 
00555 
00556 
00557 
00558 
00559 
00560     /********************************
00561      *
00562      * Module content: Workspace list
00563      *
00564      ********************************/
00565 
00566     /**
00567      * Rendering of the workspace list
00568      *
00569      * @return  string      HTML
00570      */
00571     function moduleContent_workspaceList()  {
00572         // Original Kasper's TODO: Workspace listing
00573         //
00574         //  - 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.
00575         //  - SWITCHING: Switching between available workspaces is done by a button shown for each in the list
00576         //  - 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)
00577         //  - 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!).
00578         return $this->workspaceList_displayUserWorkspaceList();
00579     }
00580 
00581     /**
00582      * Generates HTML to display a list of workspaces.
00583      *
00584      * @return  string      Generated HTML code
00585      */
00586     function workspaceList_displayUserWorkspaceList()   {
00587         global  $BACK_PATH, $LANG;
00588 
00589             // table header
00590         $content = $this->workspaceList_displayUserWorkspaceListHeader();
00591 
00592             // get & walk workspace list generating content
00593         $wkspList = $this->workspaceList_getUserWorkspaceList();
00594         $rowNum = 1;
00595         foreach ($wkspList as $wksp)    {
00596             $currentWksp = ($GLOBALS['BE_USER']->workspace == $wksp['uid']);
00597 
00598             // Each workspace data occupies two rows:
00599             // (1) Folding + Icons + Title + Description
00600             // (2) Information about workspace (initially hidden)
00601 
00602             $cssClass = ($currentWksp ? 't3-row t3-row-active bgColor3' : 't3-row bgColor4');
00603                 // Start first row
00604             $content .= '<tr class="' . $cssClass . '">';
00605 
00606                 // row #1, column #1: expand icon
00607             $content .= '<td>' .
00608                         '<a href="javascript:expandCollapse(' . $rowNum . ')">' .
00609                         t3lib_iconWorks::getSpriteIcon('actions-view-table-expand', array(
00610                             'title' => $LANG->getLL('img_title_show_more'),
00611                             'id' => 'spanw1_' . $rowNum
00612                         )) .
00613                         '</a></td>';
00614 
00615                 // row #1, column #2: icon panel
00616             $content .= '<td nowrap="nowrap">'; // Mozilla Firefox will attempt wrap due to `width="1"` on topmost column
00617             $content .= $this->workspaceList_displayIcons($currentWksp, $wksp);
00618             $content .= '</td>';
00619 
00620                 // row #1, column #3: current workspace indicator
00621             $content .= '<td nowrap="nowrap" style="text-align: center">';  // Mozilla Firefox will attempt wrap due to `width="1"` on topmost column
00622             $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') . '" />');
00623             $content .= '</td>';
00624 
00625                 // row #1, column #4 and 5: title and description
00626             $content .= '<td nowrap="nowrap">' . htmlspecialchars($wksp['title']) . '</td>' .
00627                         '<td>' . nl2br(htmlspecialchars($wksp['description'])) . '</td>';
00628             $content .= '</tr>';
00629 
00630                 // row #2, column #1 and #2
00631             $content .= '<tr id="wl_' . $rowNum . '" class="bgColor" style="display: none">';
00632             $content .= '<td colspan="2" style="border-right: none;">&nbsp;</td>';
00633 
00634                 // row #2, column #3, #4 and #4
00635             $content .= '<td colspan="3" style="border-left: none;">' .
00636                         $this->workspaceList_formatWorkspaceData($wksp) .
00637                         '</td>';
00638 
00639             $content .= '</tr>';
00640             $rowNum++;
00641         }
00642         $content .= '</table>';
00643 
00644         return $content;
00645     }
00646 
00647 
00648 
00649 
00650 
00651     /**
00652      * Retrieves a list of workspaces where user has access.
00653      *
00654      * @return  array       A list of workspaces available to the current BE user
00655      */
00656     function workspaceList_getUserWorkspaceList()   {
00657 
00658             // Get list of all workspaces. Note: system workspaces will be always displayed before custom ones!
00659         $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','sys_workspace','pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'),'','title');
00660         $availableWorkspaces = array();
00661 
00662             // Live
00663         $wksp = $this->workspaceList_createFakeWorkspaceRecord(0);
00664         $wksp = $GLOBALS['BE_USER']->checkWorkspace($wksp);
00665         if (false !== $wksp) {
00666             $availableWorkspaces[] = $wksp;
00667         }
00668 
00669             // Draft
00670         $wksp = $this->workspaceList_createFakeWorkspaceRecord(-1);
00671         $wksp = $GLOBALS['BE_USER']->checkWorkspace($wksp);
00672         if (false !== $wksp) {
00673             $availableWorkspaces[] = $wksp;
00674         }
00675 
00676             // Custom
00677         foreach($workspaces as $rec)    {
00678                 // see if user can access this workspace in any way
00679             if (false !== ($result = $GLOBALS['BE_USER']->checkWorkspace($rec)))    {
00680                 $availableWorkspaces[] = $result;   // `$result` contains `$rec` plus access type through '_ACCESS' key
00681             }
00682         }
00683         return $availableWorkspaces;
00684     }
00685 
00686     /**
00687      * Create inner information panel for workspace list. This panel is
00688      * initially hidden and becomes visible when user click on the expand
00689      * icon on the very left of workspace list against the workspace he
00690      * wants to explore.
00691      *
00692      * @param   array       Workspace information
00693      * @return  string      Formatted workspace information
00694      */
00695     function workspaceList_formatWorkspaceData(&$wksp)  {
00696         global $LANG;
00697 
00698         $content = '<table cellspacing="0" cellpadding="0" width="100%" class="ver-wl-details-table">' .
00699                 '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_file_mountpoints') . '</strong></td>' .
00700                 '<td class="ver-wl-details">' . $this->workspaceList_getFileMountPoints($wksp) . '</td></tr>' .
00701                 '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_db_mountpoints') . '</strong></td>' .
00702                 '<td class="ver-wl-details">' . $this->workspaceList_getWebMountPoints($wksp) . '</td></tr>';
00703         if ($wksp['uid'] > 0) {
00704             // Displaying information below makes sence only for custom workspaces
00705             $content .=
00706                 '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_frozen') . '</strong></td>' .
00707                 '<td class="ver-wl-details">' . $LANG->getLL($wksp['freeze'] ? 'workspace_list_label_frozen_yes' : 'workspace_list_label_frozen_no') . '</td></tr>' .
00708                 '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_publish_date') . '</strong></td>' .
00709                 '<td class="ver-wl-details">' . ($wksp['publish_time'] == 0 ? '&nbsp;&ndash;' : t3lib_BEfunc::datetime($wksp['publish_time'])) . '</td></tr>' .
00710                 '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_unpublish_date') . '</strong></td>' .
00711                 '<td class="ver-wl-details">' . ($wksp['unpublish_time'] == 0 ? '&nbsp;&ndash;' : t3lib_BEfunc::datetime($wksp['unpublish_time'])) . '</td></tr>' .
00712                 '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_your_access') . '</strong></td>' .
00713                 '<td class="ver-wl-details">' . $LANG->getLL('workspace_list_access_' . $wksp['_ACCESS']) . '</td></tr>' .
00714                 '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_workspace_users') . '</strong></td>' .
00715                 '<td class="ver-wl-details">' . $this->workspaceList_getUserList($wksp) . '</td></tr>';
00716         }
00717         else if ($GLOBALS['BE_USER']->isAdmin()) {
00718             // show users for draft/live workspace only to admin users
00719             $content .= '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_workspace_users') . '</strong></td>' .
00720                 '<td class="ver-wl-details">' . $this->workspaceList_getUserList($wksp) . '</td></tr>';
00721         }
00722         $content .= '</table>';
00723 
00724         return $content;
00725     }
00726 
00727 
00728 
00729 
00730 
00731     /**
00732      * Retrieves and formats database mount points lists.
00733      *
00734      * @param   array       &$wksp  Workspace record
00735      * @return  string      Generated HTML
00736      */
00737     function workspaceList_getWebMountPoints(&$wksp)    {
00738         if ($wksp['uid'] == -1) {
00739                 // draft workspace
00740             return $GLOBALS['LANG']->getLL('workspace_list_db_mount_point_draft');
00741         } else if ($wksp['uid'] == 0) {
00742                 // live workspace
00743             return $GLOBALS['LANG']->getLL('workspace_list_db_mount_point_live');
00744         }
00745         // -- here only if obtaining mount points for custom workspaces
00746 
00747             // We need to fetch user's mount point list (including MPS mounted from groups).
00748             // This list must not be affects by current user's workspace. It means we cannot use
00749             // $BE_USER->isInWebMount() to check mount points.
00750         $mountpointList = $GLOBALS['BE_USER']->groupData['webmounts'];
00751             // If there are DB mountpoints in the workspace record,
00752             // then only show the ones that are allowed there (and that are in the users' webmounts) 
00753         if (trim($wksp['db_mountpoints'])) {
00754             $userMountpoints = explode(',', $mountpointList);
00755                 // now filter the users' to only keep the mountpoints 
00756                 // that are also in the workspaces' db_mountpoints
00757             $workspaceMountpoints = explode(',', $wksp['db_mountpoints']);
00758             $filteredMountpoints = array_intersect($userMountpoints, $workspaceMountpoints);
00759             $mountpointList = implode(',', $filteredMountpoints);
00760         }
00761 
00762         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00763             '*',    // All fields needed for t3lib_iconWorks::getSpriteIconForRecord()
00764             'pages',
00765             'deleted = 0 AND uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($mountpointList) . ')',
00766             '',
00767             'title'
00768         );
00769 
00770         $content = array();
00771         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00772                 // will show UID on hover. Just convinient to user.
00773             $content[] = t3lib_iconWorks::getSpriteIconForRecord('pages', $row) . '<span title="UID: ' . $row['uid'] . '">' . $row['title'] . '</span>';
00774         }
00775 
00776         if (count($content)) {
00777             return implode('<br />', $content);
00778         } else {
00779                 // no mount points
00780             return $GLOBALS['LANG']->getLL('workspace_list_db_mount_point_custom');
00781         }
00782     }
00783 
00784 
00785     /**
00786      * Retrieves and formats file mount points lists.
00787      *
00788      * @param   array       &$wksp  Workspace record
00789      * @return  string      Generated HTML
00790      */
00791     function workspaceList_getFileMountPoints(&$wksp)   {
00792         if ($wksp['uid'] == -1) {
00793                 // draft workspace - none!
00794             return $GLOBALS['LANG']->getLL('workspace_list_file_mount_point_draft');
00795         } else if ($wksp['uid'] == 0) {
00796                 // live workspace
00797             return $GLOBALS['LANG']->getLL('workspace_list_file_mount_point_live');
00798         }
00799         // -- here only if displaying information for custom workspace
00800 
00801             // We need to fetch user's mount point list (including MPS mounted from groups).
00802             // This list must not be affects by current user's workspace. It means we cannot use
00803             // $BE_USER->isInWebMount() to check mount points.
00804         $mountpointList = implode(',', $GLOBALS['BE_USER']->groupData['filemounts']);
00805             // If there are file mountpoints in the workspace record,
00806             // then only show the ones that are allowed there (and that are in the users' file mounts) 
00807         if (trim($wksp['file_mountpoints'])) {
00808             $userMountpoints = explode(',', $mountpointList);
00809                 // now filter the users' to only keep the mountpoints 
00810                 // that are also in the workspaces' file_mountpoints
00811             $workspaceMountpoints = explode(',', $wksp['file_mountpoints']);
00812             $filteredMountpoints = array_intersect($userMountpoints, $workspaceMountpoints);
00813             $mountpointList = implode(',', $filteredMountpoints);
00814         }
00815 
00816         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00817             '*',    // All fields needed for t3lib_iconWorks::getSpriteIconForRecord()
00818             'sys_filemounts',
00819             'deleted = 0 AND hidden=0 AND uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($mountpointList) . ')',
00820             '',
00821             'title'
00822         );
00823 
00824         $content = array();
00825         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00826                 // will show UID on hover. Just convinient to user.
00827             $content[] = t3lib_iconWorks::getSpriteIconForRecord('sys_filemounts', $row) . '<span title="UID: ' . $row['uid'] . '">' . $row['title'] . '</span>';
00828         }
00829 
00830         if (count($content)) {
00831             return implode('<br />', $content);
00832         } else {
00833                 // no mount points
00834             return $GLOBALS['LANG']->getLL('workspace_list_file_mount_point_custom');
00835         }
00836     }
00837 
00838     /**
00839      * Creates a header for the workspace list table. This function only makes
00840      * <code>workspaceList_displayUserWorkspaceList()</code> smaller.
00841      *
00842      * @return  string      Generated content
00843      */
00844     function workspaceList_displayUserWorkspaceListHeader() {
00845         global  $LANG;
00846         // TODO CSH lables?
00847         return '<table border="0" cellpadding="0" cellspacing="0" class="workspace-overview">
00848             <tr class="t3-row-header">
00849                 <td width="1">&nbsp;</td>
00850                 <td width="1">&nbsp;</td>
00851                 <td nowrap="nowrap">' . $LANG->getLL('workspace_list_label_current_workspace') . '</td>
00852                 <td nowrap="nowrap">' . $LANG->getLL('workspace_list_label_workspace_title') . '</td>
00853                 <td nowrap="nowrap">' . $LANG->getLL('workspace_list_label_workspace_description') . '</td>
00854             </tr>';
00855     }
00856 
00857 
00858     /**
00859      * Generates a list of <code>&lt;option&gt;</code> tags with user names.
00860      *
00861      * @param   array       Workspace record
00862      * @return  string      Generated content
00863      */
00864     function workspaceList_getUserList(&$wksp) {
00865         global  $LANG;
00866 
00867         if ($wksp['uid'] > 0) {
00868             // custom workspaces
00869             $content = $this->workspaceList_getUserListWithAccess($wksp['adminusers'], $LANG->getLL('workspace_list_label_owners')); // owners
00870             $content .= $this->workspaceList_getUserListWithAccess($wksp['members'], $LANG->getLL('workspace_list_label_members')); // members
00871             $content .= $this->workspaceList_getUserListWithAccess($wksp['reviewers'], $LANG->getLL('workspace_list_label_reviewers')); // reviewers
00872             if ($content != '') {
00873                 $content = '<table cellpadding="0" cellspacing="1" width="100%" class="lrPadding workspace-overview">' . $content . '</table>';
00874             } else {
00875                 $content = $LANG->getLL($wksp['uid'] > 0 ? 'workspace_list_access_admins_only' : 'workspace_list_access_anyone');
00876             }
00877         }
00878         else {
00879             // live and draft workspace
00880             $content = $this->workspaceList_getUserListForSysWorkspace($wksp);
00881         }
00882         return $content;
00883     }
00884 
00885     /**
00886      * Generates a list of user names that has access to the system workspace.
00887      *
00888      * @param   array       &$wksp  Workspace record
00889      * @return  string      Generated content
00890      */
00891     function workspaceList_getUserListForSysWorkspace(&$wksp) {
00892         $option = ($wksp['uid'] == 0 ? 1 : 2);
00893         $content_array = array();
00894         foreach ($this->be_user_Array_full as $uid => $user) {
00895             if ($user['admin'] != 0 || 0 != ($user['workspace_perms'] & $option)) {
00896                 if ($uid == $GLOBALS['BE_USER']->user['uid']) {
00897                     // highlight current user
00898                     $tag0 = '<span class="ver-wl-current-user">';
00899                     $tag1 = '</span>';
00900                 }
00901                 else {
00902                     $tag0 = $tag1 = '';
00903                 }
00904                 $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage('be_users', $uid, $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $uid . '"'), 'be_users', $uid, 2).
00905                     $tag0 . htmlspecialchars($user['username']) . $tag1;
00906             }
00907         }
00908         return implode('<br />', $content_array);
00909     }
00910 
00911     /**
00912      * Generates a list of user names that has access to the workspace.
00913      *
00914      * @param   array       A list of user IDs separated by comma
00915      * @param   string      Access string
00916      * @return  string      Generated content
00917      */
00918     function workspaceList_getUserListWithAccess(&$list, $access)   {
00919         $content_array = array();
00920         if ($list != '')    {
00921             $userIDs = explode(',', $list);
00922 
00923                 // get user names and sort
00924             $regExp = '/^(be_[^_]+)_(\d+)$/';
00925             $groups = false;
00926             foreach ($userIDs as $userUID)  {
00927                 $id = $userUID;
00928 
00929                 if (preg_match($regExp, $userUID)) {
00930                     $table = preg_replace($regExp, '\1', $userUID);
00931                     $id = intval(preg_replace($regExp, '\2', $userUID));
00932                     if ($table == 'be_users') {
00933                         // user
00934                         $icon = $GLOBALS['TCA']['be_users']['typeicons'][$this->be_user_Array[$id]['admin']];
00935                         if ($id == $GLOBALS['BE_USER']->user['uid']) {
00936                             // highlight current user
00937                             $tag0 = '<span class="ver-wl-current-user">';
00938                             $tag1 = '</span>';
00939                         }
00940                         else {
00941                             $tag0 = $tag1 = '';
00942                         }
00943                         $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) .
00944                                             $tag0 . htmlspecialchars($this->be_user_Array_full[$id]['username']) . $tag1;
00945                     }
00946                     else {
00947                         // group
00948                         if (false === $groups) {
00949                             $groups = t3lib_BEfunc::getGroupNames();
00950                         }
00951                         $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage($table, $groups[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"'), $table, $id, 2) .
00952                                             $groups[$id]['title'];
00953                     }
00954                 }
00955                 else {
00956                     // user id
00957                     if ($userUID == $GLOBALS['BE_USER']->user['uid']) {
00958                         // highlight current user
00959                         $tag0 = '<span class="ver-wl-current-user">';
00960                         $tag1 = '</span>';
00961                     }
00962                     else {
00963                         $tag0 = $tag1 = '';
00964                     }
00965                     $content_array[] = t3lib_iconWorks::getIconImage('be_users', $this->be_user_Array[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"') .
00966                                         $tag0 . htmlspecialchars($this->be_user_Array_full[$userUID]['username']) . $tag1;
00967                 }
00968             }
00969             sort($content_array);
00970         }
00971         else {
00972             $content_array[] = '&nbsp;&ndash;';
00973         }
00974 
00975         $content = '<tr><td class="ver-wl-details-label ver-wl-details-user-list-label">';
00976         // TODO CSH lable explaining access here?
00977         $content .= '<strong>' . $access . '</strong></td>';
00978         $content .= '<td class="ver-wl-details">' . implode('<br />', $content_array) . '</td></tr>';
00979         return $content;
00980     }
00981 
00982 
00983 
00984     /**
00985      * Creates a list of icons for workspace.
00986      *
00987      * @param   boolean     <code>true</code> if current workspace
00988      * @param   array       Workspace record
00989      * @return  string      Generated content
00990      */
00991     function workspaceList_displayIcons($currentWorkspace, &$wksp)  {
00992         global  $BACK_PATH, $LANG;
00993 
00994         $content = '';
00995             // `edit workspace` button
00996         if ($this->workspaceList_hasEditAccess($wksp))  {
00997                 // User can modify workspace parameters, display corresponding link and icon
00998             $editUrl = 'workspaceforms.php?action=edit&amp;wkspId=' . $wksp['uid'];
00999 
01000             $content .= '<a href="' . $editUrl . '" title="'. $LANG->getLL('workspace_list_icon_title_edit_workspace') .'"/>' .
01001                     t3lib_iconWorks::getSpriteIcon('actions-document-open') .
01002             '</a>';
01003         } else {
01004                 // User can NOT modify workspace parameters, display space
01005                 // Get only withdth and height from skinning API
01006             $content .= '<img src="clear.gif" ' .
01007                     t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/edit2.gif', 'width="11" height="12"', 2) .
01008                     ' border="0" alt="" hspace="1" align="middle" />';
01009         }
01010             // `switch workspace` button
01011         if (!$currentWorkspace) {
01012                 // Workspace switching button
01013             $content .= '<a href="' .
01014                     t3lib_div::getIndpEnv('SCRIPT_NAME') .
01015                     '?changeWorkspace=' . $wksp['uid'] . '" title="'. $LANG->getLL('workspace_list_icon_title_switch_workspace') . '"/>' .
01016                     t3lib_iconWorks::getSpriteIcon('actions-version-swap-workspace') .
01017                     '</a>';
01018         } else {
01019                 // Current workspace: empty space instead of workspace switching button
01020                 //
01021                 // Here get only width and height from skinning API
01022             $content .= '<img src="clear.gif" ' .
01023                     t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/switch.png', 'width="18" height="16"', 2) .
01024                     ' border="0" alt="" hspace="1" align="middle" alt="" />';
01025         }
01026         return $content;
01027     }
01028 
01029     /**
01030      * Checks if user has edit access to workspace. Access is granted if
01031      * workspace is custom and user is admin or the the owner of the workspace.
01032      * This function assumes that <code>$wksp</code> were passed through
01033      * <code>$GLOBALS['BE_USER']->checkWorkspace()</code> function to obtain
01034      * <code>_ACCESS</code> attribute of the workspace.
01035      *
01036      * @param   array       Workspace record
01037      * @return  boolean     <code>true</code> if user can modify workspace parameters
01038      */
01039     function workspaceList_hasEditAccess(&$wksp)    {
01040         $access = &$wksp['_ACCESS'];
01041         return ($wksp['uid'] > 0 && ($access == 'admin' || $access == 'owner'));
01042     }
01043 
01044     /**
01045      * Creates a fake workspace record for system workspaces. Record contains
01046      * all fields found in <code>sys_workspaces</code>.
01047      *
01048      * @param   integer     System workspace ID. Currently <code>0</code> and <code>-1</code> are accepted.
01049      * @return  array       Generated record (see <code>sys_workspaces</code> for structure)
01050      */
01051     function workspaceList_createFakeWorkspaceRecord($uid)  {
01052         global  $BE_USER, $LANG;
01053 
01054         $record = array(
01055             'uid' => $uid,
01056             'pid' => 0,             // always 0!
01057             'tstamp' => 0,          // does not really matter
01058             'deleted' => 0,
01059             'title' => ($uid == 0 ? '['.$LANG->getLL('shortcut_onlineWS').']' : '['.$LANG->getLL('shortcut_offlineWS').']'),
01060             'description' => ($uid == 0 ? $LANG->getLL('shortcut_onlineWS') : $LANG->getLL('shortcut_offlineWS')),
01061             'adminusers' => '',
01062             'members' => '',
01063             'reviewers' => '',
01064             'db_mountpoints' => '',     // TODO get mount points from user profile
01065             'file_mountpoints' => '',   // TODO get mount points from user profile for live workspace only (uid == 0)
01066             'publish_time' => 0,
01067             'unpublish_time' => 0,
01068             'freeze' => 0,
01069             'live_edit' => ($uid == 0),
01070             'vtypes' => 0,
01071             'disable_autocreate' => 0,
01072             'swap_modes' => 0,
01073             'publish_access' => 0,
01074             'stagechg_notification' => 0
01075         );
01076         return $record;
01077     }
01078 }
01079 
01080 
01081 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/index.php'])) {
01082     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/index.php']);
01083 }
01084 
01085 
01086 
01087 // Make instance:
01088 $SOBE = t3lib_div::makeInstance('SC_mod_user_ws_index');
01089 $SOBE->execute();
01090 $SOBE->init();
01091 $SOBE->main();
01092 $SOBE->printContent();
01093 
01094 ?>