[BUGFIX] Add reference count to delete message 29/47329/6
authorGianluigi Martino <gmartino27@gmail.com>
Sat, 19 Mar 2016 06:49:56 +0000 (07:49 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Thu, 24 Mar 2016 15:51:00 +0000 (16:51 +0100)
If you delete a file or folder by using the clickmenu, a confirmation
message without reference count is shown. To streamline the confirmation
message with the one from FileList, the reference count is added with
this patch.

Resolves: #75156
Releases: master, 7.6, 6.2
Change-Id: I84fe8c853199cdb4e0ff422cdb5fc327e4bdc683
Reviewed-on: https://review.typo3.org/47329
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php

index b16a9f1..7db8093 100644 (file)
@@ -1145,18 +1145,18 @@ class ClickMenu
             GeneralUtility::quoteJSvalue(
                 '&file[delete][0][data]=' . rawurlencode($path) . '&vC=' . $this->backendUser->veriCode()
             );
-
         if ($this->backendUser->jsConfirmation(JsConfirmation::DELETE)) {
+            $fileOrFolderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($path);
             $title = $this->languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete');
             $confirmMessage = sprintf(
                 $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'),
-                basename($path)
-            );
-            $confirmMessage .= BackendUtility::referenceCount(
-                '_FILE',
-                $path,
-                ' ' . $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFile')
+                $fileOrFolderObject->getName()
             );
+            if ($fileOrFolderObject instanceof Folder) {
+                $confirmMessage .= BackendUtility::referenceCount('_FILE', $fileOrFolderObject->getIdentifier(), ' ' . $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFolder'));
+            } else {
+                $confirmMessage .= BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' ' . $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFile'));
+            }
             $jsCode = 'top.TYPO3.Modal.confirm(' . GeneralUtility::quoteJSvalue($title) . ', '
                 . GeneralUtility::quoteJSvalue($confirmMessage) . ')'
                 . '.on(\'button.clicked\', function(e) { if (e.target.name === \'ok\') {'