[TASK] Page Quickedit: Use new modal confirmation dialog for record delete 83/45483/3
authorMichael Oehlhof <typo3@oehlhof.de>
Mon, 28 Dec 2015 18:25:39 +0000 (19:25 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Wed, 30 Dec 2015 07:27:27 +0000 (08:27 +0100)
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>
typo3/sysext/backend/Classes/Controller/PageLayoutController.php

index 124325a..2c299ba 100755 (executable)
@@ -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);