[FEATURE] EXT:Scheduler: Implemented folding of scheduler task groups 37/51037/6
authorMichael Oehlhof <typo3@oehlhof.de>
Fri, 23 Dec 2016 10:45:15 +0000 (11:45 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 5 Feb 2017 22:04:04 +0000 (23:04 +0100)
Resolves: #67243
Releases: master
Change-Id: Ic3d1bc45b9db9ae3eb6fd8f13a03fcf9125d7422
Reviewed-on: https://review.typo3.org/51037
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Build/Resources/Public/Less/TYPO3/_element_table.less
typo3/sysext/backend/Resources/Public/Css/backend.css
typo3/sysext/core/Documentation/Changelog/master/Feature-67243-ImplementFoldingOfSchedulerTaskGroups.rst [new file with mode: 0644]
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/Resources/Private/Language/locallang.xlf
typo3/sysext/scheduler/Resources/Public/JavaScript/Scheduler.js

index 3c5d01d..b3e8640 100644 (file)
@@ -307,3 +307,25 @@ table {
        margin-top: 10px;
        margin-bottom: 10px;
 }
+
+.taskGroup {
+       cursor: pointer;
+}
+
+.taskGroup--close {
+       .icon-actions-view-list-collapse {
+               transform: rotate(180deg);
+       }
+
+       td {
+               padding: 0 !important;
+               border: 0 !important;
+       }
+       .t-span {
+               height: 0;
+               overflow: hidden;
+               padding: 0;
+               line-height: 0;
+               display: block;
+       }
+}
index b42a4a1..2f3e70c 100644 (file)
@@ -11086,6 +11086,23 @@ fieldset[disabled] .table .btn-default.focus {
   margin-top: 10px;
   margin-bottom: 10px;
 }
+.taskGroup {
+  cursor: pointer;
+}
+.taskGroup--close .icon-actions-view-list-collapse {
+  transform: rotate(180deg);
+}
+.taskGroup--close td {
+  padding: 0 !important;
+  border: 0 !important;
+}
+.taskGroup--close .t-span {
+  height: 0;
+  overflow: hidden;
+  padding: 0;
+  line-height: 0;
+  display: block;
+}
 .tooltip-inner {
   padding: 5px 10px;
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-67243-ImplementFoldingOfSchedulerTaskGroups.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-67243-ImplementFoldingOfSchedulerTaskGroups.rst
new file mode 100644 (file)
index 0000000..dd2a1d4
--- /dev/null
@@ -0,0 +1,15 @@
+.. include:: ../../Includes.txt
+
+============================================================
+Feature: #67243 - Implement folding of scheduler task groups
+============================================================
+
+See :issue:`67243`
+
+Description
+===========
+
+When task groups are used, the tasks are displayed grouped in the list of tasks.
+Clicking on the row with the group title hides or shows the tasks of the group now.
+
+.. index:: Backend
\ No newline at end of file
index 4722ec1..d081c1c 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Backend\Template\ModuleTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Imaging\Icon;
+use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
@@ -942,13 +943,22 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
             . '</tr></thead>';
 
         $registeredClasses = $this->getRegisteredClasses();
-        foreach ($temporaryResult as $taskGroup) {
+        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
+        $collapseIcon = $iconFactory->getIcon('actions-view-list-collapse', Icon::SIZE_SMALL)->render();
+        $expandIcon = $iconFactory->getIcon('actions-view-list-expand', Icon::SIZE_SMALL)->render();
+        foreach ($temporaryResult as $taskIndex => $taskGroup) {
+            $collapseExpandIcons = '<span class="taskGroup_' . $taskIndex . '">' . $collapseIcon . '</span>'
+                . '<span class="taskGroup_' . $taskIndex . '" style="display: none;">' . $expandIcon . '</span>';
             if (!empty($taskGroup['groupName'])) {
                 $groupText = '<strong>' . htmlspecialchars($taskGroup['groupName']) . '</strong>';
                 if (!empty($taskGroup['groupDescription'])) {
                     $groupText .= '<br>' . nl2br(htmlspecialchars($taskGroup['groupDescription']));
                 }
-                $table[] = '<tr><td colspan="9">' . $groupText . '</td></tr>';
+                $table[] = '<tr class="taskGroup" data-task-group-id="' . $taskIndex . '"><td colspan="8">' . $groupText . '</td><td style="text-align:right;">' . $collapseExpandIcons . '</td></tr>';
+            } else {
+                if (sizeof($temporaryResult) > 1) {
+                    $table[] = '<tr class="taskGroup" data-task-group-id="0"><td colspan="8"><strong>' . htmlspecialchars($this->getLanguageService()->getLL('label.noGroup')) . '</strong></td><td style="text-align:right;">' . $collapseExpandIcons . '</td></tr>';
+                }
             }
 
             foreach ($taskGroup['tasks'] as $schedulerRecord) {
@@ -1113,16 +1123,16 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                     $taskName = '<span class="name"><a href="' . $link . '">' . $name . '</a></span>';
 
                     $table[] =
-                        '<tr class="' . ($showAsDisabled ? 'disabled' : '') . '">'
-                            . '<td>' . $startExecutionElement . '</td>'
-                            . '<td class="right">' . $schedulerRecord['uid'] . '</td>'
-                            . '<td>' . $this->makeStatusLabel($labels) . $taskName . $taskDesc . '</td>'
-                            . '<td>' . $execType . '</td>'
-                            . '<td>' . $frequency . '</td>'
-                            . '<td>' . $multiple . '</td>'
-                            . '<td>' . $lastExecution . '</td>'
-                            . '<td>' . $nextDate . '</td>'
-                            . '<td nowrap="nowrap">' . $actions . '</td>'
+                        '<tr class="' . ($showAsDisabled ? 'disabled' : '') . ' taskGroup_' . $taskIndex . '">'
+                            . '<td><span class="t-span">' . $startExecutionElement . '</span></td>'
+                            . '<td class="right"><span class="t-span">' . $schedulerRecord['uid'] . '</span></td>'
+                            . '<td><span class="t-span">' . $this->makeStatusLabel($labels) . $taskName . $taskDesc . '</span></td>'
+                            . '<td><span class="t-span">' . $execType . '</span></td>'
+                            . '<td><span class="t-span">' . $frequency . '</span></td>'
+                            . '<td><span class="t-span">' . $multiple . '</span></td>'
+                            . '<td><span class="t-span">' . $lastExecution . '</span></td>'
+                            . '<td><span class="t-span">' . $nextDate . '</span></td>'
+                            . '<td nowrap="nowrap"><span class="t-span">' . $actions . '</span></td>'
                         . '</tr>';
                 } else {
                     // The task object is not valid
index e62f2b2..eca82bd 100644 (file)
                        <trans-unit id="label.group">
                                <source>Task group</source>
                        </trans-unit>
+                       <trans-unit id="label.noGroup">
+                               <source>(no task group defined)</source>
+                       </trans-unit>
                        <trans-unit id="msg.addError">
                                <source>The task could not be added.</source>
                        </trans-unit>
index de34770..92017b5 100644 (file)
@@ -118,6 +118,17 @@ define(['jquery'], function($) {
        };
 
        /**
+        * Toggle the visibility of task groups
+        *
+        * @param {Object} theSelector
+        */
+       Scheduler.toggleTaskGroups = function(theSelector) {
+               taskGroup = theSelector.data('task-group-id');
+               var taskGroupClass= '.taskGroup_' + taskGroup;
+               $(taskGroupClass).toggleClass('taskGroup--close');
+       };
+
+    /**
         * Registers listeners
         */
        Scheduler.initializeEvents = function() {
@@ -138,6 +149,10 @@ define(['jquery'], function($) {
                $('#task_tableGarbageCollection_table').change(function() {
                        Scheduler.actOnChangeSchedulerTableGarbageCollectionTable($(this));
                });
+
+               $('.taskGroup').on('click', function() {
+                       Scheduler.toggleTaskGroups($(this));
+               });
        };
 
        /**