Fixed bug #12117: Added use of flash messages to the Extension Manager
authorFrancois Suter <francois.suter@typo3.org>
Fri, 9 Oct 2009 08:08:57 +0000 (08:08 +0000)
committerFrancois Suter <francois.suter@typo3.org>
Fri, 9 Oct 2009 08:08:57 +0000 (08:08 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6124 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/mod/tools/em/class.em_index.php
typo3/mod/tools/em/class.em_xmlhandler.php
typo3/sysext/lang/locallang_mod_tools_em.xml

index 7636e4b..d3823f7 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-10-09  Francois Suter  <francois@typo3.org>
 
        * Fixed bug #12078: Scheduler: Check if additional fields indeed provide fields
+       * Fixed bug #12117: Added use of flash messages to the Extension Manager (thanks to Steffen Gebert)
 
 2009-10-09  Kasper Sk\8crh¿j <kasper@typo3.org>
        * Tiny bug with date function in t3lib_befunc. Casted timestamp to integer.
index 9999ab2..8f44962 100644 (file)
@@ -1726,7 +1726,13 @@ EXTENSION KEYS:
                                                ) .
                                                $GLOBALS['LANG']->getLL('translation_problems') . '</p>';
                                } elseif($extmd5 == $localmd5) {
-                                       $content .= '<p>' . $GLOBALS['LANG']->getLL('ext_import_list_unchanged') . '</p>';
+                                       $flashMessage = t3lib_div::makeInstance(
+                                               't3lib_FlashMessage',
+                                               $GLOBALS['LANG']->getLL('ext_import_list_unchanged'),
+                                               $GLOBALS['LANG']->getLL('ext_import_list_unchanged_header'),
+                                               t3lib_FlashMessage::INFO
+                                       );
+                                       $content .= $flashMessage->render();
                                } else {
                                        $extXML = t3lib_div::getURL($extfile, 0, array(TYPO3_user_agent));
                                        if($extXML === false) {
@@ -1972,8 +1978,14 @@ EXTENSION KEYS:
                                                        $loc = ($loc==='G'||$loc==='S') ? $loc : 'L';
                                                        $comingExtPath = PATH_site.$this->typePaths[$loc].$extKey.'/';
                                                        if (@is_dir($comingExtPath))    {
-                                                               return sprintf($GLOBALS['LANG']->getLL('ext_import_ext_present_no_overwrite'), $comingExtPath) .
-                                                                       '<br />' . $GLOBALS['LANG']->getLL('ext_import_ext_present_nothing_done');
+                                                               $flashMessage = t3lib_div::makeInstance(
+                                                                       't3lib_FlashMessage',
+                                                                       sprintf($GLOBALS['LANG']->getLL('ext_import_ext_present_no_overwrite'), $comingExtPath) .
+                                                                               '<br />' . $GLOBALS['LANG']->getLL('ext_import_ext_present_nothing_done'),
+                                                                       '',
+                                                                       t3lib_FlashMessage::ERROR
+                                                               );
+                                                               return $flashMessage->render();
                                                        }       // ... else go on, install...
                                                }       // ... else go on, install...
                                        } else return $GLOBALS['LANG']->getLL('ext_import_no_key');
@@ -2035,8 +2047,7 @@ EXTENSION KEYS:
 
                                                                                        // No content, no errors. Create success output here:
                                                                                if (!$content)  {
-                                                                                       $content = $GLOBALS['LANG']->getLL('ext_import_success') . '<br /><br />' .
-                                                                                               sprintf($GLOBALS['LANG']->getLL('ext_import_success_folder'), $extDirPath) . '<br />';
+                                                                                       $content = sprintf($GLOBALS['LANG']->getLL('ext_import_success_folder'), $extDirPath) . '<br />';
 
                                                                                        $uploadSucceed = true;
 
@@ -2085,6 +2096,13 @@ EXTENSION KEYS:
                                                                                                list($new_list)=$this->getInstalledExtensions();
                                                                                                $content.=$this->updatesForm($extKey,$new_list[$extKey],1,'index.php?CMD[showExt]='.$extKey.'&SET[singleDetails]=info');
                                                                                        }
+                                                                                       
+                                                                                       $flashMessage = t3lib_div::makeInstance(
+                                                                                               't3lib_FlashMessage',
+                                                                                               $content,
+                                                                                               $GLOBALS['LANG']->getLL('ext_import_success')
+                                                                                               );
+                                                                                       $content = $flashMessage->render();
 
                                                                                                // Install / Uninstall:
                                                                                        if(!$this->CMD['standAlone']) {
@@ -2101,7 +2119,6 @@ EXTENSION KEYS:
                                                                                                        '<br /><br /><a href="javascript:opener.top.content.document.forms[0].submit();window.close();">' .
                                                                                                        $GLOBALS['LANG']->getLL('ext_import_close_check') . '</a>';
                                                                                        }
-
                                                                                }
                                                                        } else $content = $res;
                                                                } else $content = sprintf($GLOBALS['LANG']->getLL('ext_import_ext_path_different'), $extDirPath);
@@ -2837,14 +2854,21 @@ EXTENSION KEYS:
                        if ($this->CMD['doDelete'] && !strcmp($absPath,$this->CMD['absPath'])) {
                                $res = $this->removeExtDirectory($absPath);
                                if ($res) {
-                                       return sprintf($GLOBALS['LANG']->getLL('extDelete_remove_dir_failed'),
-                                               $absPath
-                                       ) . '<br /><br />' .
-                                       nl2br($res);
+                                       $flashMessage = t3lib_div::makeInstance(
+                                               't3lib_FlashMessage',
+                                               nl2br($res),
+                                               sprintf($GLOBALS['LANG']->getLL('extDelete_remove_dir_failed'), $absPath),
+                                               t3lib_FlashMessage::ERROR
+                                       );
+                                       return $flashMessage->render();
                                } else {
-                                       return sprintf($GLOBALS['LANG']->getLL('extDelete_removed'),
-                                               $absPath
+                                       $flashMessage = t3lib_div::makeInstance(
+                                               't3lib_FlashMessage',
+                                               sprintf($GLOBALS['LANG']->getLL('extDelete_removed'), $absPath),
+                                               $GLOBALS['LANG']->getLL('extDelete_removed_header'),
+                                               t3lib_FlashMessage::OK
                                        );
+                                       return $flashMessage->render();
                                }
                        } else {
                                $areYouSure = $GLOBALS['LANG']->getLL('extDelete_sure');
@@ -4405,8 +4429,13 @@ EXTENSION KEYS:
                                if($dontDelete) return array($extDirPath);
                                $res = $this->removeExtDirectory($extDirPath);
                                if ($res) {
-                                       return sprintf($GLOBALS['LANG']->getLL('clearMakeExtDir_could_not_remove_dir'),
-                                               $extDirPath) . '<br /><br />' . nl2br($res);
+                                       $flashMessage = t3lib_div::makeInstance(
+                                               't3lib_FlashMessage',
+                                               nl2br($res),
+                                               sprintf($GLOBALS['LANG']->getLL('clearMakeExtDir_could_not_remove_dir'), $extDirPath),
+                                               t3lib_FlashMessage::ERROR
+                                       );
+                                       return $flashMessage->render();
                                }
                        }
 
index 3f8d68c..2a9404d 100644 (file)
@@ -402,7 +402,12 @@ class SC_mod_tools_em_xmlhandler {
                gzclose($fp);
 
                if(!$error) {
-                       $content.= '<p>The extensions list has been updated and now contains '.$extcount.' extension entries.</p>';
+                       $flashMessage = t3lib_div::makeInstance(
+                               't3lib_FlashMessage',
+                               sprintf($GLOBALS['LANG']->getLL('ext_import_extlist_updated'), $extcount),
+                               $GLOBALS['LANG']->getLL('ext_import_extlist_updated_header')
+                       );
+                       $content .= $flashMessage->render();
                }
 
                return $content;
index e327dec..b3d03f9 100755 (executable)
                        <label index="ext_import_list_updated">The mirror list has been updated and now contains %s entries.</label>
                        <label index="ext_import_list_empty">The mirror list was not updated as it contained no entries.</label>
                        <label index="ext_import_md5_not_updated">Error: The extension MD5 sum could not be fetched from %s.</label>
+                       <label index="ext_import_extlist_updated_header">Extension list updated</label>
+                       <label index="ext_import_extlist_updated">The extensions list has been updated and now contains %s extension entries.</label>
+                       <label index="ext_import_list_unchanged_header">No updates available</label>
                        <label index="ext_import_list_unchanged">The extension list has not changed remotely, it has thus not been fetched.</label>
                        <label index="ext_import_ext_already_installed_loaded">Extension already installed and loaded.</label>
                        <label index="ext_import_p_localconf">localconf.php is not writable!</label>
                        <label index="ext_import_no_file">No file uploaded! Probably the file was too large for PHPs internal limit for uploadable files.</label>
                        <label index="ext_import_file_not_created">Error: File '%s' could not be created!!!</label>
                        <label index="ext_import_file_corrupted">Error: File '%s' MD5 was different from the md5 of the original file - so the file is corrupted!</label>
-                       <label index="ext_import_success">SUCCESS!</label>
+                       <label index="ext_import_success">Extension imported</label>
                        <label index="ext_import_success_folder">Folder created: %s</label>
                        <label index="ext_import_no_conf_file">Error: Could not find '%s'.</label>
                        <label index="ext_import_ext_type">Installation Type:</label>
                        <label index="extDelete_ext_active">This extension is currently installed (loaded and active) and so cannot be deleted!</label>
                        <label index="extDelete_wrong_scope">You cannot delete (and install/update) extensions in the %s scope.</label>
                        <label index="extDelete_remove_dir_failed">ERROR: Could not remove extension directory '%s'. The following errors occurred:</label>
+                       <label index="extDelete_removed_header">Extension deleted</label>
                        <label index="extDelete_removed">Removed extension in path '%s'!</label>
                        <label index="extDelete_sure">Are you sure you want to delete this extension from the server?</label>
                        <label index="extDelete_from_server">DELETE EXTENSION FROM SERVER</label>