[ofbiz-framework] branch release18.12 updated: Improved: Adds the HTML <input> accept Attribute in form widgets and Freemaker templates (OFBIZ-12049)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch release18.12 updated: Improved: Adds the HTML <input> accept Attribute in form widgets and Freemaker templates (OFBIZ-12049)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release18.12 by this push:
     new c95a6db  Improved: Adds the HTML <input> accept Attribute in form widgets and Freemaker templates (OFBIZ-12049)
c95a6db is described below

commit c95a6dbe8d72b395fd5267c98fbc357ed762ad38
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Mon Dec 7 15:08:55 2020 +0100

    Improved: Adds the HTML <input> accept Attribute in form widgets and Freemaker templates (OFBIZ-12049)
   
    As explained at
    https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
    this is only an help for the users (ie not a security feature), but an
    appreciable one easy to implement.
   
    Here we start with website/WebSiteCMSContent.ftl
    Also add some missing file extensions
---
 .../content/template/website/WebSiteCMSContent.ftl    | 19 +++++++++++++++----
 applications/datamodel/data/seed/ContentSeedData.xml  |  5 +++++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/applications/content/template/website/WebSiteCMSContent.ftl b/applications/content/template/website/WebSiteCMSContent.ftl
index 67b3df9..7a81a5c 100644
--- a/applications/content/template/website/WebSiteCMSContent.ftl
+++ b/applications/content/template/website/WebSiteCMSContent.ftl
@@ -333,7 +333,18 @@
               <td class="label">${uiLabelMap.CommonUpload}</td>
               <td>
                 <input type="hidden" name="isUploadObject" value="Y"/>
-                <input type="file" name="uploadedFile" size="30"/>
+                <#if dataResourceTypeId == 'IMAGE_OBJECT'>
+                    <input type="file" name="uploadedFile" size="30" accept=".png,.gif,.jpg,.jpeg,.tiff,.tif"/>
+                </#if>
+                <#if dataResourceTypeId == 'VIDEO_OBJECT'>
+                    <input type="file" name="uploadedFile" size="30" accept=".mpeg,.mpg,.mp4,.m4v,.mov,.qt,.asf,.avi,.asx,.asf,.flv,.wvx,.wm,.wmv,.wmx,.avi"/>
+                </#if>
+                <#if dataResourceTypeId == 'AUDIO_OBJECT'>
+                    <input type="file" name="uploadedFile" size="30" accept=".mp3,.ogg,.vorbis,.flac,.wav"/>
+                </#if>
+                <#if dataResourceTypeId == 'OTHER_OBJECT' || dataResourceTypeId == 'LOCAL_FILE' || dataResourceTypeId == 'OFBIZ_FILE' >
+                    <input type="file" name="uploadedFile" size="30"/>
+                </#if>
               </td>
             </tr>
           <#elseif (dataResourceTypeId == 'URL_RESOURCE')>
@@ -354,9 +365,9 @@
             <tr>
               <td colspan="2">
                 <div id="editorcontainer" class="nocolumns">
-                    <textarea name="textData" id="cmseditor" style="margin: 0; width: 100%; border: 1px solid black;">                    
+                    <textarea name="textData" id="cmseditor" style="margin: 0; width: 100%; border: 1px solid black;">
                         <#if (dataText?has_content)>
-                          ${StringUtil.wrapString(dataText.textData!)}
+                          ${StringUtil.wrapString(dataText.textData!)}
                         </#if>
                     </textarea>
                 </div>
@@ -370,4 +381,4 @@
           </tr>
         </table>
     </form>
-</#if>
\ No newline at end of file
+</#if>
diff --git a/applications/datamodel/data/seed/ContentSeedData.xml b/applications/datamodel/data/seed/ContentSeedData.xml
index 54472c1..aae7cb3 100644
--- a/applications/datamodel/data/seed/ContentSeedData.xml
+++ b/applications/datamodel/data/seed/ContentSeedData.xml
@@ -509,8 +509,13 @@ under the License.
     <FileExtension fileExtensionId="vcf" mimeTypeId="text/x-vcard"/>
     <FileExtension fileExtensionId="wav" mimeTypeId="audio/wav"/>
     <FileExtension fileExtensionId="mpeg" mimeTypeId="audio/mpeg"/>
+    <FileExtension fileExtensionId="mp3" mimeTypeId="audio/mpeg"/>
+    <FileExtension fileExtensionId="mp4" mimeTypeId="audio/mpeg"/>
     <FileExtension fileExtensionId="ogg" mimeTypeId="audio/ogg"/>
+    <FileExtension fileExtensionId="flac" mimeTypeId="audio/flac"/>
+    <FileExtension fileExtensionId="vorbis" mimeTypeId="audio/ogg"/>
     <FileExtension fileExtensionId="dflt" mimeTypeId="application/octet-stream"/>
+    <FileExtension fileExtensionId="3gp" mimeTypeId="video/3gpp"/>
     
 
     <!-- Registered MIME Types: