[TASK] Check number of file extensions 13/58913/2
authorBenni Mack <benni@typo3.org>
Mon, 19 Nov 2018 08:36:48 +0000 (09:36 +0100)
committerBenni Mack <benni@typo3.org>
Mon, 19 Nov 2018 09:03:14 +0000 (10:03 +0100)
Show the add media and text form only if at least
one file extension exists.

Resolves: #86925
Releases: master, 8.7
Change-Id: I37c23800f1ddda78b7f248c0de9e970a73976c4a
Reviewed-on: https://review.typo3.org/58913
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Resources/Private/Templates/File/CreateFolder.html

index a0ee00c..b6769e8 100644 (file)
         </div>
     </f:if>
     <f:if condition="{moduleUrlOnlineMedia}">
-        <form action="{moduleUrlOnlineMedia}" method="post" name="editform2">
-            <h3><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media" /></h3>
-            <div>
-                <div class="form-group">
-                    <div class="form-section">
-                        <div class="form-group">
-                            <label for="newMedia"><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.label" /></label> {cshFileNewMedia -> f:format.raw()}
-                            <div class="form-control-wrap">
-                                <input class="form-control" type="text" id="newMedia" name="file[newMedia][0][url]"
-                                       placeholder="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.placeholder')}" />
-                                <input type="hidden" name="file[newMedia][0][target]" value="{target}" />
-                            </div>
-                            <div class="help-block">
-                                <f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.allowedProviders" /><br>
-                                <f:for each="{fileExtList}" as="fileExt">
-                                    <span class="label label-success">{fileExt}</span>
-                                </f:for>
+        <f:if condition="{fileExtList -> f:count()} > 0">
+            <form action="{moduleUrlOnlineMedia}" method="post" name="editform2">
+                <h3><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media" /></h3>
+                <div>
+                    <div class="form-group">
+                        <div class="form-section">
+                            <div class="form-group">
+                                <label for="newMedia"><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.label" /></label> {cshFileNewMedia -> f:format.raw()}
+                                <div class="form-control-wrap">
+                                    <input class="form-control" type="text" id="newMedia" name="file[newMedia][0][url]"
+                                           placeholder="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.placeholder')}" />
+                                    <input type="hidden" name="file[newMedia][0][target]" value="{target}" />
+                                </div>
+                                <div class="help-block">
+                                    <f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.allowedProviders" /><br>
+                                    <f:for each="{fileExtList}" as="fileExt">
+                                        <span class="label label-success">{fileExt}</span>
+                                    </f:for>
+                                </div>
                             </div>
                         </div>
                     </div>
+                    <div class="form-group">
+                        <input class="btn btn-default" type="submit" value="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.submit')}" />
+                        <input type="hidden" name="redirect" value="{returnUrl}" />
+                    </div>
                 </div>
-                <div class="form-group">
-                    <input class="btn btn-default" type="submit" value="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:online_media.new_media.submit')}" />
-                    <input type="hidden" name="redirect" value="{returnUrl}" />
-                </div>
-            </div>
-        </form>
-        <form action="{moduleUrlTceFile}" method="post" name="editform3">
-            <h3><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.newfile" /></h3>
-            <div>
-                <div class="form-group">
-                    <div class="form-section">
-                        <div class="form-group">
-                            <label for="newfile"><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.label_newfile" /></label> {cshFileNewFile -> f:format.raw()}
-                            <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="{target}" />
-                            </div>
-                            <div class="help-block">
-                                <f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.allowedFileExtensions" /><br>
-                                <f:for each="{txtFileExtList}" as="fileExt">
-                                    <span class="label label-success">{fileExt}</span>
-                                </f:for>
+            </form>
+            <form action="{moduleUrlTceFile}" method="post" name="editform3">
+                <h3><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.newfile" /></h3>
+                <div>
+                    <div class="form-group">
+                        <div class="form-section">
+                            <div class="form-group">
+                                <label for="newfile"><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.label_newfile" /></label> {cshFileNewFile -> f:format.raw()}
+                                <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="{target}" />
+                                </div>
+                                <div class="help-block">
+                                    <f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.allowedFileExtensions" /><br>
+                                    <f:for each="{txtFileExtList}" as="fileExt">
+                                        <span class="label label-success">{fileExt}</span>
+                                    </f:for>
+                                </div>
                             </div>
                         </div>
                     </div>
+                    <div class="form-group">
+                        <button class="btn btn-default" name="edit" type="submit" value="1"><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.newfile_submit" /></button>
+                        <input type="hidden" name="redirect" value="{returnUrl}" />
+                    </div>
                 </div>
-                <div class="form-group">
-                    <button class="btn btn-default" name="edit" type="submit" value="1"><f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.newfile_submit" /></button>
-                    <input type="hidden" name="redirect" value="{returnUrl}" />
-                </div>
-            </div>
-        </form>
+            </form>
+        </f:if>
     </f:if>
 </div>