[TASK] Check number of file extensions 07/58907/3
authorGuido Schmechel <guido.schmechel@brandung.de>
Fri, 16 Nov 2018 21:46:34 +0000 (22:46 +0100)
committerBenni Mack <benni@typo3.org>
Mon, 19 Nov 2018 08:34:39 +0000 (09:34 +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/58907
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Resources/Private/Templates/File/CreateFolder.html

index 2be823e..d23bf5f 100644 (file)
         </div>
     </f:if>
     <f:if condition="{moduleUrlOnlineMedia}">
-        <form action="{moduleUrlOnlineMedia}" method="post" name="editform2">
-            <h3><f:translate key="LLL:EXT:core/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:core/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="data[newMedia][0][url]"
-                                       placeholder="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:online_media.new_media.placeholder')}" />
-                                <input type="hidden" name="data[newMedia][0][target]" value="{target}" />
-                            </div>
-                            <div class="help-block">
-                                <f:translate key="LLL:EXT:core/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:core/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:core/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="data[newMedia][0][url]"
+                                           placeholder="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:online_media.new_media.placeholder')}" />
+                                    <input type="hidden" name="data[newMedia][0][target]" value="{target}" />
+                                </div>
+                                <div class="help-block">
+                                    <f:translate key="LLL:EXT:core/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:core/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:core/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:core/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:core/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="data[newfile][0][data]" onchange="changed=true;" />
-                                <input type="hidden" name="data[newfile][0][target]" value="{target}" />
-                            </div>
-                            <div class="help-block">
-                                <f:translate key="LLL:EXT:core/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>
+        </f:if>
+        <f:if condition="{txtFileExtList -> f:count()} > 0">
+            <form action="{moduleUrlTceFile}" method="post" name="editform3">
+                <h3><f:translate key="LLL:EXT:core/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:core/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="data[newfile][0][data]" onchange="changed=true;" />
+                                    <input type="hidden" name="data[newfile][0][target]" value="{target}" />
+                                </div>
+                                <div class="help-block">
+                                    <f:translate key="LLL:EXT:core/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:core/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.newfile_submit" /></button>
+                        <input type="hidden" name="data[newfile][0][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:core/Resources/Private/Language/locallang_core.xlf:file_newfolder.php.newfile_submit" /></button>
-                    <input type="hidden" name="data[newfile][0][redirect]" value="{returnUrl}" />
-                </div>
-            </div>
-        </form>
+            </form>
+        </f:if>
     </f:if>
 </div>