diff --git a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php index cf3df77a5c7db0967ad3e1b8fd4076c85786d167..89c4601455b384000bffd78235aaed005187c2a6 100644 --- a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php +++ b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php @@ -565,6 +565,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas $task = unserialize($taskRecord['serialized_task_object']); // Set some task information $taskInfo['disable'] = $taskRecord['disable']; + $taskInfo['description'] = $taskRecord['description']; // Check that the task object is valid if ($this->scheduler->isValidTaskObject($task)) { // The task object is valid, process with fetching current data @@ -775,6 +776,16 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas '0' => array('<td class="td-label">', '</td>') ); $tr++; + // Description + $label = '<label for="task_description">' . $GLOBALS['LANG']->getLL('label.description') . '</label>'; + $table[$tr][] = BackendUtility::wrapInHelp($this->cshKey, 'task_description', $label); + $table[$tr][] = '<textarea name="tx_scheduler[description]">' . htmlspecialchars($taskInfo['description']) . '</textarea>'; + $tableLayout[$tr] = array( + 'tr' => array('<tr id="task_description_row">', '</tr>'), + 'defCol' => $defaultCell, + '0' => array('<td class="td-label">', '</td>') + ); + $tr++; // Display additional fields foreach ($allAdditionalFields as $class => $fields) { if ($class == $taskInfo['class']) { @@ -1056,7 +1067,15 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas $table[$tr][] = $actions; $table[$tr][] = $schedulerRecord['uid']; $table[$tr][] = $executionStatusOutput; - $table[$tr][] = $name; + if ($schedulerRecord['description'] !== '') { + if (!empty($this->scheduler->extConf['listShowTaskDescriptionAsHover'])) { + $table[$tr][] = '<span title="' . htmlspecialchars($schedulerRecord['description']) . '">' . $name . '</span>'; + } else { + $table[$tr][] = $name . '<br />' . nl2br(htmlspecialchars($schedulerRecord['description'])) . '<br />'; + } + } else { + $table[$tr][] = $name; + } $table[$tr][] = $execType; $table[$tr][] = $frequency; $table[$tr][] = $multiple; @@ -1139,6 +1158,8 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas } // Set disable flag $task->setDisabled($this->submittedData['disable']); + // Set description + $task->setDescription($this->submittedData['description']); // Save additional input values if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][$this->submittedData['class']]['additionalFields'])) { /** @var $providerObject \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface */ @@ -1176,6 +1197,8 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas } // Set disable flag $task->setDisabled($this->submittedData['disable']); + // Set description + $task->setDescription($this->submittedData['description']); // Add to database $result = $this->scheduler->addTask($task); if ($result) { diff --git a/typo3/sysext/scheduler/Classes/Scheduler.php b/typo3/sysext/scheduler/Classes/Scheduler.php index 11ca473d27ed5e3f1adcaeba79d82ae4f4c362ec..22282488081013041c12d409cf66fff4553131c5 100644 --- a/typo3/sysext/scheduler/Classes/Scheduler.php +++ b/typo3/sysext/scheduler/Classes/Scheduler.php @@ -233,6 +233,7 @@ class Scheduler implements \TYPO3\CMS\Core\SingletonInterface { $fields = array( 'nextexecution' => $executionTime, 'disable' => $task->isDisabled(), + 'description' => $task->getDescription(), 'serialized_task_object' => serialize($task) ); $result = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_scheduler_task', 'uid = ' . $taskUid, $fields); diff --git a/typo3/sysext/scheduler/Classes/Task/AbstractTask.php b/typo3/sysext/scheduler/Classes/Task/AbstractTask.php index 694a866d12167f5409f8d2e7e0b773d105b6893f..fbc3310e4c01019699f15030739805938c3c5a52 100644 --- a/typo3/sysext/scheduler/Classes/Task/AbstractTask.php +++ b/typo3/sysext/scheduler/Classes/Task/AbstractTask.php @@ -68,6 +68,13 @@ abstract class AbstractTask { */ protected $executionTime = 0; + /** + * Description for the task + * + * @var string + */ + protected $description = ''; + /** * Constructor */ @@ -187,6 +194,25 @@ abstract class AbstractTask { return $this->executionTime; } + /** + * This method is used to set the description of the task + * + * @param string $description Description + * @return void + */ + public function setDescription($description) { + $this->description = $description; + } + + /** + * This method returns the description of the task + * + * @return string Description + */ + public function getDescription() { + return $this->description; + } + /** * Sets the internal reference to the singleton instance of the Scheduler * diff --git a/typo3/sysext/scheduler/ext_conf_template.txt b/typo3/sysext/scheduler/ext_conf_template.txt index ef47da024410705c4ad51396142696fec7dd4e13..78ef2dda001fa2c7b87a548d2d03d8135a36dbe4 100644 --- a/typo3/sysext/scheduler/ext_conf_template.txt +++ b/typo3/sysext/scheduler/ext_conf_template.txt @@ -9,3 +9,6 @@ showSampleTasks = 1 # cat=basic//; type=boolean; label=Use "at"-daemon: This allows automatic scheduling of the next execution of the scheduler. Your system must have the at daemon installed and configured for the user PHP runs with. useAtdaemon = 0 + +# cat=basic//; type=boolean; label=Show description of tasks as hover: If disabled descriptions of tasks will be shown below the job-name in the scheduler-list +listShowTaskDescriptionAsHover = 1 diff --git a/typo3/sysext/scheduler/ext_tables.sql b/typo3/sysext/scheduler/ext_tables.sql index bbe3a6380f6cb7f4c33c3630a2f90790902bebb8..4fe7e64617a46449903594809ff477985416b5d2 100755 --- a/typo3/sysext/scheduler/ext_tables.sql +++ b/typo3/sysext/scheduler/ext_tables.sql @@ -5,6 +5,7 @@ CREATE TABLE tx_scheduler_task ( uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment, crdate int(11) unsigned DEFAULT '0' NOT NULL, disable tinyint(4) unsigned DEFAULT '0' NOT NULL, + description text NOT NULL, nextexecution int(11) unsigned DEFAULT '0' NOT NULL, lastexecution_time int(11) unsigned DEFAULT '0' NOT NULL, lastexecution_failure text NOT NULL,