Follow-up to bug #12154: renamed t3lib_MessageQueue to t3lib_FlashMessageQueue, chang...
authorRupert Germann <rupi@gmx.li>
Sun, 11 Oct 2009 12:32:22 +0000 (12:32 +0000)
committerRupert Germann <rupi@gmx.li>
Sun, 11 Oct 2009 12:32:22 +0000 (12:32 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6133 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_flashmessage.php
t3lib/class.t3lib_flashmessagequeue.php [new file with mode: 0644]
t3lib/class.t3lib_messagequeue.php [deleted file]
t3lib/core_autoload.php
typo3/alt_doc.php
typo3/mod/web/perm/index.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/scheduler/mod1/index.php
typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php
typo3/template.php

index 7f69917..f7157ca 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-11  Rupert Germann  <rupi@gmx.li>
+
+       * Follow-up to bug #12154: renamed t3lib_MessageQueue to t3lib_FlashMessageQueue, changed some some function names
+         in t3lib_flashmessages and t3lib_FlashMessageQueue.
+
 2009-10-10  Rupert Germann  <rupi@gmx.li>
 
        * Fixed bug #12129 (follow-up to bug #11986): Translation update broken with activated output compression (thanks to Steffen Gebert)
index e247ea6..06423a4 100644 (file)
@@ -109,9 +109,9 @@ class t3lib_FlashMessage {
        /**
         * Gets the message's storeInSession flag.
         *
-        * @return      bool    The persistence flag.
+        * @return      bool    true if message should be stored in the session, otherwise false.
         */
-       public function getStoreInSession() {
+       public function isSessionMessage() {
                return $this->storeInSession;
        }
 
diff --git a/t3lib/class.t3lib_flashmessagequeue.php b/t3lib/class.t3lib_flashmessagequeue.php
new file mode 100644 (file)
index 0000000..7e38eb4
--- /dev/null
@@ -0,0 +1,128 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Rupert Germann <rupi@gmx.li>
+*  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!
+***************************************************************/
+
+
+/**
+ *  A class which collects and renders flash messages.
+ *
+ * @author     Rupert Germann <rupi@gmx.li>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_FlashMessageQueue {
+
+       static $messages = array();
+
+       /**
+        * Static class, no instances allowed.
+        */
+       protected function __construct() {}
+
+
+       /**
+        * Adds a message either to the BE_USER session (if the $message has the storeInSession flag set)
+        * or it adds the message to self::$messages.
+        *
+        * @param       object  instance of t3lib_FlashMessage, representing a message
+        * @return      void
+        */
+       public static function addMessage(t3lib_FlashMessage $message) {
+               if ($message->isSessionMessage() === TRUE) {
+                       $queuedFlashMessages = self::getFlashMessagesFromSession();
+                       $queuedFlashMessages[] = $message;
+
+                       $GLOBALS['BE_USER']->setAndSaveSessionData(
+                               'core.template.flashMessages',
+                               $queuedFlashMessages
+                       );
+               } else {
+                       self::$messages[] = $message;
+               }
+       }
+
+       /**
+        * Returns all messages from the current PHP session and from the current request.
+        * After fetching the messages the internal queue and the message queue in the session
+        * will be emptied.
+        *
+        * @return      array   array of t3lib_FlashMessage objects
+        */
+       public static function getAllMessagesAndFlush() {
+                       // get messages from user session
+               $queuedFlashMessagesFromSession = self::getFlashMessagesFromSession();
+               if (!empty($queuedFlashMessagesFromSession)) {
+                               // reset messages in user session
+                       $GLOBALS['BE_USER']->setAndSaveSessionData(
+                               'core.template.flashMessages',
+                               null
+                       );
+               }
+
+               $queuedFlashMessages = array_merge($queuedFlashMessagesFromSession, self::$messages);
+
+                       // reset internal messages
+               self::$messages = array();
+
+               return $queuedFlashMessages;
+       }
+
+       /**
+        * Returns current flash messages from the session, making sure to always
+        * return an array.
+        *
+        * @return      array   An array of t3lib_FlashMessage flash messages.
+        */
+       protected static function getFlashMessagesFromSession() {
+               $flashMessages = $GLOBALS['BE_USER']->getSessionData('core.template.flashMessages');
+               return is_array($flashMessages) ? $flashMessages : array();
+       }
+
+       /**
+        * Fetches and renders all available flash messages from the queue.
+        *
+        * @return      string  All flash messages in the queue rendered as HTML.
+        */
+       public static function renderFlashMessages() {
+               $content = '';
+               $flashMessages = self::getAllMessagesAndFlush();
+
+               if (count($flashMessages)) {
+                       foreach ($flashMessages as $flashMessage) {
+                               $content .= $flashMessage->render();
+                       }
+               }
+               return $content;
+       }
+
+
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_flashmessagequeue.php'])        {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_flashmessagequeue.php']);
+}
+?>
\ No newline at end of file
diff --git a/t3lib/class.t3lib_messagequeue.php b/t3lib/class.t3lib_messagequeue.php
deleted file mode 100644 (file)
index 3555f50..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Rupert Germann <rupi@gmx.li>
-*  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!
-***************************************************************/
-
-
-/**
- *  A class which collects and renders flash messages.
- *
- * @author     Rupert Germann <rupi@gmx.li>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_MessageQueue {
-
-       static $messages = array();
-
-       /**
-        * Static class, no instances allowed.
-        */
-       protected function __construct() {}
-
-
-       /**
-        * Adds a message either to the BE_USER session (if the $message has the storeInSession flag set)
-        * or it adds the message to self::$messages.
-        *
-        * @param       object  instance of t3lib_FlashMessage, representing a message
-        * @return      void
-        */
-       public static function addMessage(t3lib_FlashMessage $message) {
-               if ($message->getStoreInSession() === TRUE) {
-                       $queuedFlashMessages = self::getFlashMessagesFromSession();
-                       $queuedFlashMessages[] = $message;
-
-                       $GLOBALS['BE_USER']->setAndSaveSessionData(
-                               'core.template.flashMessages',
-                               $queuedFlashMessages
-                       );
-               } else {
-                       self::$messages[] = $message;
-               }
-       }
-
-       /**
-        * Returns all messages from the current PHP session and from the current request.
-        * After fetching the messages the internal queue and the message queue in the session
-        * will be emptied.
-        *
-        * @return      array   array of t3lib_FlashMessage objects
-        */
-       public static function getMessages() {
-                       // get messages from user session
-               $queuedFlashMessagesFromSession = self::getFlashMessagesFromSession();
-               if (!empty($queuedFlashMessagesFromSession)) {
-                               // reset messages in user session
-                       $GLOBALS['BE_USER']->setAndSaveSessionData(
-                               'core.template.flashMessages',
-                               null
-                       );
-               }
-
-               $queuedFlashMessages = array_merge($queuedFlashMessagesFromSession, self::$messages);
-
-                       // reset internal messages
-               self::$messages = array();
-
-               return $queuedFlashMessages;
-       }
-
-       /**
-        * Returns current flash messages from the session, making sure to always
-        * return an array.
-        *
-        * @return      array   An array of t3lib_FlashMessage flash messages.
-        */
-       protected static function getFlashMessagesFromSession() {
-               $flashMessages = $GLOBALS['BE_USER']->getSessionData('core.template.flashMessages');
-               return is_array($flashMessages) ? $flashMessages : array();
-       }
-
-       /**
-        * Fetches and renders all available flash messages from the queue.
-        *
-        * @return      string  All flash messages in the queue rendered as HTML.
-        */
-       public static function renderFlashMessages() {
-               $content = '';
-               $flashMessages = self::getMessages();
-
-               if (count($flashMessages)) {
-                       foreach ($flashMessages as $flashMessage) {
-                               $content .= $flashMessage->render();
-                       }
-               }
-               return $content;
-       }
-
-
-}
-
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_messagequeue.php'])     {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_messagequeue.php']);
-}
-?>
\ No newline at end of file
index ace0ef0..22999ad 100644 (file)
@@ -27,7 +27,7 @@ return array(
        't3lib_extmgm' => PATH_t3lib . 'class.t3lib_extmgm.php',
        't3lib_extobjbase' => PATH_t3lib . 'class.t3lib_extobjbase.php',
        't3lib_flashmessage' => PATH_t3lib . 'class.t3lib_flashmessage.php',
-       't3lib_messagequeue' => PATH_t3lib . 'class.t3lib_messagequeue.php',
+       't3lib_flashmessagequeue' => PATH_t3lib . 'class.t3lib_flashmessagequeue.php',
        't3lib_flexformtools' => PATH_t3lib . 'class.t3lib_flexformtools.php',
        't3lib_foldertree' => PATH_t3lib . 'class.t3lib_foldertree.php',
        't3lib_formmail' => PATH_t3lib . 'class.t3lib_formmail.php',
index 55b5cff..82d479a 100644 (file)
@@ -777,7 +777,7 @@ class SC_alt_doc {
                                                                                        '',
                                                                                        t3lib_FlashMessage::WARNING
                                                                                );
-                                                                               t3lib_messageQueue::addMessage($lockedMessage);
+                                                                               t3lib_FlashMessageQueue::addMessage($lockedMessage);
                                                                        }
 
                                                                                // Combine it all:
index f0587a6..4b1d1bb 100755 (executable)
@@ -397,7 +397,7 @@ class SC_mod_web_perm_index {
                                $LANG->getLL('WorkspaceWarning'),
                                t3lib_FlashMessage::WARNING
                        );
-                       t3lib_messageQueue::addMessage($lockedMessage);
+                       t3lib_FlashMessageQueue::addMessage($lockedMessage);
                }
 
                        // Get usernames and groupnames
index 8374365..d824115 100755 (executable)
@@ -832,7 +832,7 @@ class SC_db_layout {
                                                '',
                                                t3lib_FlashMessage::WARNING
                                        );
-                                       t3lib_messageQueue::addMessage($lockedMessage);
+                                       t3lib_FlashMessageQueue::addMessage($lockedMessage);
                                }
 
                                        // Add whole form as a document section:
index 19501c0..aec6523 100755 (executable)
@@ -1280,7 +1280,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                        $severity
                );
 
-               t3lib_messageQueue::addMessage($message);
+               t3lib_FlashMessageQueue::addMessage($message);
        }
 
        /**
index d1ddd7e..09581b5 100644 (file)
@@ -249,7 +249,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                                                                $GLOBALS['LANG']->getLL('badProperty'),
                                                                t3lib_FlashMessage::ERROR
                                                        );
-                                                       t3lib_messageQueue::addMessage($badPropertyMessage);
+                                                       t3lib_FlashMessageQueue::addMessage($badPropertyMessage);
                                                } else {
                                                        $pline = $name . '.' . $property . ' = '
                                                                . trim($POST['data'][$name]['propertyValue']);
@@ -259,7 +259,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                                                                htmlspecialchars($pline),
                                                                $GLOBALS['LANG']->getLL('propertyAdded')
                                                        );
-                                                       t3lib_messageQueue::addMessage($propertyAddedMessage);
+                                                       t3lib_FlashMessageQueue::addMessage($propertyAddedMessage);
 
                                                        $line.=chr(10).$pline;
                                                }
@@ -271,7 +271,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                                                        htmlspecialchars($pline),
                                                        $GLOBALS['LANG']->getLL('valueUpdated')
                                                );
-                                               t3lib_messageQueue::addMessage($updatedMessage);
+                                               t3lib_FlashMessageQueue::addMessage($updatedMessage);
 
                                                $line .= chr(10) . $pline;
                                        } elseif ($POST['clear_object']) {
@@ -283,7 +283,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                                                                htmlspecialchars($pline),
                                                                $GLOBALS['LANG']->getLL('objectCleared')
                                                        );
-                                                       t3lib_messageQueue::addMessage($objectClearedMessage);
+                                                       t3lib_FlashMessageQueue::addMessage($objectClearedMessage);
 
                                                        $line .= chr(10) . $pline;
                                                }
@@ -405,7 +405,7 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                                        t3lib_FlashMessage::ERROR
                                );
 
-                               t3lib_messageQueue::addMessage($noTemplateMessage);
+                               t3lib_FlashMessageQueue::addMessage($noTemplateMessage);
                        }
                                // Links:
                        $out = '';
index 547b776..9b3d68e 100644 (file)
@@ -1893,7 +1893,7 @@ $str.=$this->docBodyTagBegin().
                }
 
                        // adding flash messages
-               $flashMessages = t3lib_messageQueue::renderFlashMessages();
+               $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
                if (!empty($flashMessages)) {
                        $flashMessages = '<div id="typo3-messages">' . $flashMessages . '</div>';
                }