Index: mod1/index.php =================================================================== --- mod1/index.php (revision 1150) +++ mod1/index.php (working copy) @@ -475,12 +475,15 @@ // Get the extra fields to display for each task that needs some $allAdditionalFields = array(); - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['additionalFields'])) { - foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['additionalFields'] as $className) { - $hookObject = t3lib_div::getUserObj($className); - if ($hookObject instanceof tx_scheduler_AdditionalFieldProvider) { - $additionalFields = $hookObject->getAdditionalFields($taskInfo, isset($task) ? $task : null, $this); - $allAdditionalFields = array_merge($allAdditionalFields, $additionalFields); + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'] as $extensionKey => $tasks) { + foreach ($tasks as $taskClass => $taskRegistration) { + if (isset($taskRegistration['additionalFields']) + && !empty($taskRegistration['additionalFields'])) { + $hookObject = t3lib_div::getUserObj($taskRegistration['additionalFields']); + if ($hookObject instanceof tx_scheduler_AdditionalFieldProvider) { + $additionalFields = $hookObject->getAdditionalFields($taskInfo, isset($task) ? $task : null, $this); + $allAdditionalFields = array_merge($allAdditionalFields, $additionalFields); + } } } } Index: ext_autoload.php =================================================================== --- ext_autoload.php (revision 1150) +++ ext_autoload.php (working copy) @@ -12,8 +12,8 @@ 'tx_scheduler_execution' => t3lib_extMgm::extPath('scheduler', 'class.tx_scheduler_execution.php'), 'tx_scheduler_failedexecutionexception' => t3lib_extMgm::extPath('scheduler', 'class.tx_scheduler_failedexecutionexception.php'), 'tx_scheduler_testtask' => t3lib_extMgm::extPath('scheduler', 'examples/class.tx_scheduler_testtask.php'), - 'tx_scheduler_testtaskhook' => t3lib_extMgm::extPath('scheduler', 'examples/class.tx_scheduler_testtaskhook.php'), + 'tx_scheduler_testtask_hook' => t3lib_extMgm::extPath('scheduler', 'examples/class.tx_scheduler_testtask_hook.php'), 'tx_scheduler_sleeptask' => t3lib_extMgm::extPath('scheduler', 'examples/class.tx_scheduler_sleeptask.php'), - 'tx_scheduler_sleeptaskhook' => t3lib_extMgm::extPath('scheduler', 'examples/class.tx_scheduler_sleeptaskhook.php') + 'tx_scheduler_sleeptask_hook' => t3lib_extMgm::extPath('scheduler', 'examples/class.tx_scheduler_sleeptask_hook.php') ); ?> Index: ext_localconf.php =================================================================== --- ext_localconf.php (revision 1150) +++ ext_localconf.php (working copy) @@ -14,24 +14,20 @@ // TODO: documentation: new registration syntax // TODO: documentation: new syntax for value: filepath:classname $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][$_EXTKEY] = array( - 'testtask' => array ( - 'class' => 'tx_scheduler_testtask', - 'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:testTask.name', - 'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:testTask.description', - 'hasArguments' => false, + 'tx_scheduler_testtask' => array ( + 'class' => 'tx_scheduler_testtask', + 'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:testTask.name', + 'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:testTask.description', + 'hasArguments' => false, + 'additionalFields' => 'tx_scheduler_testtask_hook', ), - 'sleeptask' => array( - 'class' => 'tx_scheduler_sleeptask', - 'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:sleepTask.name', - 'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:sleepTask.description', - 'hasArguments' => false, + 'tx_scheduler_sleeptask' => array( + 'class' => 'tx_scheduler_sleeptask', + 'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:sleepTask.name', + 'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:sleepTask.description', + 'hasArguments' => false, + 'additionalFields' => 'tx_scheduler_sleeptask_hook', ) ); - // Register the hook for the test task -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['additionalFields'][] = 'EXT:' . $_EXTKEY . '/examples/class.tx_scheduler_testtask_hook.php:&tx_scheduler_testtask_hook'; - - // Register the hook for the sleep task -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['additionalFields'][] = 'EXT:' . $_EXTKEY . '/examples/class.tx_scheduler_sleeptask_hook.php:&tx_scheduler_sleeptask_hook'; - ?> \ No newline at end of file Index: examples/class.tx_scheduler_testtask_hook.php =================================================================== --- examples/class.tx_scheduler_testtask_hook.php (revision 1150) +++ examples/class.tx_scheduler_testtask_hook.php (working copy) @@ -59,7 +59,7 @@ // In case of new task and if field is empty, set default email address $taskInfo['email'] = $GLOBALS['BE_USER']->user['email']; - } elseif ($parentObject->CMD == 'edit' && $task instanceof self::$class) { + } elseif ($parentObject->CMD == 'edit') { // In case of edit, and editing a test task, set to internal value if not data was submitted already $taskInfo['email'] = $task->email; } else { @@ -91,15 +91,11 @@ * @return boolean True if validation was ok (or selected class is not relevant), false otherwise */ public function validateAdditionalFields(array &$submittedData, tx_scheduler_module1 $parentObject) { - if ($submittedData['class'] == self::$class) { - $submittedData['email'] = trim($submittedData['email']); + $submittedData['email'] = trim($submittedData['email']); - if (empty($submittedData['email'])) { - $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:msg.noEmail'), 3); - $result = false; - } else { - $result = true; - } + if (empty($submittedData['email'])) { + $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:msg.noEmail'), 3); + $result = false; } else { $result = true; } @@ -115,9 +111,7 @@ * @param tx_scheduler_Task $task: reference to the current task object */ public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) { - if ($submittedData['class'] == self::$class) { - $task->email = $submittedData['email']; - } + $task->email = $submittedData['email']; } } Index: examples/class.tx_scheduler_sleeptask_hook.php =================================================================== --- examples/class.tx_scheduler_sleeptask_hook.php (revision 1150) +++ examples/class.tx_scheduler_sleeptask_hook.php (working copy) @@ -58,7 +58,7 @@ if ($parentObject->CMD == 'add') { // In case of new task and if field is empty, set default sleep time $taskInfo['sleepTime'] = 30; - } else if ($parentObject->CMD == 'edit' && $task instanceof self::$class) { + } else if ($parentObject->CMD == 'edit') { // In case of edit, and editing a test task, set to internal value if not data was submitted already $taskInfo['sleepTime'] = $task->sleepTime; } else { @@ -90,18 +90,15 @@ * @return boolean True if validation was ok (or selected class is not relevant), false otherwise */ public function validateAdditionalFields(array &$submittedData, tx_scheduler_module1 $parentObject) { - if ($submittedData['class'] == self::$class) { - $submittedData['sleepTime'] = intval($submittedData['sleepTime']); + $submittedData['sleepTime'] = intval($submittedData['sleepTime']); - if ($submittedData['sleepTime'] < 0) { - $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:msg.invalidSleepTime'), 3); - $result = false; - } else { - $result = true; - } + if ($submittedData['sleepTime'] < 0) { + $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:msg.invalidSleepTime'), 3); + $result = false; } else { $result = true; } + return $result; } @@ -113,9 +110,7 @@ * @param tx_scheduler_Task $task: reference to the current task object */ public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) { - if ($submittedData['class'] == self::$class) { - $task->sleepTime = $submittedData['sleepTime']; - } + $task->sleepTime = $submittedData['sleepTime']; } }