[BUGFIX] Restore save+view|close|new functionality 47/42647/4
authorMarkus Klein <markus.klein@typo3.org>
Wed, 19 Aug 2015 15:47:01 +0000 (17:47 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 20 Aug 2015 06:35:42 +0000 (08:35 +0200)
Resolves: #68981
Releases: master
Change-Id: I203ed2a58c30cf0da89bedb266453eeff32b34cc
Reviewed-on: http://review.typo3.org/42647
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Daniel Maier <dani-maier@gmx.de>
Tested-by: Daniel Maier <dani-maier@gmx.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js

index 4376e15..8df723b 100644 (file)
@@ -1131,7 +1131,7 @@ class EditDocumentController implements \TYPO3\CMS\Core\Http\ControllerInterface
                // The action of each button is decided by its name attribute. (See doProcessData())
                if (!$this->errorC && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly']) {
                        // SAVE button:
-                       $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="submit" name="_savedok" class="c-inputButton" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
+                       $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="submit" name="_savedok" class="c-inputButton t3js-editform-submitButton" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
                        // SAVE / VIEW button:
                        if ($this->viewId && !$this->noView && $this->getNewIconMode($this->firstEl['table'], 'saveDocView')) {
                                $pagesTSconfig = BackendUtility::getPagesTSconfig($this->pageinfo['uid']);
@@ -1142,15 +1142,15 @@ class EditDocumentController implements \TYPO3\CMS\Core\Http\ControllerInterface
                                        $excludeDokTypes = array(PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, PageRepository::DOKTYPE_SPACER);
                                }
                                if (!in_array((int)$this->pageinfo['doktype'], $excludeDokTypes, TRUE) || isset($pagesTSconfig['TCEMAIN.']['preview.'][$this->firstEl['table'].'.']['previewPageId'])) {
-                                       $buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="submit" class="c-inputButton" name="_savedokview"  value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
+                                       $buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="submit" class="c-inputButton t3js-editform-submitButton" name="_savedokview"  value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
                                }
                        }
                        // SAVE / NEW button:
                        if (count($this->elementsData) === 1 && $this->getNewIconMode($this->firstEl['table'])) {
-                               $buttons['save_new'] = IconUtility::getSpriteIcon('actions-document-save-new', array('html' => '<input type="submit" class="c-inputButton" name="_savedoknew" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc', TRUE) . '" />'));
+                               $buttons['save_new'] = IconUtility::getSpriteIcon('actions-document-save-new', array('html' => '<input type="submit" class="c-inputButton t3js-editform-submitButton" name="_savedoknew" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc', TRUE) . '" />'));
                        }
                        // SAVE / CLOSE
-                       $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="submit" class="c-inputButton" name="_saveandclosedok" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
+                       $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="submit" class="c-inputButton t3js-editform-submitButton" name="_saveandclosedok" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
                        // FINISH TRANSLATION / SAVE / CLOSE
                        if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation']) {
                                $buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok" src="sysext/t3skin/images/icons/actions/document-save-translation.png" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDoc', TRUE) . '" /> ';
index 9ab52a1..e3d8b2d 100644 (file)
@@ -607,6 +607,12 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
                                }
                        });
                });
+
+               // remember the clicked submit button. we need to know that in TBE_EDITOR.submitForm();
+               $(document).on('click', '.t3js-editform-submitButton', function(event) {
+                       var $elem = $('<input />').attr('type', 'hidden').attr('name', this.name).attr('value', '1');
+                       $(this).parents('form').append($elem);
+               });
        };
 
        /**
@@ -849,23 +855,22 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
        /**
         * initialize function, always require possible post-render hooks return the main object
         */
-       return function() {
-               // the functions are both using delegates, thus no need to be called again
-               FormEngine.initializeEvents();
-               FormEngine.SelectBoxFilter.initializeEvents();
-               FormEngine.reinitialize();
-
-               // load required modules to hook in the post initialize function
-               if (undefined !== TYPO3.settings.RequireJS && undefined !== TYPO3.settings.RequireJS.PostInitializationModules['TYPO3/CMS/Backend/FormEngine']) {
-                       $.each(TYPO3.settings.RequireJS.PostInitializationModules['TYPO3/CMS/Backend/FormEngine'], function(pos, moduleName) {
-                               require([moduleName]);
-                       });
-               }
 
-               // make the form engine object publically visible for other objects in the TYPO3 namespace
-               TYPO3.FormEngine = FormEngine;
+       // the functions are both using delegates, thus no need to be called again
+       FormEngine.initializeEvents();
+       FormEngine.SelectBoxFilter.initializeEvents();
+       FormEngine.reinitialize();
+
+       // load required modules to hook in the post initialize function
+       if (undefined !== TYPO3.settings.RequireJS && undefined !== TYPO3.settings.RequireJS.PostInitializationModules['TYPO3/CMS/Backend/FormEngine']) {
+               $.each(TYPO3.settings.RequireJS.PostInitializationModules['TYPO3/CMS/Backend/FormEngine'], function(pos, moduleName) {
+                       require([moduleName]);
+               });
+       }
+
+       // make the form engine object publically visible for other objects in the TYPO3 namespace
+       TYPO3.FormEngine = FormEngine;
 
-               // return the object in the global space
-               return FormEngine;
-       }();
+       // return the object in the global space
+       return FormEngine;
 });