[TASK] Replace confirm in Create Folder page 31/46531/3
authorFrank Naegler <frank.naegler@typo3.org>
Mon, 8 Feb 2016 14:46:21 +0000 (15:46 +0100)
committerBenni Mack <benni@typo3.org>
Thu, 11 Feb 2016 14:16:29 +0000 (15:16 +0100)
Resolves: #68255
Releases: master
Change-Id: Ic2283f4ea8d43059b1c84cafefc79d6b60afa9ff
Reviewed-on: https://review.typo3.org/46531
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Controller/File/CreateFolderController.php

index f91156b..3f0000d 100644 (file)
@@ -126,15 +126,30 @@ class CreateFolderController extends AbstractModule
         $this->moduleTemplate->addJavaScriptCode(
             'CreateFolderInlineJavaScript',
             'var path = "' . $this->target . '";
+            var confirmTitle = '
+            . GeneralUtility::quoteJSvalue(
+                $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:pleaseConfirm')
+            )
+            . ';
+            var confirmText = '
+            . GeneralUtility::quoteJSvalue(
+                $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.redraw')
+            )
+            . ';
             function reload(a) {
-            if (!changed || (changed && confirm(' .
-            GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.redraw'))
-            . '))) {
-                    var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl='
-            . rawurlencode($this->returnUrl)
-            . '";
-                    window.location.href = '
-            . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('file_newfolder')) . '+params;
+                var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '";
+                var url = \'' . BackendUtility::getModuleUrl('file_newfolder') . '\';
+                if (!changed) {
+                    window.location.href = url + params;
+                } else {
+                    var modal = top.TYPO3.Modal.confirm(confirmTitle, confirmText);
+                    modal.on(\'confirm.button.cancel\', function(e) {
+                        top.TYPO3.Modal.currentModal.trigger(\'modal-dismiss\');
+                    });
+                    modal.on(\'confirm.button.ok\', function(e) {
+                        top.TYPO3.Modal.currentModal.trigger(\'modal-dismiss\');
+                        window.location.href = url + params;
+                    });
                 }
             }
             function backToList() {