Index: typo3/sysext/scheduler/mod1/locallang.xml =================================================================== --- typo3/sysext/scheduler/mod1/locallang.xml (revision 7428) +++ typo3/sysext/scheduler/mod1/locallang.xml (working copy) @@ -64,6 +64,7 @@ + Index: typo3/sysext/scheduler/mod1/index.php =================================================================== --- typo3/sysext/scheduler/mod1/index.php (revision 7428) +++ typo3/sysext/scheduler/mod1/index.php (working copy) @@ -449,50 +449,64 @@ } /** - * This method gathers information about all registered tasks and displays it + * This method gathers information about all available tasks classes and displays it * * @return string HTML content to display */ protected function displayInfoScreen() { + $content = ''; $registeredClasses = self::getRegisteredClasses(); - // Initialise table layout - $tableLayout = array ( - 'table' => array ('', '
'), - '0' => array ( - 'tr' => array('', ''), - 'defCol' => array('', '') - ), - 'defRow' => array ( - 'tr' => array('', ''), - 'defCol' => array('', '') - ) - ); - $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 ('', '
'), + '0' => array ( + 'tr' => array('', ''), + 'defCol' => array('', '') + ), + 'defRow' => array ( + 'tr' => array('', ''), + 'defCol' => array('', '') + ) + ); + $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][] = 'backPath, 'gfx/new_el.gif') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '" />'; + // 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 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][] = 'backPath, 'gfx/new_el.gif') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '" />'; + $tr++; + } + + // Render the table and return it + $content = '
' . $GLOBALS['LANG']->getLL('msg.infoScreenIntro') . '
'; + $content .= $this->doc->spacer(5); + $content .= $this->doc->table($table, $tableLayout); } - // Render the table and return it - $content = '
' . $GLOBALS['LANG']->getLL('msg.infoScreenIntro') . '
'; - $content .= $this->doc->spacer(5); - $content .= $this->doc->table($table, $tableLayout); - return $content; } @@ -924,6 +938,9 @@ $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 @@ $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 .= '

' . $GLOBALS['LANG']->getLL('msg.noTasks') . '

'; + /** @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 @@ $content .= ''; } - // Display add new task link - $link = $GLOBALS['MCONF']['_'] . '&CMD=add'; - $content .= '

backPath, 'gfx/new_el.gif') - . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) - . '" /> ' . $GLOBALS['LANG']->getLL('action.add') . '

'; + if (count($registeredClasses) > 0) { + // Display add new task link + $link = $GLOBALS['MCONF']['_'] . '&CMD=add'; + $content .= '

backPath, 'gfx/new_el.gif') + . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) + . '" /> ' . $GLOBALS['LANG']->getLL('action.add') . '

'; + } 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