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 2021/09/21 15:47:21 UTC

[ofbiz-plugins] branch trunk updated: 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 trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


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

commit 48156518c902ac285411fbf8a86b43bc052a6f91
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Tue Sep 21 17:47:20 2021 +0200

    Improved: Adds the HTML <input> accept Attribute in form widgets and Freemaker templates (OFBIZ-12049)
    
    Removes unused OOTB TextImage.ftl
    Explain the script in ViewProfile.ftl
    "Accepts" CSV files in SamplePricat.ftl
---
 ecommerce/template/blog/TextImage.ftl       | 135 ----------------------------
 ecommerce/template/customer/ViewProfile.ftl |   2 +-
 pricat/template/pricatdemo/SamplePricat.ftl |   2 +-
 3 files changed, 2 insertions(+), 137 deletions(-)

diff --git a/ecommerce/template/blog/TextImage.ftl b/ecommerce/template/blog/TextImage.ftl
deleted file mode 100644
index 926f87d..0000000
--- a/ecommerce/template/blog/TextImage.ftl
+++ /dev/null
@@ -1,135 +0,0 @@
-<#--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
-  -->
-
-<#--
-# This page displays both the textarea for text and the file upload control.
-# It was awkward to do it with screen widgets because need to show checkboxes
-# by each control.
--->
-
-<#-- This code sets the checkboxes based on existing data -->
-<#assign text_check=""/>
-<#assign img_check=""/>
-<#if (imageContent?has_content && ("SCREEN_COMBINED" == drDataTemplateTypeId?default(""))
-    || drMimeTypeId?default("")?starts_with("image"))>
-  <#assign img_check="checked='checked'"/>
-</#if>
-<#if (textContent?has_content && drMimeTypeId?default("")?starts_with("text"))
-    || (textContent?has_content && ("SCREEN_COMBINED" == drDataTemplateTypeId?default("")))
-    || !img_check?has_content>
-  <#assign text_check="checked='checked'"/>
-</#if>
-
-<#-- Sets one of the two templates -->
-<#assign topleft_check=""/>
-<#assign topcenter_check=""/>
-<#if view.drDataResourceId?has_content && "BLOG_TPL_TOPLEFT" == view.drDataResourceId>
-  <#assign topleft_check="checked='checked'"/>
-<#else>
-  <#assign topcenter_check="checked='checked'"/>
-</#if>
-
-<#-- Fills in existing text -->
-<#assign textData=""/>
-<#if electronicText?has_content >
-  <#if electronicText.textData?has_content >
-    <#assign textData=electronicText.textData/>
-  </#if>
-</#if>
-
-<#-- Stores the ids for existing data -->
-<#assign textContentId=""/>
-<#assign textDataResourceId=""/>
-
-<#if textContent?has_content >
-  <#assign textContentId=textContent.contentId!/>
-  <#assign textDataResourceId=textContent.drDataResourceId!/>
-</#if>
-
-<#if textElectronicText?has_content && textElectronicText.textData?has_content >
-  <#assign textData=textElectronicText.textData/>
-</#if>
-
-<#assign imageContentId=""/>
-<#assign imageDataResourceId=""/>
-
-<#if imageContent?has_content >
-  <#assign imageContentId=imageContent.contentId!/>
-  <#assign imageDataResourceId=imageContent.drDataResourceId!/>
-</#if>
-
-<input type="hidden" name="textContentId" value="${textContentId}"/>
-<input type="hidden" name="imageContentId" value="${imageContentId}"/>
-<input type="hidden" name="textDataResourceId" value="${textDataResourceId}"/>
-<input type="hidden" name="imageDataResourceId" value="${imageDataResourceId}"/>
-
-<table>
-  <tr>
-    <td width="10%" align="right">
-      <span class="treeHeader"> </span>
-    </td>
-    <td>&nbsp;</td>
-    <td width="5%" valign="top">
-      <div class="inputBox">
-        <input type="checkBox" ${text_check} name="drMimeTypeId_TEXT" value="Y"/>
-        Text
-      </div>
-    </td>
-    <td>&nbsp;</td>
-    <td width="60%">
-      <textarea class="textAreaBox" class="inputBox" name="textData" cols="60" rows="24">
-        ${textData!}
-      </textarea>
-    </td>
-    <td width="10%" align="right">
-      <span class="treeHeader"> </span>
-    </td>
-  </tr>
-  <tr>
-    <td width="10%" align="right">
-      <span class="treeHeader"> </span>
-    </td>
-    <td>&nbsp;</td>
-    <td width="5%" valign="top">
-      <div class="inputBox"><input type="checkbox" ${img_check} name="drMimeTypeId_IMAGE" value="Y"/>
-        Image
-      </div>
-    </td>
-    <td>&nbsp;</td>
-    <td width="60%">
-      <div class="inputBox">
-        Existing file name:
-        <#if imageContent?has_content && imageContent.drObjectInfo?has_content>
-          ${imageContent.drObjectInfo}
-        </#if>
-      </div>
-      <br />
-      <input type="file" class="inputBox" name="uploadedFile" size="25"/>
-      <#--
-      Force: <input type="checkbox" value="true" name="forceElectronicText"/>
-      -->
-      <br />
-      Top-left:<input type="radio" ${topleft_check} class="inputBox" name="templateId" value="BLOG_TPL_TOPLEFT"/>&nbsp;
-      Top-center:<input type="radio" ${topcenter_check} class="inputBox" name="templateId" value="BLOG_TPL_TOPCENTER"/>
-    </td>
-    <td width="10%" align="right">
-      <span class="treeHeader">&nbsp;</span>
-    </td>
-  </tr>
-</table>
diff --git a/ecommerce/template/customer/ViewProfile.ftl b/ecommerce/template/customer/ViewProfile.ftl
index d2ced6e..2e4b3c9 100644
--- a/ecommerce/template/customer/ViewProfile.ftl
+++ b/ecommerce/template/customer/ViewProfile.ftl
@@ -470,7 +470,7 @@ under the License.
           <label class="custom-file-label" for="customFile">Choose file</label>
           <div class="invalid-feedback">Example invalid custom file feedback</div>
         </div>
-        <script>
+        <script> <#-- This is to replace the "Choose a file" label by the real file name -->
             $('#customFile').on('change',function(){
                 //get the file name
                 var fileName = $(this).val();
diff --git a/pricat/template/pricatdemo/SamplePricat.ftl b/pricat/template/pricatdemo/SamplePricat.ftl
index 108cc53..5530fed 100644
--- a/pricat/template/pricatdemo/SamplePricat.ftl
+++ b/pricat/template/pricatdemo/SamplePricat.ftl
@@ -26,7 +26,7 @@ under the License.
   <div class="screenlet-body">
   <form method="post" enctype="multipart/form-data" action="<@o...@ofbizUrl>">
     <input type="hidden" name="action" value="store_excel" />
-    <input type="file" size="60" name="filename"/><br />
+    <input type="file" size="60" name="filename" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"/>
     ${uiLabelMap.ExcelTemplateType}:
     <select name="excelTemplateType" id="excelTemplateType">
       <option value="sample_pricat" checked>${uiLabelMap.SamplePricatType}</option>