Index: typo3/template.php
===================================================================
--- typo3/template.php (revision 7074)
+++ typo3/template.php (working copy)
@@ -771,7 +771,15 @@
// Construct page header.
$str = $this->pageRenderer->render(t3lib_PageRenderer::PART_HEADER);
-
+
+ if ($this->pageRenderer->getShowFlashMessages() && $this->showFlashMessages) {
+ // render flashmessages for old modules
+ $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
+ if (!empty($flashMessages)) {
+ $str .= '
' . $flashMessages . '
';
+ }
+ }
+
$this->JScodeLibArray = array();
$this->JScode = $this->extJScode = '';
$this->JScodeArray = array();
@@ -817,7 +825,13 @@
// Logging: Can't find better place to put it:
if (TYPO3_DLOG) t3lib_div::devLog('END of BACKEND session', 'template', 0, array('_FLUSH' => true));
-
+
+ if ($this->showFlashMessages) {
+ $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
+ if (!empty($flashMessages)) {
+ $str= '' . $flashMessages . '
' . $this->bodyContent;
+ }
+ }
return $str;
}
@@ -1909,6 +1923,7 @@
function setModuleTemplate($filename) {
// Load Prototype lib for IE event
$this->pageRenderer->loadPrototype();
+ $this->pageRenderer->setShowFlashMessages(FALSE);
$this->loadJavascriptLib('js/iecompatibility.js');
$this->moduleTemplate = $this->getHtmlTemplate($filename);
}
Index: typo3/stylesheet.css
===================================================================
--- typo3/stylesheet.css (revision 7052)
+++ typo3/stylesheet.css (working copy)
@@ -3027,13 +3027,19 @@
}
-/* Visual debugging: */
+/*** Visual debugging: ***/
+/* view_array */
+.view_array-array {
+ border-right: 1px solid black;
+ border-top: 1px solid black;
+}
-/*
-h2,
-h3,
-h4,
-div {
- border: 1px dotted #666;
+.view_array-array td {
+ border-bottom: 1px solid black;
+ border-left: 1px solid black;
+ padding: 2px;
+}
+
+.view_array-key {
+ font-weight: bold;
}
-*/
Index: typo3/sysext/cms/tslib/class.tslib_fe.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_fe.php (revision 7052)
+++ typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
@@ -3398,6 +3398,37 @@
$this->contentStrReplace();
}
+ // get the flash messages, which are sent by extension
+ $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
+ if (!empty($flashMessages)) {
+ $flashMessages = '' . $flashMessages . '
';
+ }
+ // add CSS needed by
+ if (!empty($flashMessages)) {
+ $style .= ' ';
+
+ // need to use replace to inject style needed by flash messages
+ $this->content = str_replace('', $style.'', $this->content);
+ }
+ // need to search for body tag and inject the flash messages right after the body tag
+ preg_match('/(<(body)[^>]*>)/',$this->content,$matches);
+ $this->content = str_replace($matches[0],$matches[0].$flashMessages,$this->content);
+
// Tidy up the code, if flag...
if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'output') {
$GLOBALS['TT']->push('Tidy, output','');
Index: t3lib/class.t3lib_flashmessagequeue.php
===================================================================
--- t3lib/class.t3lib_flashmessagequeue.php (revision 7052)
+++ t3lib/class.t3lib_flashmessagequeue.php (working copy)
@@ -55,10 +55,7 @@
$queuedFlashMessages = self::getFlashMessagesFromSession();
$queuedFlashMessages[] = $message;
- $GLOBALS['BE_USER']->setAndSaveSessionData(
- 'core.template.flashMessages',
- $queuedFlashMessages
- );
+ self::persistInSessionData($queuedFlashMessages);
} else {
self::$messages[] = $message;
}
@@ -76,10 +73,7 @@
$queuedFlashMessagesFromSession = self::getFlashMessagesFromSession();
if (!empty($queuedFlashMessagesFromSession)) {
// reset messages in user session
- $GLOBALS['BE_USER']->setAndSaveSessionData(
- 'core.template.flashMessages',
- null
- );
+ self::persistInSessionData(null);
}
$queuedFlashMessages = array_merge($queuedFlashMessagesFromSession, self::$messages);
@@ -118,7 +112,25 @@
return $content;
}
-
+ /**
+ * Persists data in user session.
+ *
+ * @param mixed $data: Data to be persisted
+ * @return void
+ */
+ protected function persistInSessionData($data) {
+ if (TYPO3_MODE === 'FE') {
+ $GLOBALS['TSFE']->fe_user->setKey(
+ 'core.tsfe.flashMessages',
+ $data
+ );
+ } elseif (TYPO3_MODE === 'BE') {
+ $GLOBALS['BE_USER']->setAndSaveSessionData(
+ 'core.template.flashMessages',
+ $data
+ );
+ }
+ }
}
Index: t3lib/class.t3lib_div.php
===================================================================
--- t3lib/class.t3lib_div.php (revision 7074)
+++ t3lib/class.t3lib_div.php (working copy)
@@ -3339,14 +3339,15 @@
public static function view_array($array_in) {
if (is_array($array_in)) {
$result='
- ';
+ ';
if (count($array_in) == 0) {
- $result.= 'EMPTY! |
';
+ $result.= 'EMPTY! |
';
} else {
+ $i = 0;
foreach ($array_in as $key => $val) {
- $result.= '
- '.htmlspecialchars((string)$key).' |
- ';
+ $result.= ' |
+ '.htmlspecialchars((string)$key).' |
+ ';
if (is_array($val)) {
$result.=self::view_array($val);
} elseif (is_object($val)) {
@@ -3354,24 +3355,25 @@
if (method_exists($val, '__toString')) {
$string .= ': '.(string)$val;
}
- $result .= ''.nl2br(htmlspecialchars($string)).' ';
+ $result .= nl2br(htmlspecialchars($string)).' ';
} else {
if (gettype($val) == 'object') {
$string = 'Unknown object';
} else {
$string = (string)$val;
}
- $result.= ''.nl2br(htmlspecialchars($string)).' ';
+ $result.= nl2br(htmlspecialchars($string)).' ';
}
$result.= ' |
';
+ $i++;
}
}
$result.= '
';
} else {
- $result = '
+ $result = '
- '.nl2br(htmlspecialchars((string)$array_in)).'
|
+ '.nl2br(htmlspecialchars((string)$array_in)).'
|
'; // Output it as a string.
}
@@ -3402,34 +3404,27 @@
* @return void
*/
public static function debug($var='',$brOrHeader=0) {
- // buffer the output of debug if no buffering started before
- if (ob_get_level()==0) {
- ob_start();
- }
-
- if ($brOrHeader && !self::testInt($brOrHeader)) {
- echo ''.htmlspecialchars((string)$brOrHeader).' |
';
- } elseif ($brOrHeader<0) {
- for($a=0;$a';}
- }
-
+ //flashMessage
+ $message = '';
if (is_array($var)) {
- self::print_array($var);
+ $message .= t3lib_div::view_array($var);
} elseif (is_object($var)) {
- echo '|Object:';
- print_r($var);
- echo ' |';
+ $message .= '|Object:';
+ $message .= print_r($var, TRUE);
+ $message .= ' |';
} elseif ((string)$var!='') {
- echo '|'.htmlspecialchars((string)$var).'|';
+ $message .= '|'.htmlspecialchars((string)$var).'|';
} else {
- echo '| debug |';
+ $message .='| debug |';
}
-
- if ($brOrHeader && !self::testInt($brOrHeader)) {
- echo ' |
';
- } elseif ($brOrHeader>0) {
- for($a=0;$a';}
- }
+
+ $flashMessage = t3lib_div::makeInstance(
+ 't3lib_FlashMessage',
+ $message,
+ 'DEBUG: ' . ($brOrHeader === 0 ? '' : htmlspecialchars($brOrHeader)),
+ t3lib_FlashMessage::INFO
+ );
+ t3lib_FlashMessageQueue::addMessage($flashMessage);
}
/**
Index: t3lib/class.t3lib_pagerenderer.php
===================================================================
--- t3lib/class.t3lib_pagerenderer.php (revision 7052)
+++ t3lib/class.t3lib_pagerenderer.php (working copy)
@@ -80,7 +80,8 @@
protected $cssInline = array ();
protected $bodyContent;
-
+ protected $showFlashMessages = TRUE;
+
protected $templateFile;
protected $jsLibraryNames = array ('prototype', 'scriptaculous', 'extjs');
@@ -293,6 +294,16 @@
$this->bodyContent = $content;
}
+ /**
+ * Sets Flag showFlashMessages (set to FALSE supress flashmessages
+ *
+ * @param boolean $showFlashMessages
+ * @return void
+ */
+ public function setShowFlashMessages($showFlashMessages) {
+ $this->showFlashMessages = $showFlashMessages;
+ }
+
/*****************************************************/
/* */
/* Public Enablers */
@@ -492,6 +503,15 @@
return $this->bodyContent;
}
+ /**
+ * Gets Flag showFlashMessages
+ *
+ * @return boolean
+ */
+ public function getShowFlashMessages() {
+ return $this->showFlashMessages;
+ }
+
/*****************************************************/
/* */
/* Public Function to add Data */
@@ -1122,7 +1142,14 @@
$jsFooterInline = $jsInline . chr(10) . $jsFooterInline;
$jsInline = '';
}
-
+
+ if ($this->showFlashMessages) {
+ $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
+ if (!empty($flashMessages)) {
+ $this->bodyContent = '' . $flashMessages . '
' . $this->bodyContent;
+ }
+ }
+
$markerArray = array(
'XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType,
'HTMLTAG' => $this->htmlTag,