Added feature #8778: Add possibility to disable TYPO3 draft workspace by localconf...
authorSusanne Moog <typo3@susannemoog.de>
Thu, 10 Jun 2010 19:13:47 +0000 (19:13 +0000)
committerSusanne Moog <typo3@susannemoog.de>
Thu, 10 Jun 2010 19:13:47 +0000 (19:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7869 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_userauthgroup.php
typo3/mod/user/ws/index.php
typo3/sysext/version/cm1/index.php

index 410842f..97130ac 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-10 Susanne Moog <typo3@susanne-moog.de>
+
+       * Added feature #8778: Add possibility to disable TYPO3 draft workspace by localconf.php configuration (Thanks to Sonja Scholz)
+
 2010-06-10 Francois Suter  <francois@typo3.org>
 
        * Fixed bug #14685: Some status reports classes have wrong XCLASS inclusion (thanks to Peter Niederlag)
index 7396e7e..0e18e63 100644 (file)
@@ -1562,7 +1562,23 @@ class t3lib_userAuthGroup extends t3lib_userAuth {
         */
        function checkWorkspace($wsRec,$fields='uid,title,adminusers,members,reviewers,publish_access,stagechg_notification')   {
                $retVal = FALSE;
-
+               
+                       // Show draft workspace only if it's enabled in version extension
+               if (t3lib_extMgm::isLoaded('version')) {
+                       $versionExtConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['version']);
+                       if (!$versionExtConf['showDraftWorkspace']) {
+                               if (!is_array($wsRec)) {
+                                       if ((string) $wsRec === '-1') {
+                                               return FALSE;
+                                       } 
+                               } else {
+                                       if ((string) $wsRec['uid'] === '-1') {
+                                               return FALSE;
+                                       } 
+                               }
+                       } 
+               } 
+               
                        // If not array, look up workspace record:
                if (!is_array($wsRec))  {
                        switch((string)$wsRec)  {
index ea7f945..83d356e 100755 (executable)
@@ -113,6 +113,7 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
        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
 
 
        /*********************************
@@ -129,6 +130,13 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
        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(
@@ -143,8 +151,7 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                        'display' => array(
                                0 => '['.$LANG->getLL('shortcut_onlineWS').']',
                                -98 => $LANG->getLL('label_offlineWSes'),
-                               -99 => $LANG->getLL('label_allWSes'),
-                               -1 => '['.$LANG->getLL('shortcut_offlineWS').']'
+                               -99 => $LANG->getLL('label_allWSes')
                        ),
                        'diff' => array(
                                0 => $LANG->getLL('diff_no_diff'),
@@ -153,7 +160,10 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                        ),
                        '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');
index 150afeb..826261f 100755 (executable)
@@ -121,6 +121,7 @@ class tx_version_cm1 extends t3lib_SCbase {
        var $be_user_Array = array();
        var $stageIndex = array();
        var $recIndex = array();
+       protected $showDraftWorkspace = FALSE; // Determines whether to show the dummy draft workspace
 
 
 
@@ -140,6 +141,13 @@ class tx_version_cm1 extends t3lib_SCbase {
         */
        function menuConfig()   {
 
+                       // 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(
                        'filter' => array(
@@ -151,10 +159,13 @@ class tx_version_cm1 extends t3lib_SCbase {
                                0 => $GLOBALS['LANG']->getLL('liveWorkspace'),
                                -98 => $GLOBALS['LANG']->getLL('draftWorkspaces'),
                                -99 => $GLOBALS['LANG']->getLL('filter_all'),
-                               -1 => $GLOBALS['LANG']->getLL('defaultDraft')
                        ),
                        'diff' => ''
                );
+               
+               if($this->showDraftWorkspace === TRUE) {
+                       $this->MOD_MENU['display'][-1] = $GLOBALS['LANG']->getLL('defaultDraft');
+               }
 
                        // Add workspaces:
                if ($GLOBALS['BE_USER']->workspace===0) {       // Spend time on this only in online workspace because it might take time:
@@ -177,7 +188,7 @@ class tx_version_cm1 extends t3lib_SCbase {
         */
        function main() {
                global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
-
+               
                        // Template markers
                $markers = array(
                        'CSH' => '',