You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2020/12/07 17:37:36 UTC
[ofbiz-framework] 02/02: Improved: Adds the HTML accept
Attribute in form widgets and Freemaker templates (OFBIZ-12049)
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit e50ad56bb9b4f081b93eebe4fdddd9a5249d3894
Author: Jacques Le Roux <ja...@les7arts.com>
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 d2e1373..a47050d 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 a7ca706..ad3c8c4 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: