Revert "[FEATURE] Add a disable/enable button to tasks overview" 07/20307/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 29 Apr 2013 13:39:13 +0000 (15:39 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 29 Apr 2013 14:19:21 +0000 (16:19 +0200)
This reverts commit 867e074db8c87be5781a06dc22ced5defad14faa

The enable/disable feature for the scheduler list view in its current
form is half baked and usability wise worse than before and reverted
now before the release of 6.1.
Reasons are, that the button only works in special cases as expected,
for example it does not change / work if a task is set to
'single execution' or if a task is beyond 'end date'.
Maybe the list overview needs to be restructured a bit to make this
feature usability wise more straight.

Change-Id: I36b5b87ced3fe2769f26bce9a4445d26e5bf1909
Relases: 6.2, 6.1
Related: #25631
Reviewed-on: https://review.typo3.org/20307
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/mod1/locallang.xlf

index 3b2334e..1baf949 100644 (file)
@@ -209,14 +209,6 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                $this->stopTask();
                                $content .= $this->listTasks();
                                break;
-                       case 'enable':
-                               $this->enableTask();
-                               $content .= $this->listTasks();
-                               break;
-                       case 'disable':
-                               $this->disableTask();
-                               $content .= $this->listTasks();
-                               break;
                        case 'list':
 
                        default:
@@ -541,57 +533,6 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
        }
 
        /**
-        * Activates the task
-        *
-        * @return void
-        */
-       protected function enableTask() {
-               try {
-                       // Try to fetch the task and activate it
-                       $task = $this->scheduler->fetchTask($this->submittedData['uid']);
-                       if ($task->isDisabled()) {
-                               $task->setDisabled(FALSE);
-                               if (!$task->getExecution()->getMultiple()) {
-                                       $task->setExecutionTime(time());
-                               }
-                               $task->save();
-                               $this->addMessage($GLOBALS['LANG']->getLL('msg.enableSuccess'));
-                       } else {
-                               // The task is enable, nothing to enable
-                               $this->addMessage($GLOBALS['LANG']->getLL('msg.maynotEnableEnabledTask'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
-                       }
-               } catch (\Exception $e) {
-                       // The task was not found, for some reason
-                       $this->addMessage(sprintf($GLOBALS['LANG']->getLL('msg.taskNotFound'), $this->submittedData['uid']), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
-               }
-       }
-
-       /**
-        * Disables the task
-        *
-        * @return void
-        */
-       protected function disableTask() {
-               try {
-                       // Try to fetch the task and disable it
-                       $task = $this->scheduler->fetchTask($this->submittedData['uid']);
-                       if ($task->isExecutionRunning()) {
-                               $this->addMessage($GLOBALS['LANG']->getLL('msg.maynotDisableRunningTask'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
-                       } elseif (!$task->isDisabled()) {
-                               $task->setDisabled(TRUE);
-                               $task->save();
-                               $this->addMessage($GLOBALS['LANG']->getLL('msg.disableSuccess'));
-                       } else {
-                               // The task is disabled, nothing to disable
-                               $this->addMessage($GLOBALS['LANG']->getLL('msg.maynotDisableDisabledTask'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
-                       }
-               } catch (\Exception $e) {
-                       // The task was not found, for some reason
-                       $this->addMessage(sprintf($GLOBALS['LANG']->getLL('msg.taskNotFound'), $this->submittedData['uid']), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
-               }
-       }
-
-       /**
         * Return a form to add a new task or edit an existing one
         *
         * @return      string  HTML form to add or edit a task
@@ -945,7 +886,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                '0' => array(
                                        'tr' => array('<tr class="t3-row-header">', '</tr>'),
                                        'defCol' => array('<td>', '</td>'),
-                                       '1' => array('<td style="width: 76px;">', '</td>'),
+                                       '1' => array('<td style="width: 56px;">', '</td>'),
                                        '3' => array('<td colspan="2">', '</td>')
                                ),
                                'defRow' => array(
@@ -987,8 +928,6 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                $editAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:edit', TRUE) . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                                $deleteAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('msg.delete') . '\');" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
                                $stopAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('msg.stop') . '\');" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:stop', TRUE) . '" class="icon"><img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler') . '/res/gfx/stop.png')) . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:stop') . '" /></a>';
-                               $enableAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=enable&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:activate', TRUE) . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
-                               $disableAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=disable&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:deactivate', TRUE) . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
                                $runAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&tx_scheduler[execute][]=' . $schedulerRecord['uid'] . '" title="' . $GLOBALS['LANG']->getLL('action.run_task') . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('extensions-scheduler-run-task') . '</a>';
                                // Define some default values
                                $lastExecution = '-';
@@ -1079,9 +1018,6 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                        if ($schedulerRecord['disable'] == 1 && !$isRunning) {
                                                $tableLayout[$tr] = $disabledTaskRow;
                                                $executionStatus = 'disabled';
-                                               $actions .= $enableAction;
-                                       } elseif (!$isRunning) {
-                                               $actions .= $disableAction;
                                        }
 
                                        // Show no action links (edit, delete) if task is running
@@ -1471,7 +1407,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                        'reload' => '',
                        'shortcut' => $this->getShortcutButton()
                );
-               if (empty($this->CMD) || $this->CMD == 'list' || $this->CMD == 'delete' || $this->CMD == 'enable' || $this->CMD == 'disable') {
+               if (empty($this->CMD) || $this->CMD == 'list' || $this->CMD == 'delete') {
                        $buttons['reload'] = '<a href="' . $GLOBALS['MCONF']['_'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
                        if ($this->MOD_SETTINGS['function'] === 'scheduler' && count(self::getRegisteredClasses())) {
                                $link = $GLOBALS['MCONF']['_'] . '&CMD=add';
@@ -1503,4 +1439,4 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
 }
 
 
-?>
\ No newline at end of file
+?>
index 6f477e7..836a34d 100644 (file)
                        <trans-unit id="msg.maynotEditRunningTask" xml:space="preserve">
                                <source>A running task may not be edited.</source>
                        </trans-unit>
-                       <trans-unit id="msg.maynotDisableRunningTask" xml:space="preserve">
-                               <source>A running task may not be disabled.</source>
-                       </trans-unit>
                        <trans-unit id="msg.maynotStopNonRunningTask" xml:space="preserve">
                                <source>The task is not running. There are no executions to unmark.</source>
                        </trans-unit>
-                       <trans-unit id="msg.maynotEnableEnabledTask" xml:space="preserve">
-                               <source>The task is enabled. There is no need to enable it.</source>
-                       </trans-unit>
-                       <trans-unit id="msg.maynotDisableDisabledTask" xml:space="preserve">
-                               <source>The task is disabled. There is no need to disable it.</source>
-                       </trans-unit>
                        <trans-unit id="msg.noEmail" xml:space="preserve">
                                <source>Please enter an email address.</source>
                        </trans-unit>
                        <trans-unit id="msg.stopSuccess" xml:space="preserve">
                                <source>The task was successfully marked as non-running.</source>
                        </trans-unit>
-                       <trans-unit id="msg.enableSuccess" xml:space="preserve">
-                               <source>The task was successfully marked as enabled.</source>
-                       </trans-unit>
-                       <trans-unit id="msg.disableSuccess" xml:space="preserve">
-                               <source>The task was successfully marked as disabled.</source>
-                       </trans-unit>
                        <trans-unit id="msg.taskNotFound" xml:space="preserve">
                                <source>The requested task (UID: %d) was not found.</source>
                        </trans-unit>