From c027bc10835372968a2ccacad856b226b3dc1957 Mon Sep 17 00:00:00 2001
From: Michael Oehlhof <typo3@oehlhof.de>
Date: Mon, 28 Dec 2015 19:25:39 +0100
Subject: [PATCH] [TASK] Page Quickedit: Use new modal confirmation dialog for
 record delete

Resolves: #72353
Releases: master, 7.6
Change-Id: Icdf8b2a54e06b19753551e5e22db69763edb8883
Reviewed-on: https://review.typo3.org/45483
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
---
 .../Classes/Controller/PageLayoutController.php      | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
index 124325af1792..2c299badfb11 100755
--- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
+++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
@@ -618,9 +618,8 @@ class PageLayoutController
                 }
                 ' . ($this->popView ? BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id)) : '') . '
                 function deleteRecord(table,id,url) {   //
-                    if (confirm(' . GeneralUtility::quoteJSvalue($lang->getLL('deleteWarning')) . ')) {
-                        window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $this->getBackendUser()->veriCode() . '&prErr=1&uPT=1";
-                    }
+                    window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[')
+                                             . ' + table + "][" + id + "][delete]=1&redirect=" + encodeURIComponent(url) + "&vC=' . $this->getBackendUser()->veriCode() . '&prErr=1&uPT=1";
                     return false;
                 }
             ');
@@ -1191,9 +1190,14 @@ class PageLayoutController
 
                 // Delete record
                 if ($this->deleteButton) {
+                    $dataAttributes = array();
+                    $dataAttributes['table'] = $this->eRParts[0];
+                    $dataAttributes['uid'] = $this->eRParts[1];
+                    $dataAttributes['return-url'] = BackendUtility::getModuleUrl($this->moduleName) . '&id=' . $this->id;
                     $deleteButton = $this->buttonBar->makeLinkButton()
                         ->setHref('#')
-                        ->setOnClick('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl($this->moduleName) . '&id=' . $this->id) . ');')
+                        ->setClasses('t3js-editform-delete-record')
+                        ->setDataAttributes($dataAttributes)
                         ->setTitle($lang->getLL('deleteItem'))
                         ->setIcon($this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL));
                     $this->buttonBar->addButton($deleteButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
-- 
GitLab