[TASK] Filelist: Create new file and opening it immediately for editing 07/45007/6
authorMichael Oehlhof <typo3@oehlhof.de>
Sat, 28 Nov 2015 00:32:43 +0000 (01:32 +0100)
committerFrans Saris <franssaris@gmail.com>
Wed, 13 Jan 2016 09:30:35 +0000 (10:30 +0100)
Resolves: #22858
Releases: master
Change-Id: Ic6c0a6425df8b2d3a763dffac4824e086997f7f5
Reviewed-on: https://review.typo3.org/45007
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/backend/Classes/Controller/File/CreateFolderController.php
typo3/sysext/backend/Classes/Controller/File/FileController.php
typo3/sysext/core/Documentation/Changelog/master/Important-22858-FilelistCreatingANewFileAndOpeningItImmediatelyForEditing.rst [new file with mode: 0644]

index bb16c05..da6b4ca 100644 (file)
@@ -269,10 +269,10 @@ class CreateFolderController extends AbstractModule
                                        </div>
                                </div>
                                ';
-            // Submit button for creation of a new file:
+            // Submit button for "creation of a new file":
             $code .= '
                                <div class="form-group">
-                                       <input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', true) . '" />
+                                       <button class="btn btn-default" name="edit" type="submit" value="1">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', true) . '</button>
                                        <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
                                </div>
                        ';
index 2ddf555..ffc9f05 100644 (file)
@@ -23,6 +23,7 @@ use TYPO3\CMS\Core\Resource\DuplicationBehavior;
 use TYPO3\CMS\Core\Resource\Folder;
 use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\HttpUtility;
 
 /**
  * Gateway for TCE (TYPO3 Core Engine) file-handling through POST forms.
@@ -183,6 +184,16 @@ class FileController
 
         BackendUtility::setUpdateSignal('updateFolderTree');
 
+        // go and edit the new created file
+        if ($request->getParsedBody()['edit']) {
+            $urlParameters = [
+                'target' => $this->file['newfile'][0]['target'] . $this->file['newfile'][0]['data']
+            ];
+            if ($this->redirect) {
+                $urlParameters['returnUrl'] = $this->redirect;
+            }
+            $this->redirect = BackendUtility::getModuleUrl('file_edit', $urlParameters);
+        }
         if ($this->redirect) {
             return $response
                     ->withHeader('Location', GeneralUtility::locationHeaderUrl($this->redirect))
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-22858-FilelistCreatingANewFileAndOpeningItImmediatelyForEditing.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-22858-FilelistCreatingANewFileAndOpeningItImmediatelyForEditing.rst
new file mode 100644 (file)
index 0000000..0a24fdb
--- /dev/null
@@ -0,0 +1,9 @@
+======================================================================================
+Feature: #22858 - Filelist: Creating a new file and opening it immediately for editing
+======================================================================================
+
+Description
+===========
+
+A little usability improvement has been added when creating new files in fileadmin.
+Pressing the button "Create file" creates a new file and immediately opens the file for editing.
\ No newline at end of file