Project

General

Profile

Bug #23996 » 16318.diff

Administrator Admin, 2010-11-09 18:37

View differences:

t3lib/class.t3lib_flashmessage.php (Arbeitskopie)
protected $storeInSession = FALSE;
/**
* defines whether the message should automatically disappear after some delay
*
* @var bool
*/
protected $disappear = FALSE;
/**
* defines the delay (in seconds), after which the message automatically disappears
*
* @var int
*/
protected $disappearDelay = 5;
/**
* Constructor for a flash message
*
* @param string The message.
......
}
/**
* Sets the message's disappear flag: If $disappear is TRUE, the message will disappear after some delay
*
* @param $disappear Disappear after delay, if TRUE
* @return void
*/
public function setDisappear($disappear) {
$this->disappear = (bool) $disappear;
}
/**
* Sets the delay (in seconds), after which the message will automatically disappear
*
* @param $disappearDelay Delay in seconds, after which the message will automatically disappear
* @return void
*/
protected function setDisappearDelay($disappearDelay) {
$this->setDisappear(TRUE);
$this->disappearDelay = intval($disappearDelay);
}
/**
* Renders the flash message.
*
* @return string The flash message as HTML.
*/
public function render() {
if ($this->disappearDelay > 0) {
return $this->renderDisappearingMessage();
} else {
return $this->renderStaticMessage();
}
}
/**
* Renders static FlashMessage (outputted as static HTML code)
*
* @return string
*/
protected function renderStaticMessage() {
$classes = array(
self::NOTICE => 'notice',
self::INFO => 'information',
......
return $message;
}
/**
* Renders a JS based FlashMessage, which automatically disappears after some delay
*
* @return string
*/
protected function renderDisappearingMessage() {
// unfortunately JS FlashMessages start counting at 0, we start at -2
$severity = $this->severity + 2;
$message = '<script type="text/javascript">' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF .
'top.TYPO3.Flashmessage.display(' .
$severity . ', "' .
$this->message . '", "' .
$this->title . '");' . LF .
'// -->' . LF . '/*]]>*/' . LF . '</script>' . LF;
return $message;
}
}
(1-1/3)