Added feature #11783: Change existing warning boxes to use flash messages
authorIngo Renner <ingo.renner@typo3.org>
Fri, 28 Aug 2009 10:53:46 +0000 (10:53 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Fri, 28 Aug 2009 10:53:46 +0000 (10:53 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5840 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php
typo3/alt_doc.php
typo3/mod/web/perm/index.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/setup/mod/index.php

index dbb18ee..6e7c1bc 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-08-28  Ingo Renner  <ingo@typo3.org>
 
        * Added feature #11784: Change existing messages in the Template Object Browser top use flash messages
+       * Added feature #11783: Change existing warning boxes to use flash messages
 
 2009-08-28  Steffen Kamper  <info@sk-typo3.de>
 
index 1d48549..333daea 100644 (file)
@@ -4179,12 +4179,19 @@ final class t3lib_BEfunc {
 
                        if (count($warnings)) {
                                $style = ' style="margin-bottom:10px;"';
-                               $content = '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>' .
-                                       $GLOBALS['TBE_TEMPLATE']->icons(3) . '<span class="warningboxheader">' .
-                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.header') .
-                                       '</span><br /><ul><li' . $style.'>' .
-                                       implode('</li><li' . $style . '>', $warnings) . '</li></ul>' .
-                                       '</td></tr></table>';
+                               $securityWarnings = '<ul><li' . $style . '>'
+                                       . implode('</li><li' . $style . '>', $warnings)
+                                       . '</li></ul>';
+
+                               $securityMessage = t3lib_div::makeInstance(
+                                       't3lib_FlashMessage',
+                                       $securityWarnings,
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.header'),
+                                       t3lib_FlashMessage::ERROR
+                               );
+                               $content = '<div style="margin: 20px 0px;">'
+                                       . $securityMessage->render()
+                                       . '</div>';
 
                                unset($warnings);
                                return $content;
index 3f4d327..69d55bb 100644 (file)
@@ -760,21 +760,18 @@ class SC_alt_doc {
                                                                        }
 
                                                                                // Display "is-locked" message:
-                                                                       if ($lockInfo = t3lib_BEfunc::isRecordLocked($table,$rec['uid']))       {
-                                                                               $lockIcon = '
-
-                                                                                       <!-- Warning box: -->
-                                                                                       <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
-                                                                                               <tr>
-                                                                                                       <td><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
-                                                                                                       <td>'.htmlspecialchars($lockInfo['msg']).'</td>
-                                                                                               </tr>
-                                                                                       </table>
-                                                                               ';
-                                                                       } else $lockIcon = '';
+                                                                       if ($lockInfo = t3lib_BEfunc::isRecordLocked($table, $rec['uid'])) {
+                                                                               $lockedMessage = t3lib_div::makeInstance(
+                                                                                       't3lib_FlashMessage',
+                                                                                       htmlspecialchars($lockInfo['msg']),
+                                                                                       '',
+                                                                                       t3lib_FlashMessage::WARNING
+                                                                               );
+                                                                               $this->doc->pushFlashMessage($lockedMessage);
+                                                                       }
 
                                                                                // Combine it all:
-                                                                       $editForm.= $lockIcon.$panel;
+                                                                       $editForm .= $panel;
                                                                }
 
                                                                $thePrevUid = $rec['uid'];
index c3faa0b..5a06961 100755 (executable)
@@ -389,10 +389,15 @@ class SC_mod_web_perm_index {
        public function doEdit() {
                global $BE_USER,$LANG;
 
-               if ($BE_USER->workspace!=0)     {
+               if ($BE_USER->workspace != 0) {
                                // Adding section with the permission setting matrix:
-                       $this->content.=$this->doc->divider(5);
-                       $this->content.=$this->doc->section($LANG->getLL('WorkspaceWarning'),'<div class="warningbox">'.$LANG->getLL('WorkspaceWarningText').'</div>',0,1,3);
+                       $lockedMessage = t3lib_div::makeInstance(
+                               't3lib_FlashMessage',
+                               $LANG->getLL('WorkspaceWarningText'),
+                               $LANG->getLL('WorkspaceWarning'),
+                               t3lib_FlashMessage::WARNING
+                       );
+                       $this->doc->pushFlashMessage($lockedMessage);
                }
 
                        // Get usernames and groupnames
index 8f87d2e..49a26c9 100755 (executable)
@@ -826,23 +826,18 @@ class SC_db_layout {
                                $theCode=$tceforms->printNeededJSFunctions_top().$theCode.$tceforms->printNeededJSFunctions();
 
                                        // Add warning sign if record was "locked":
-                               if ($lockInfo=t3lib_BEfunc::isRecordLocked($this->eRParts[0],$rec['uid']))      {
-                                       $lockIcon='
-
-                                               <!--
-                                                       Warning box:
-                                               -->
-                                               <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
-                                                       <tr>
-                                                               <td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
-                                                               <td>'.htmlspecialchars($lockInfo['msg']).'</td>
-                                                       </tr>
-                                               </table>
-                                               ';
-                               } else $lockIcon='';
+                               if ($lockInfo = t3lib_BEfunc::isRecordLocked($this->eRParts[0], $rec['uid'])) {
+                                       $lockedMessage = t3lib_div::makeInstance(
+                                               't3lib_FlashMessage',
+                                               htmlspecialchars($lockInfo['msg']),
+                                               '',
+                                               t3lib_FlashMessage::WARNING
+                                       );
+                                       $this->doc->pushFlashMessage($lockedMessage);
+                               }
 
                                        // Add whole form as a document section:
-                               $content.=$this->doc->section('',$lockIcon.$theCode);
+                               $content .= $this->doc->section('', $theCode);
                        }
                } else {
                                // If no edit access, print error message:
index 0c1474d..3ce6de8 100755 (executable)
@@ -612,11 +612,20 @@ class SC_mod_user_setup_index {
                                        implode('', $languageOptions) . '
                                </select>';
                if ($GLOBALS['BE_USER']->uc['lang'] && !@is_dir(PATH_typo3conf . 'l10n/' . $GLOBALS['BE_USER']->uc['lang'])) {
-                       $languageCode .= '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>'.
-                                       $this->doc->icons(3) .
-                                       'The selected language is not available before the language pack is installed.<br />'.
-                                       ($GLOBALS['BE_USER']->isAdmin() ? 'You can use the Extension Manager to easily download and install new language packs.':'Please ask your system administrator to do this.') .
-                                       '</td></tr></table>';
+                       $languageUnavailableWarning = 'The selected language is not available before the language pack is installed.<br />'
+                               . ($GLOBALS['BE_USER']->isAdmin() ?
+                                       'You can use the Extension Manager to easily download and install new language packs.'
+                               :       'Please ask your system administrator to do this.');
+
+
+                       $languageUnavailableMessage = t3lib_div::makeInstance(
+                               't3lib_FlashMessage',
+                               $languageUnavailableWarning,
+                               '',
+                               t3lib_FlashMessage::WARNING
+                       );
+
+                       $languageCode = $languageUnavailableMessage->render() . $languageCode;
                }
 
                return $languageCode;