Index: t3lib/class.t3lib_flashmessagequeue.php =================================================================== --- t3lib/class.t3lib_flashmessagequeue.php (revision 9373) +++ t3lib/class.t3lib_flashmessagequeue.php (working copy) @@ -108,16 +108,40 @@ */ public static function renderFlashMessages() { $content = ''; + $addFadeOutEffectJavascript = FALSE; $flashMessages = self::getAllMessagesAndFlush(); if (count($flashMessages)) { foreach ($flashMessages as $flashMessage) { + if ($flashMessage->getSeverity() <= t3lib_FlashMessage::OK) { + $flashMessage->addCssClass('message-fade-out'); + $addFadeOutEffectJavascript = TRUE; + } + $content .= $flashMessage->render(); } } + + if ($addFadeOutEffectJavascript) { + self::addFadeOutEffectJavascript(); + } + return $content; } + /** + * Adds the Javascript for the flash messages fade out effect. + * + */ + protected static function addFadeOutEffectJavascript() { + $pageRenderer = t3lib_div::makeInstance('t3lib_PageRenderer'); + + $pageRenderer->addExtOnReadyCode(' + Ext.select(".message-fade-out").each(function(message) { + message.pause(5).ghost("t", {remove:true}); + }); + '); + } } Index: t3lib/class.t3lib_flashmessage.php =================================================================== --- t3lib/class.t3lib_flashmessage.php (revision 9373) +++ t3lib/class.t3lib_flashmessage.php (working copy) @@ -43,6 +43,13 @@ protected $storeInSession = FALSE; /** + * Additional CSS classes to use when rendering the flash message. + * + * @var array + */ + protected $additionalCssClasses = array(); + + /** * Constructor for a flash message * * @param string The message. @@ -80,6 +87,15 @@ } /** + * Adds a CSS class when rendering the flash message. + * + * @param string The CSS class to add + */ + public function addCssClass($cssClass) { + $this->additionalCssClasses[] = htmlspecialchars($cssClass); + } + + /** * Renders the flash message. * * @return string The flash message as HTML. @@ -98,10 +114,14 @@ $title = '
' . $this->title . '
'; } - $message = '
' + $message = '
' + . $title . '
' . $this->message . '
' - . '
'; + . '
'; return $message; }