[FEATURE] EXT:Scheduler: Create task group from add/edit task form 34/55234/6
authorMichael Oehlhof <typo3@oehlhof.de>
Sat, 30 Dec 2017 12:39:49 +0000 (13:39 +0100)
committerFrans Saris <franssaris@gmail.com>
Fri, 23 Feb 2018 14:58:49 +0000 (15:58 +0100)
Resolves: #69187
Releases: master
Change-Id: I880f476c1df8cc4c92eec099eaa6f5439b5cc359
Reviewed-on: https://review.typo3.org/55234
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/core/Documentation/Changelog/master/Feature-69187-EXTSchedulerCreateTaskGroupFromAddeditTaskForm.rst [new file with mode: 0644]
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/Classes/ViewHelpers/EditRecordViewHelper.php [new file with mode: 0644]
typo3/sysext/scheduler/Documentation/Administration/GroupTask/Index.rst
typo3/sysext/scheduler/Documentation/Images/AddingATask.png
typo3/sysext/scheduler/Resources/Private/Templates/Backend/SchedulerModule/EditTask.html

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-69187-EXTSchedulerCreateTaskGroupFromAddeditTaskForm.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-69187-EXTSchedulerCreateTaskGroupFromAddeditTaskForm.rst
new file mode 100644 (file)
index 0000000..f028e9a
--- /dev/null
@@ -0,0 +1,20 @@
+.. include:: ../../Includes.txt
+
+==========================================================================
+Feature: #69187 - EXT:Scheduler: Create task group from add/edit task form
+==========================================================================
+
+See :issue:`69187`
+
+Description
+===========
+
+It is now possible to create a new scheduler task group while editing or creating a task.
+
+
+Impact
+======
+
+It is no longer needed to switch to the list module and create a new task group on page 0 before editing or creating a scheduler task.
+
+.. index:: Backend, NotScanned
index c602b12..1cbaac0 100644 (file)
@@ -703,6 +703,7 @@ class SchedulerModuleController
         }
         $this->view->assign('additionalFields', $additionalFieldList);
 
+        $this->view->assign('returnUrl', rawurlencode((string)GeneralUtility::getIndpEnv('REQUEST_URI')));
         $this->view->assign('table', implode(LF, $table));
         $this->view->assign('now', $this->getServerTime());
 
diff --git a/typo3/sysext/scheduler/Classes/ViewHelpers/EditRecordViewHelper.php b/typo3/sysext/scheduler/Classes/ViewHelpers/EditRecordViewHelper.php
new file mode 100644 (file)
index 0000000..50f71d6
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+namespace TYPO3\CMS\Scheduler\ViewHelpers;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
+use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
+
+/**
+ * Edit Record ViewHelper, see FormEngine logic
+ *
+ * @internal
+ */
+class EditRecordViewHelper extends AbstractViewHelper
+{
+    use CompileWithRenderStatic;
+
+    /**
+     * Initializes the arguments
+     */
+    public function initializeArguments()
+    {
+        $this->registerArgument('parameters', 'string', 'Is a set of GET params to send to FormEngine', true);
+    }
+
+    /**
+     * Returns a URL to link to FormEngine
+     *
+     * @param array $arguments
+     * @param \Closure $renderChildrenClosure
+     * @param RenderingContextInterface $renderingContext
+     *
+     * @see \TYPO3\CMS\Backend\Routing\UriBuilder::buildUriFromRoute()
+     * @return string URL to FormEngine module + parameters
+     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
+     */
+    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
+    {
+        $parameters = GeneralUtility::explodeUrl2Array($arguments['parameters']);
+        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
+        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+        return (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters);
+    }
+}
index 5a6435b..32e3cf3 100644 (file)
@@ -28,6 +28,9 @@ Scheduler task groups are records stored on the root page (pid=0). They may be c
    Management of scheduler task groups
 
 
+It is also possible to create a new task group from within the edit task form whith clicking on the `+` icon next to the
+task group select box.
+
 Individual tasks may then be edited as usual and associated to a given scheduler task group.
 
 The individual groups can be sorted independent of each other by clicking the column label.
index 2b0148e..93daf7f 100644 (file)
Binary files a/typo3/sysext/scheduler/Documentation/Images/AddingATask.png and b/typo3/sysext/scheduler/Documentation/Images/AddingATask.png differ
index 9be2e64..d5518d8 100644 (file)
@@ -1,3 +1,5 @@
+{namespace sched = TYPO3\CMS\Scheduler\ViewHelpers}
+
 <input type="hidden" name="tx_scheduler[uid]" value="{uid}" />
 <input type="hidden" name="previousCMD" value="{cmd}" />
 
     <div class="form-group">
         <f:be.labels.csh table="{csh}" field="task_group" label="{lang}label.group"/>
         <div class="form-control-wrap">
-            <select name="tx_scheduler[task_group]" id="task_class" class="form-control">
-                <option value="0" title=""></option>
-                <f:for each="{registeredTaskGroups}" as="registeredTaskGroup">
-                    <option value="{registeredTaskGroup.uid}" title="{registeredTaskGroup.groupName}" {registeredTaskGroup.selected}>
-                    {registeredTaskGroup.groupName}
-                    </option>
-                </f:for>
-            </select>
+            <div class="input-group">
+                <select name="tx_scheduler[task_group]" id="task_class" class="form-control">
+                    <option value="0" title=""></option>
+                    <f:for each="{registeredTaskGroups}" as="registeredTaskGroup">
+                        <option value="{registeredTaskGroup.uid}" title="{registeredTaskGroup.groupName}" {registeredTaskGroup.selected}>
+                        {registeredTaskGroup.groupName}
+                        </option>
+                    </f:for>
+                </select>
+                <div class="input-group-btn" role="group">
+                    <a class="btn btn-default" href="{sched:editRecord(parameters: 'edit[tx_scheduler_task_group][0]=new&returnUrl={returnUrl}')}" ><core:icon identifier="actions-add" /></a>
+                </div>
+            </div>
         </div>
     </div>
 </div>