[TASK] Make file_newfolder.php dispatched 05/32405/3
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 26 Aug 2014 19:28:51 +0000 (21:28 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Sun, 14 Sep 2014 00:40:56 +0000 (02:40 +0200)
Use dispatching for file_newfolder.php

Resolves: #61215
Releases: 6.3
Change-Id: If2ae411543b2a543c828cf029f2596666e0a1296
Reviewed-on: http://review.typo3.org/32405
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/file_newfolder.php
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
typo3/sysext/backend/Classes/Controller/File/CreateFolderController.php
typo3/sysext/backend/Modules/File/Newfolder/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/File/Newfolder/index.php [new file with mode: 0644]
typo3/sysext/backend/ext_tables.php
typo3/sysext/filelist/Classes/Controller/FileListController.php

index c4ec8b1..c929dd6 100644 (file)
  */
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+       'Creating a new folder is moved to an own module. Please use BackendUtility::getModuleUrl(\'file_newfolder\') to link to this script. This script will be removed in two versions.'
+);
+
 $createFolderController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\File\\CreateFolderController');
 $createFolderController->main();
 $createFolderController->printContent();
index 81d46a7..834fb6e 100644 (file)
@@ -869,7 +869,7 @@ class ClickMenu {
                        }
                        // New
                        if (!in_array('new', $this->disabledItems) && $folder && $isOnline) {
-                               $menuItems['new'] = $this->FILE_launch($identifier, 'file_newfolder.php', 'new', 'new_file.gif');
+                               $menuItems['new'] = $this->FILE_launch($identifier, 'file_newfolder', 'new', 'new_file.gif');
                        }
                        // Info
                        if (!in_array('info', $this->disabledItems)) {
@@ -1502,4 +1502,4 @@ class ClickMenu {
                return $str . '.location';
        }
 
-}
\ No newline at end of file
+}
index b747c16..112401e 100644 (file)
@@ -124,7 +124,7 @@ class CreateFolderController {
                        function reload(a) {    //
                                if (!changed || (changed && confirm(' . GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.redraw')) . '))) {
                                        var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '";
-                                       window.location.href = "file_newfolder.php?"+params;
+                                       window.location.href = "' . BackendUtility::getModuleUrl('file_newfolder') . '"+params;
                                }
                        }
                        function backToList() { //
diff --git a/typo3/sysext/backend/Modules/File/Newfolder/conf.php b/typo3/sysext/backend/Modules/File/Newfolder/conf.php
new file mode 100644 (file)
index 0000000..c235ed0
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+//required for mod.php
+$MCONF['name'] = 'file_newfolder';
+$MCONF['script'] = '_DISPATCH';
+$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Newfolder/index.php b/typo3/sysext/backend/Modules/File/Newfolder/index.php
new file mode 100644 (file)
index 0000000..d5edb7a
--- /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!
+ */
+
+$createFolderController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\File\\CreateFolderController');
+$createFolderController->main();
+$createFolderController->printContent();
\ No newline at end of file
index 63bfda8..b05a6a1 100644 (file)
@@ -14,6 +14,12 @@ if (TYPO3_MODE === 'BE') {
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Edit/'
        );
 
+       // Register file_newfolder
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'file_newfolder',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Newfolder/'
+       );
+
        // Register edit wizard
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
                'wizard_edit',
index e334743..0794f33 100644 (file)
@@ -447,7 +447,14 @@ class FileListController {
                if ($this->folderObject && $this->folderObject->checkActionPermission('write')
                        && ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') || $this->folderObject->checkActionPermission('add'))
                ) {
-                       $buttons['new'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_newfolder.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) . '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new') . '</a>';
+                       $buttons['new'] = '<a href="' . htmlspecialchars($GLOBALS['BACK_PATH']
+                               . BackendUtility::getModuleUrl(
+                                       'file_newfolder',
+                                       array(
+                                               'target' => $this->folderObject->getCombinedIdentifier(),
+                                               'returnUrl' => $this->filelist->listURL(),
+                                       )
+                               )) . '" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new') . '</a>';
                }
                return $buttons;
        }