[TASK] Streamline layout of "New file or folder wizard" 18/37018/5
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 19 Feb 2015 11:52:29 +0000 (12:52 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 19 Feb 2015 21:16:57 +0000 (22:16 +0100)
Update the forms to the new layout used in the backend. Remove the
redundant "Cancel" buttons, as the same action is in the top bar
already.

Resolves: #65171
Releases: master
Change-Id: Ie056210ceefd01460c37b370c88e64ba5526354e
Reviewed-on: http://review.typo3.org/37018
Reviewed-by: Benjamin Kott <info@bk2k.info>
Tested-by: Benjamin Kott <info@bk2k.info>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Controller/File/CreateFolderController.php
typo3/sysext/lang/locallang_core.xlf

index cd885a3..b83060b 100644 (file)
@@ -151,35 +151,45 @@ class CreateFolderController {
                        $this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10);
                        $code .= '
                                <div class="form-group">
-                                       <label for="number-of-new-folders">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . '</label>
-                                       <select name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">';
-                       for ($a = 1; $a <= $this->folderNumber; $a++) {
-                               $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>';
-                       }
-                       $code .= '
-                                       </select>
-                               </div>
+                                       <div class="form-section">
+                                               <div class="form-group">
+                                                       <label for="number-of-new-folders">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder') . '</label>
+                                                       <div class="form-control-wrap">
+                                                               <div class="input-group">
+                                                                       <select class="form-control form-control-adapt" name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">';
+                                                                               for ($a = 1; $a <= $this->folderNumber; $a++) {
+                                                                                       $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>';
+                                                                               }
+                                                                               $code .= '
+                                                                       </select>
+                                                               </div>
+                                                       </div>
+                                               </div>
+                                       </div>
                                ';
                        // Making the number of new-folder boxes needed:
                        for ($a = 0; $a < $this->number; $a++) {
                                $code .= '
-                               <div class="form-group">
-                                               <input type="text" class="form-control" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" />
-                                               <input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" />
-                               </div>';
+                                       <div class="form-section">
+                                               <div class="form-group">
+                                                       <label for="folder_new_' . $a . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfolder') . ' ' . ($a + 1) . ':</label>
+                                                       <div class="form-control-wrap">
+                                                               <input type="text" class="form-control" id="folder_new_' . $a . '" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" />
+                                                               <input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" />
+                                                       </div>
+                                               </div>
+                                       </div>';
                        }
                        // Making submit button for folder creation:
                        $code .= '
-                               <div class="form-group">
-                                       <input class="btn btn-primary" type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />
-                                       <input class="btn btn-danger" type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
+                               </div><div class="form-group">
+                                       <input class="btn btn-default" type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />
                                        <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
                                        ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
-                                       ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder') . '
                                </div>
                                ';
-                       $pageContent .= $code;
                        // Switching form tags:
+                       $pageContent .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfolders'), $code);
                        $pageContent .= $this->doc->sectionEnd() . '</form>';
                }
 
@@ -190,25 +200,33 @@ class CreateFolderController {
                        $textfileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE);
                        foreach ($textfileExt as $fileExt) {
                                if (!preg_match(('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i'), ('.' . $fileExt))) {
-                                       $fileExtList[] = '*.' . $fileExt;
+                                       $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>';
                                }
                        }
                        // Add form fields for creation of a new, blank text file:
                        $code = '
                                <div class="form-group">
-                                       <label>[' . htmlspecialchars(implode(', ', $fileExtList)) . ']</label>
-                                       <input class="form-control" type="text" name="file[newfile][0][data]" onchange="changed=true;" />
-                                       <input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" />
+                                       <div class="form-section">
+                                               <div class="form-group">
+                                                       <label for="newfile">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfile') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile') . '</label>
+                                                       <div class="form-control-wrap">
+                                                               <input class="form-control" type="text" id="newfile" name="file[newfile][0][data]" onchange="changed=true;" />
+                                                               <input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" />
+                                                       </div>
+                                                       <div class="help-block">
+                                                               ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.allowedFileExtensions') . '<br>
+                                                               ' . implode(' ', $fileExtList) . '
+                                                       </div>
+                                               </div>
+                                       </div>
                                </div>
                                ';
                        // Submit button for creation of a new file:
                        $code .= '
                                <div class="form-group">
-                                       <input class="btn btn-primary" type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" />
-                                       <input class="btn btn-danger" type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
+                                       <input class="btn btn-default" type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" />
                                        <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
                                        ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
-                                       ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile') . '
                                </div>
                                ';
                        $pageContent .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code);
index 6a59f39..2763dd7 100644 (file)
@@ -535,6 +535,12 @@ Do you want to continue WITHOUT saving?</source>
                        <trans-unit id="file_newfolder.php.pagetitle" xml:space="preserve">
                                <source>New file or folder</source>
                        </trans-unit>
+                       <trans-unit id="file_newfolder.php.newfolders" xml:space="preserve">
+                               <source>Create new folders</source>
+                       </trans-unit>
+                       <trans-unit id="file_newfolder.php.label_newfolder" xml:space="preserve">
+                               <source>Folder</source>
+                       </trans-unit>
                        <trans-unit id="file_newfolder.php.submit" xml:space="preserve">
                                <source>Create folders</source>
                        </trans-unit>
@@ -547,6 +553,9 @@ Do you want to continue WITHOUT saving?</source>
                        <trans-unit id="file_newfolder.php.newfile" xml:space="preserve">
                                <source>Create new textfile</source>
                        </trans-unit>
+                       <trans-unit id="file_newfolder.php.label_newfile" xml:space="preserve">
+                               <source>File name:</source>
+                       </trans-unit>
                        <trans-unit id="file_newfolder.php.number_of_folders" xml:space="preserve">
                                <source>Number of folders:</source>
                        </trans-unit>