[TASK] Add a "save and new" button in scheduler module 08/31008/7
authorEric Chavaillaz <eric.chavaillaz@gmail.com>
Sat, 21 Jun 2014 16:53:38 +0000 (18:53 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 16 Sep 2014 09:43:15 +0000 (11:43 +0200)
Resolves: #57733
Releases: 6.3, 6.2
Change-Id: I57bd5e842374853a62a5c1e4b419c193837ccb6e
Reviewed-on: http://review.typo3.org/31008
Reviewed-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Stefan Froemken <froemken@gmail.com>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/Resources/Private/Templates/Module.html

index 8cc99eb..67d6977 100644 (file)
@@ -152,7 +152,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                $this->submittedData = GeneralUtility::_GPmerged('tx_scheduler');
                $this->submittedData['uid'] = (int)$this->submittedData['uid'];
                // If a save command was submitted, handle saving now
-               if ($this->CMD === 'save' || $this->CMD === 'saveclose') {
+               if ($this->CMD === 'save' || $this->CMD === 'saveclose' || $this->CMD === 'savenew') {
                        $previousCMD = GeneralUtility::_GP('previousCMD');
                        // First check the submitted data
                        $result = $this->preprocessData();
@@ -165,6 +165,11 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                } elseif ($this->CMD === 'save') {
                                        // After saving a "add form", return to edit
                                        $this->CMD = 'edit';
+                               } elseif ($this->CMD === 'savenew') {
+                                       // Unset submitted data, so that empty form gets displayed
+                                       unset($this->submittedData);
+                                       // After saving a "add/edit form", return to add
+                                       $this->CMD = 'add';
                                } else {
                                        // Return to edit form
                                        $this->CMD = $previousCMD;
@@ -1520,6 +1525,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                        'close' => '',
                        'save' => '',
                        'saveclose' => '',
+                       'savenew' => '',
                        'delete' => '',
                        'reload' => '',
                        'shortcut' => $this->getShortcutButton()
@@ -1536,6 +1542,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                        $buttons['close'] = '<a href="#" onclick="document.location=\'' . $GLOBALS['MCONF']['_'] . '\'" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:cancel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
                        $buttons['save'] = '<button style="padding: 0; margin: 0; cursor: pointer;" type="submit" name="CMD" value="save" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:save', TRUE) . '" />' . IconUtility::getSpriteIcon('actions-document-save') . '</button>';
                        $buttons['saveclose'] = '<button style="padding: 0; margin: 0; cursor: pointer;" type="submit" name="CMD" value="saveclose" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:saveAndClose', TRUE) . '" />' . IconUtility::getSpriteIcon('actions-document-save-close') . '</button>';
+                       $buttons['savenew'] = '<button style="padding: 0; margin: 0; cursor: pointer;" type="submit" name="CMD" value="savenew" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:saveAndCreateNewDoc', TRUE) . '" />' . IconUtility::getSpriteIcon('actions-document-save-new') . '</button>';
                }
                if ($this->CMD === 'edit') {
                        $buttons['delete'] = '<button style="padding: 0; margin: 0; cursor: pointer;" type="submit" name="CMD" value="delete" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '" />' . IconUtility::getSpriteIcon('actions-edit-delete') . '</button>';
index 33d0548..75fbd82 100644 (file)
@@ -27,7 +27,7 @@
 
 <!-- ###BUTTON_GROUPS_LEFT### -->
 <!-- ###BUTTON_GROUP1### -->###ADDTASK######CLOSE###<!-- ###BUTTON_GROUP1### -->
-<!-- ###BUTTON_GROUP2### -->###SAVE######SAVECLOSE###<!-- ###BUTTON_GROUP2### -->
+<!-- ###BUTTON_GROUP2### -->###SAVE######SAVECLOSE######SAVENEW###<!-- ###BUTTON_GROUP2### -->
 <!-- ###BUTTON_GROUP3### -->###DELETE###<!-- ###BUTTON_GROUP3### -->
 <!-- ###BUTTON_GROUPS_LEFT### -->