Fixed bug: #14107: Scheduler: Missing Flash message in the Scheduler
authorFrancois Suter <francois.suter@typo3.org>
Sun, 25 Apr 2010 19:34:31 +0000 (19:34 +0000)
committerFrancois Suter <francois.suter@typo3.org>
Sun, 25 Apr 2010 19:34:31 +0000 (19:34 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7429 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/scheduler/mod1/index.php
typo3/sysext/scheduler/mod1/locallang.xml

index 90c23fc..66c92cc 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-25 Francois Suter  <francois@typo3.org>
+
+       * Fixed bug: #14107: Scheduler: Missing Flash message in the Scheduler (thanks to Georg Ringer)
+
 2010-04-22  Xavier Perseguers  <typo3@perseguers.ch>
 
        * Fixed bug #14182: Multiple join conditions are not supported
index 861c71a..7531bd7 100755 (executable)
@@ -449,49 +449,63 @@ class tx_scheduler_Module extends t3lib_SCbase {
        }
 
        /**
-        * This method gathers information about all registered tasks and displays it
+        * This method gathers information about all available task classes and displays it
         *
         * @return      string  HTML content to display
         */
        protected function displayInfoScreen() {
+               $content = '';
                $registeredClasses = self::getRegisteredClasses();
 
-                       // Initialise table layout
-               $tableLayout = array (
-                       'table' => array ('<table border="0" cellspacing="1" cellpadding="2" style="width:auto;">', '</table>'),
-                       '0' => array (
-                               'tr' => array('<tr class="bgColor2" valign="top">', '</tr>'),
-                               'defCol' => array('<td class="cell">', '</td>')
-                       ),
-                       'defRow' => array (
-                               'tr' => array('<tr class="bgColor3-20">', '</tr>'),
-                               'defCol' => array('<td class="cell">', '</td>')
-                       )
-               );
-               $table = array();
-               $tr = 0;
+                       // No classes available, display information message
+               if (count($registeredClasses) == 0) {
+                               /** @var t3lib_FlashMessage $flashMessage */
+                       $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage',
+                               $GLOBALS['LANG']->getLL('msg.noTasksDefined'),
+                               '',
+                               t3lib_FlashMessage::INFO
+                       );
+                       $content .= $flashMessage->render();
 
-                       // Header row
-               $table[$tr][] = $GLOBALS['LANG']->getLL('label.name');
-               $table[$tr][] = $GLOBALS['LANG']->getLL('label.extension');
-               $table[$tr][] = $GLOBALS['LANG']->getLL('label.description');
-               $table[$tr][] = '';
-               $tr++;
+                       // Display the list of all available classes
+               } else {
+                               // Initialise table layout
+                       $tableLayout = array (
+                               'table' => array ('<table border="0" cellspacing="1" cellpadding="2" style="width:auto;">', '</table>'),
+                               '0' => array (
+                                       'tr' => array('<tr class="bgColor2" valign="top">', '</tr>'),
+                                       'defCol' => array('<td class="cell">', '</td>')
+                               ),
+                               'defRow' => array (
+                                       'tr' => array('<tr class="bgColor3-20">', '</tr>'),
+                                       'defCol' => array('<td class="cell">', '</td>')
+                               )
+                       );
+                       $table = array();
+                       $tr = 0;
 
-                       // Display information about each service
-               foreach ($registeredClasses as $class => $classInfo) {
-                       $table[$tr][] = $classInfo['title'];
-                       $table[$tr][] = $classInfo['extension'];
-                       $table[$tr][] = $classInfo['description'];
-                       $link = $GLOBALS['MCONF']['_'] . '&SET[function]=list&CMD=add&tx_scheduler[class]=' . $class;
-                       $table[$tr][] = '<a href="' . htmlspecialchars($link) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '"><img ' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_el.gif') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '" /></a>';
+                               // Header row
+                       $table[$tr][] = $GLOBALS['LANG']->getLL('label.name');
+                       $table[$tr][] = $GLOBALS['LANG']->getLL('label.extension');
+                       $table[$tr][] = $GLOBALS['LANG']->getLL('label.description');
+                       $table[$tr][] = '';
                        $tr++;
-               }
 
-                       // Render the table and return it
-               $content  = '<div>' . $GLOBALS['LANG']->getLL('msg.infoScreenIntro') . '</div>';
-               $content .= $this->doc->spacer(5);
-               $content .= $this->doc->table($table, $tableLayout);
+                               // Display information about each service
+                       foreach ($registeredClasses as $class => $classInfo) {
+                               $table[$tr][] = $classInfo['title'];
+                               $table[$tr][] = $classInfo['extension'];
+                               $table[$tr][] = $classInfo['description'];
+                               $link = $GLOBALS['MCONF']['_'] . '&SET[function]=list&CMD=add&tx_scheduler[class]=' . $class;
+                               $table[$tr][] = '<a href="' . htmlspecialchars($link) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '"><img ' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_el.gif') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '" /></a>';
+                               $tr++;
+                       }
+
+                               // Render the table and return it
+                       $content  = '<div>' . $GLOBALS['LANG']->getLL('msg.infoScreenIntro') . '</div>';
+                       $content .= $this->doc->spacer(5);
+                       $content .= $this->doc->table($table, $tableLayout);
+               }
 
                return $content;
        }
@@ -924,6 +938,9 @@ class tx_scheduler_Module extends t3lib_SCbase {
                $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
                $content = '';
 
+                       // Get list of registered classes
+               $registeredClasses = self::getRegisteredClasses();
+
                        // Get all registered tasks
                $query = array(
                        'SELECT'  => '*',
@@ -933,12 +950,16 @@ class tx_scheduler_Module extends t3lib_SCbase {
 
                $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($query);
                $numRows = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
+                       // No tasks defined, display information message
                if ($numRows == 0) {
-                       $content .= '<p>' . $GLOBALS['LANG']->getLL('msg.noTasks') . '</p>';
+                               /** @var t3lib_FlashMessage $flashMessage */
+                       $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage',
+                               $GLOBALS['LANG']->getLL('msg.noTasks'),
+                               '',
+                               t3lib_FlashMessage::INFO
+                       );
+                       $content .= $flashMessage->render();
                } else {
-                               // Get list of registered classes
-                       $registeredClasses = self::getRegisteredClasses();
-
                                // Load ExtJS framework and specific JS library
                                /** @var $pageRenderer t3lib_PageRenderer */
                        $pageRenderer = $this->doc->getPageRenderer();
@@ -1140,12 +1161,22 @@ class tx_scheduler_Module extends t3lib_SCbase {
                        $content .= '<input type="submit" class="button" name="go" value="' . $GLOBALS['LANG']->getLL('label.executeSelected') . '" />';
                }
 
-                       // Display add new task link
-               $link = $GLOBALS['MCONF']['_'] . '&CMD=add';
-               $content .= '<p><a href="' . htmlspecialchars($link) .'"><img '
-                       . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_el.gif')
-                       . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE)
-                       . '" /> ' . $GLOBALS['LANG']->getLL('action.add') . '</a></p>';
+               if (count($registeredClasses) > 0) {
+                               // Display add new task link
+                       $link = $GLOBALS['MCONF']['_'] . '&CMD=add';
+                       $content .= '<p><a href="' . htmlspecialchars($link) .'"><img '
+                               . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_el.gif')
+                               . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE)
+                               . '" /> ' . $GLOBALS['LANG']->getLL('action.add') . '</a></p>';
+               } else {
+                               /** @var t3lib_FlashMessage $flashMessage */
+                       $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage',
+                               $GLOBALS['LANG']->getLL('msg.noTasksDefined'),
+                               '',
+                               t3lib_FlashMessage::INFO
+                       );
+                       $content .= $flashMessage->render();
+               }
 
                        // Display legend, if there's at least one registered task
                        // Also display information about the usage of server time
index d6246cd..60d3f3d 100644 (file)
@@ -64,6 +64,7 @@
                        <label index="msg.noEmail">Please enter an email address.</label>
                        <label index="msg.noFrequency">No frequency was defined, either as an interval or as a cron command.</label>
                        <label index="msg.noLastRun">The Scheduler has never yet run or the information about the last run has been lost.</label>
+                       <label index="msg.noTasksDefined">There are currently no task classes available at all. To be able to create new tasks, you must either enable the samples provided by the Scheduler or install some other extension that relies on the Scheduler.</label>
                        <label index="msg.noTaskClassFound">The selected task class could not be found. You should probably contact the task's developers.</label>
                        <label index="msg.noTasks">No tasks defined yet.</label>
                        <label index="msg.notExecuted">Not executed: %s</label>