[BUGFIX] Add reference count to delete message 87/47387/3
authorGianluigi Martino <gmartino27@gmail.com>
Thu, 24 Mar 2016 16:02:00 +0000 (17:02 +0100)
committerNicole Cordes <typo3@cordes.co>
Wed, 30 Mar 2016 20:59:58 +0000 (22:59 +0200)
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/47387
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
typo3/sysext/lang/locallang_core.xlf

index 503f81e..3dab406 100644 (file)
@@ -924,7 +924,14 @@ class ClickMenu {
                $editOnClick = '';
                $loc = 'top.content.list_frame';
                if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
-                       $conf = 'confirm(' . GeneralUtility::quoteJSvalue((sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), basename($path)) . BackendUtility::referenceCount('_FILE', $path, ' (There are %s reference(s) to this file!)'))) . ')';
+                       $fileOrFolderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($path);
+                       $confirmMessage = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName());
+                       if ($fileOrFolderObject instanceof Folder) {
+                               $confirmMessage .= BackendUtility::referenceCount('_FILE', $fileOrFolderObject->getIdentifier(), ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFolder'));
+                       } else {
+                               $confirmMessage .= BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFile'));
+                       }
+                       $conf = 'confirm(' . GeneralUtility::quoteJSvalue($confirmMessage) . ')';
                } else {
                        $conf = '1==1';
                }
index 8965e89..a912c0b 100644 (file)
@@ -370,6 +370,12 @@ Do you want to continue WITHOUT saving?</source>
                        <trans-unit id="labels.referencesToRecord" xml:space="preserve">
                                <source>(There are %s reference(s) to this record!)</source>
                        </trans-unit>
+                       <trans-unit id="labels.referencesToFolder">
+                               <source>(There are %s reference(s) to this folder!)</source>
+                       </trans-unit>
+                       <trans-unit id="labels.referencesToFile">
+                               <source>(There are %s reference(s) to this file!)</source>
+                       </trans-unit>
                        <trans-unit id="labels.translationsOfRecord" xml:space="preserve">
                                <source>(This record has %s translation(s) which will be deleted, too!)</source>
                        </trans-unit>