[TASK] Make file_rename.php dispatched 06/32406/4
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 26 Aug 2014 19:37:45 +0000 (21:37 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Mon, 15 Sep 2014 11:59:08 +0000 (13:59 +0200)
Use dispatching for file_rename.php

Resolves: #61216
Releases: master
Change-Id: Id1c42ba7d51fdede87b2834f7b3d766f8b5b6ac7
Reviewed-on: http://review.typo3.org/32406
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/file_rename.php
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
typo3/sysext/backend/Modules/File/Rename/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/File/Rename/index.php [new file with mode: 0644]
typo3/sysext/backend/ext_tables.php
typo3/sysext/filelist/Classes/FileList.php

index 6c3e81f..e8de92b 100644 (file)
  */
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+       'Renaming a file/folder is moved to an own module. Please use BackendUtility::getModuleUrl(\'file_rename\') to link to this script. This script will be removed.'
+);
+
 $renameFileController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\File\\RenameFileController');
 $renameFileController->main();
 $renameFileController->printContent();
index 834fb6e..2f1ba41 100644 (file)
@@ -861,7 +861,7 @@ class ClickMenu {
                        }
                        // Rename
                        if (!in_array('rename', $this->disabledItems) && !$isStorageRoot) {
-                               $menuItems['rename'] = $this->FILE_launch($identifier, 'file_rename.php', 'rename', 'rename.gif');
+                               $menuItems['rename'] = $this->FILE_launch($identifier, 'file_rename', 'rename', 'rename.gif');
                        }
                        // Upload
                        if (!in_array('upload', $this->disabledItems) && $folder && $isOnline) {
diff --git a/typo3/sysext/backend/Modules/File/Rename/conf.php b/typo3/sysext/backend/Modules/File/Rename/conf.php
new file mode 100644 (file)
index 0000000..d9940af
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+// Required for mod.php
+$MCONF['name'] = 'file_rename';
+$MCONF['script'] = '_DISPATCH';
+$MCONF['access'] = '';
diff --git a/typo3/sysext/backend/Modules/File/Rename/index.php b/typo3/sysext/backend/Modules/File/Rename/index.php
new file mode 100644 (file)
index 0000000..1d6881b
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+/**
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+$renameFileController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\File\\RenameFileController');
+$renameFileController->main();
+$renameFileController->printContent();
\ No newline at end of file
index b05a6a1..86dd48c 100644 (file)
@@ -20,6 +20,12 @@ if (TYPO3_MODE === 'BE') {
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Newfolder/'
        );
 
+       // Register file_rename
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'file_rename',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Rename/'
+       );
+
        // Register edit wizard
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
                'wizard_edit',
index b3188b1..c2da487 100644 (file)
@@ -836,8 +836,9 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                }
                // rename the file
                if ($fileOrFolderObject->checkActionPermission('rename')) {
-                       $renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+\'file_rename.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
-                       $cells['rename'] = '<a href="#" onclick="' . $renameOnClick . '"  title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
+                       $url = BackendUtility::getModuleUrl('file_rename', array('target' => $fullIdentifier));
+                       $renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
+                       $cells['rename'] = '<a href="#" onclick="' . htmlspecialchars($renameOnClick) . '"  title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
                } else {
                        $cells['rename'] = IconUtility::getSpriteIcon('empty-empty');
                }