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-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d33601cfda Fixed: Content tag in a screen does not display correctly 
images (OFBIZ-12685)
d33601cfda is described below

commit d33601cfda8322956bdac8d0630d6fb57c9fab4f
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Sun Aug 28 17:57:56 2022 +0200

    Fixed: Content tag in a screen does not display correctly images 
(OFBIZ-12685)
    
    When we want to display an image content within a screen through <content/> 
tag,
    images are not rendered correctly
    To test:
    Go to admin party profile page and upload a picture file as a new 
"LGOIMGURL"
    for instance: 
https://localhost:8443/partymgr/control/viewprofile?partyId=admin
    
    When your content file is uploaded, note the contentId and got to page
    ShowContent (which render content using the tag <content />)
    https://localhost:8443/content/control/showContent?contentId=XXXXX
    The image will not be rendered without the given patch.
    
    jleroux: since it's eventually negated, it makes no sense to test if the
    content is either an image or an application. It can't be both. This is a 
very
    old feature (pre-apache era) that seems to have never been tested/used
    I have made a formatting change and added a comment to explain.
    
    Thanks: Leila Mekika
---
 .../main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java
 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java
index b2982356d1..fd38ba1c26 100644
--- 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java
+++ 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java
@@ -1468,8 +1468,8 @@ public abstract class ModelScreenWidget extends 
ModelWidget {
                     mimeTypeId = content.getString("mimeTypeId");
                 }
 
-                if (!(mimeTypeId != null
-                        && ((mimeTypeId.indexOf("application") >= 0) || 
(mimeTypeId.indexOf("image")) >= 0))) {
+                // This is to render an image only, not an application document
+                if (!(mimeTypeId != null && mimeTypeId.indexOf("application") 
>= 0)) {
                     screenStringRenderer.renderContentBegin(writer, context, 
this);
                     screenStringRenderer.renderContentBody(writer, context, 
this);
                     screenStringRenderer.renderContentEnd(writer, context, 
this);

Reply via email to