Fixed issue: #10817 DAU WS-Module warning
authorTolleiv Nietsch <info@tolleiv.de>
Tue, 16 Nov 2010 19:16:09 +0000 (19:16 +0000)
committerTolleiv Nietsch <info@tolleiv.de>
Tue, 16 Nov 2010 19:16:09 +0000 (19:16 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/CoreProjects/workspaces/workspaces/trunk@2900 743128fe-103e-dd11-99c4-001b210b3e58

typo3/sysext/workspaces/ChangeLog
typo3/sysext/workspaces/Classes/Controller/ReviewController.php
typo3/sysext/workspaces/Classes/Service/Workspaces.php
typo3/sysext/workspaces/Classes/ViewHelpers/TempFlashMessageQueueViewHelper.php [new file with mode: 0644]
typo3/sysext/workspaces/Resources/Private/Language/locallang.xml
typo3/sysext/workspaces/Resources/Private/Layouts/module.html

index 045fd47..3d024fa 100644 (file)
@@ -2,6 +2,7 @@
 
        * Fixed bug: #10778 Consider http://bugs.typo3.org/view.php?id=9508 when implementing preview link in new module
        * Fixed bug: #10819 viewOnClick causes error if frontendpreview is disabled
+       * Fixed issue: #10817 DAU WS-Module warning
 
 2010-11-12  Oliver Hader  <oliver@tpyo3.org>
 
index 4775cd0..c14fb23 100644 (file)
@@ -113,6 +113,17 @@ class Tx_Workspaces_Controller_ReviewController extends Tx_Workspaces_Controller
        protected function initializeAction() {
                parent::initializeAction();
 
+               if (tx_Workspaces_Service_Workspaces::isOldStyleWorkspaceUsed()) {
+                       $message = t3lib_div::makeInstance(
+                               't3lib_FlashMessage',
+                               $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:warning.oldStyleWorkspaceInUser'),
+                               '',
+                               t3lib_FlashMessage::WARNING
+                       );
+
+                       t3lib_FlashMessageQueue::addMessage($message);
+               }
+
                $this->pageRenderer->loadExtJS();
                $this->pageRenderer->enableExtJSQuickTips();
                $this->pageRenderer->enableExtJsDebug();
index 33f64cc..5724bf4 100644 (file)
@@ -400,6 +400,28 @@ class tx_Workspaces_Service_Workspaces {
                }
                return $permittedElements;
        }
+
+
+       /**
+        * Trivial check to see if the user already migrated his workspaces
+        * to the new style (either manually or with the migrator scripts)
+        *
+        * @return bool
+        */
+       public static function isOldStyleWorkspaceUsed() {
+               $oldStyleWorkspaceIsUsed = FALSE;
+               $cacheKey = 'workspace-oldstyleworkspace-notused';
+               $cacheResult = $GLOBALS['BE_USER']->getSessionData($cacheKey);
+               if (!$cacheResult) {
+                       $where = 'adminusers != "" AND adminusers NOT LIKE "%be_users%" AND adminusers NOT LIKE "%be_groups%" AND deleted=0';
+                       $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_workspace', $where);
+                       $oldStyleWorkspaceIsUsed = $count > 0;
+                       $GLOBALS['BE_USER']->setAndSaveSessionData($cacheKey, !$oldStyleWorkspaceIsUsed);
+               } else {
+                       $oldStyleWorkspaceIsUsed = !$cacheResult;
+               }
+               return $oldStyleWorkspaceIsUsed;
+       }
 }
 
 
diff --git a/typo3/sysext/workspaces/Classes/ViewHelpers/TempFlashMessageQueueViewHelper.php b/typo3/sysext/workspaces/Classes/ViewHelpers/TempFlashMessageQueueViewHelper.php
new file mode 100644 (file)
index 0000000..bbe3480
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * View helper which renders the FlashMessageQueu
+ *
+ * = Examples =
+ *
+ * <code title="Minimal">
+ * <f:be.flashMessageQueue />
+ * </code>
+ *
+ * Output:
+ * All FlashMessages which were registered using t3lib_FlashMessageQueue::addMessage($message);
+ *
+ * @author      Tolleiv Nietsch <info@tolleiv.de>
+ * @license     http://www.gnu.org/copyleft/gpl.html
+ * @version     SVN: $Id:
+ *
+ */
+
+/**
+ * ViewHelper to integrate the backend FlashMessageQueue into our module
+ *
+ * @todo Remove this viewHelper once http://forge.typo3.org/issues/10821 is available
+ */
+class Tx_Workspaces_ViewHelpers_TempFlashMessageQueueViewHelper extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper {
+
+
+       /**
+        * Renders a shortcut button as known from the TYPO3 backend
+        *
+        * @return string the rendered flashMessage
+        * @see template::makeShortcutIcon()
+        */
+       public function render() {
+
+               $renderedMessages = '';
+               $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
+               if (!empty($flashMessages)) {
+                       $renderedMessages = '<div id="typo3-messages">' . $flashMessages . '</div>';
+               }
+
+               return $renderedMessages;
+       }
+}
+?>
\ No newline at end of file
index 39981c7..2c15205 100644 (file)
@@ -67,6 +67,7 @@
                        <label index="window.sendToNextStageWindow.additionalRecipients">Additional recipients</label>
                        <label index="window.sendToNextStageWindow.comments">Comments</label>
                        <label index="error.getStageTitle.stageNotFound">Stage not found</label>
+                       <label index="warning.oldStyleWorkspaceInUser">It seems that you're stil using old-style workspace. If you continue using this module without migrating your workspace you might loose data.</label>
                </languageKey>
        </data>
 </T3locallang>
\ No newline at end of file
index 7b0ba19..3fd235e 100644 (file)
@@ -1,3 +1,4 @@
+{namespace this=Tx_Workspaces_ViewHelpers}
 <!-- ###FULLDOC### begin -->
 <div class="typo3-fullDoc">
 <!-- Page header with buttons, path details and csh -->
@@ -18,6 +19,9 @@
 <!-- Content of module, for instance listing, info or editing -->
 <div id="typo3-docbody">
 <div id="typo3-inner-docbody">
+
+       <this:TempFlashMessageQueue />
+
        <f:render partial="navigation" arguments="{workspaceList: workspaceList, activeWorkspaceUid: activeWorkspaceUid, showAllWorkspaceTab:showAllWorkspaceTab}" />
        <div class="typo3-dyntabmenu-divs"><f:render section="main" /></div>
        <f:if condition="{showLegend}"><f:render partial="legend" /></f:if>