[TASK] Use modal dialog for refresh after field change 31/43331/6
authorMathias Brodala <mbrodala@pagemachine.de>
Tue, 15 Sep 2015 13:12:31 +0000 (15:12 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 25 Sep 2015 14:54:54 +0000 (16:54 +0200)
This uses a modal dialog to confirm refresh after a change
to a field with requestUpdate/onChange=reload.

Resolves: #69828
Releases: master
Change-Id: I16697b52ea01d56881a62f9a850e8b32e4af692f
Reviewed-on: http://review.typo3.org/43331
Reviewed-by: Markus Sommer <markussom@posteo.de>
Tested-by: Markus Sommer <markussom@posteo.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php
typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php
typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php
typo3/sysext/backend/Classes/Form/FormResultCompiler.php
typo3/sysext/lang/locallang_core.xlf

index 2614d35..829c64d 100644 (file)
@@ -109,7 +109,7 @@ class FlexFormElementContainer extends AbstractContainer {
                                                || !empty($GLOBALS['TCA'][$table]['ctrl']['requestUpdate']) && GeneralUtility::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $flexFormFieldName)
                                        ) {
                                                if ($this->getBackendUserAuthentication()->jsConfirmation(JsConfirmation::TYPE_CHANGE)) {
-                                                       $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
+                                                       $alertMsgOnChange = 'top.TYPO3.Modal.confirm(TBE_EDITOR.labels.refreshRequired.title, TBE_EDITOR.labels.refreshRequired.content).on("button.clicked", function(e) { if (e.target.name == "ok" && TBE_EDITOR.checkSubmit(-1)) { TBE_EDITOR.submitForm() } top.TYPO3.Modal.dismiss(); });';
                                                } else {
                                                        $alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm();}';
                                                }
index 98c9095..7be1ab5 100644 (file)
@@ -119,7 +119,7 @@ class SingleFieldContainer extends AbstractContainer {
                        && GeneralUtility::inList(str_replace(' ', '', $this->data['processedTca']['ctrl']['requestUpdate']), $fieldName)
                ) {
                        if ($backendUser->jsConfirmation(JsConfirmation::TYPE_CHANGE)) {
-                               $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
+                               $alertMsgOnChange = 'top.TYPO3.Modal.confirm(TBE_EDITOR.labels.refreshRequired.title, TBE_EDITOR.labels.refreshRequired.content).on("button.clicked", function(e) { if (e.target.name == "ok" && TBE_EDITOR.checkSubmit(-1)) { TBE_EDITOR.submitForm() } top.TYPO3.Modal.dismiss(); });';
                        } else {
                                $alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                        }
@@ -588,5 +588,4 @@ class SingleFieldContainer extends AbstractContainer {
        protected function getLanguageService() {
                return $GLOBALS['LANG'];
        }
-
 }
index e28b012..8cbce6b 100644 (file)
@@ -133,7 +133,7 @@ class SelectTreeElement extends AbstractFormElement {
                        && GeneralUtility::inList(str_replace(' ', '', $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']), $field)
                ) {
                        if ($this->getBackendUserAuthentication()->jsConfirmation(JsConfirmation::TYPE_CHANGE)) {
-                               $onChange .= 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && ' . 'TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
+                               $onChange = 'top.TYPO3.Modal.confirm(TBE_EDITOR.labels.refreshRequired.title, TBE_EDITOR.labels.refreshRequired.content).on("button.clicked", function(e) { if (e.target.name == "ok" && TBE_EDITOR.checkSubmit(-1)) { TBE_EDITOR.submitForm() } top.TYPO3.Modal.dismiss(); });';
                        } else {
                                $onChange .= 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                        }
index 774b7bc..ab1086c 100644 (file)
@@ -272,7 +272,9 @@ class FormResultCompiler {
                TBE_EDITOR.labels.fieldsMissing = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.fieldsMissing')) . ';
                TBE_EDITOR.labels.maxItemsAllowed = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.maxItemsAllowed')) . ';
                TBE_EDITOR.labels.refresh_login = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login')) . ';
-               TBE_EDITOR.labels.onChangeAlert = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.onChangeAlert')) . ';
+               TBE_EDITOR.labels.refreshRequired = {};
+               TBE_EDITOR.labels.refreshRequired.title = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.refreshRequired.title')) . ';
+               TBE_EDITOR.labels.refreshRequired.content = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.refreshRequired.content')) . ';
                TBE_EDITOR.labels.remainingCharacters = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.remainingCharacters')) . ';
                TBE_EDITOR.customEvalFunctions = {};
                ';
index 065ae35..535a3b9 100644 (file)
@@ -728,9 +728,11 @@ Do you want to refresh it now?</source>
                        <trans-unit id="mess.noSelItemForEdit">
                                <source>Please select one or more items in the list before you can edit.</source>
                        </trans-unit>
-                       <trans-unit id="mess.onChangeAlert" xml:space="preserve">
-                               <source>This change will affect which fields are available in the form.
-Would you like to save now in order to refresh the display?</source>
+                       <trans-unit id="mess.refreshRequired.title">
+                               <source>Refresh required</source>
+                       </trans-unit>
+                       <trans-unit id="mess.refreshRequired.content">
+                               <source>This change will affect which fields are available in the form. Would you like to save now in order to refresh the display?</source>
                        </trans-unit>
                        <trans-unit id="mess.move_into">
                                <source>Move "%s" into "%s"?</source>