[jira] [Commented] (OFBIZ-7000) You cannot edit an image in content

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

[jira] [Commented] (OFBIZ-7000) You cannot edit an image in content

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-7000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15295547#comment-15295547 ]

Jacques Le Roux commented on OFBIZ-7000:
----------------------------------------

I tried the patch, I now get this error when I click on the \[Edit\] button
{code}
     [java] 2016-05-22 13:56:36,255 |http-nio-8443-exec-3 |runtime                       |E| Error executing FreeMarker template
     [java] freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
     [java] ==> contentId  [in template "component://content/template/mime-type/Image.ftl" at line 19, column 79]
     [java]
     [java] ----
     [java] Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>
when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
     [java] ----
     [java]
     [java] ----
     [java] FTL stack trace ("~" means nesting-related):
     [java]     - Failed at: ${contentId}  [in template "component://content/template/mime-type/Image.ftl" at line 19, column 77]
     [java]     - Reached through: @ofbizUrl secure="${request.isSecure(...  [in template "component://content/template/mime-type/Image.ftl" at line 19, column 11]
     [java] ----
     [java]     at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) ~[freemarker-2.3.24.jar:2.3.24]
{code}

I thought a trick could be to use this patch
{code}
Index: applications/content/template/mime-type/Image.ftl
===================================================================
--- applications/content/template/mime-type/Image.ftl (revision 1745030)
+++ applications/content/template/mime-type/Image.ftl (working copy)
@@ -16,4 +16,8 @@
   specific language governing permissions and limitations
   under the License.
   -->
-<img src="<@ofbizUrl secure="${request.isSecure()?string}">stream?contentId=${contentId}</@ofbizUrl>"/>
\ No newline at end of file
+<#if contentId??>
+    <img src="<@ofbizUrl secure="${request.isSecure()?string}">/content/control/stream?contentId=${contentId}</@ofbizUrl>"/>
+<#else>
+    This image cannot be rendered! Try to change the image file path.
+</#if>
\ No newline at end of file
{code}
But it would only prevent the error and will not solve the problem, because when you then try to use another file by changing the file patch from
/applications/content/webapp/content/images/nocontentfound.png
to eg
/applications/content/webapp/content/images/Presse-papiers-1.png

you then get this error
{code}
     [java] java.lang.Exception: Error in simple-method [Update Electronic Text [file:/C:/projectASF-Mars/ofbiz/applications/content/script/org/ofbiz/content/data/DataServices.xml#updateElectronicText]]: Erro
r running the simple-method: Entity value not found with name: lookedUpValue Method = updateElectronicText, File = file:/C:/projectASF-Mars/ofbiz/applications/content/script/org/ofbiz/content/data/DataService
s.xml, Element = <set-nonpk-fields>, Line 309null
     [java]     at org.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(TransactionUtil.java:360) [ofbiz-entity.jar:?]
{code}
I also noticed that the Mime type is {code}image&#x2f;png{code} should it not be {code}image&#x2e;png{code} (http://do.remifa.so/archives/unicode/latin1.html) or even rather image.png. Anyway I gave up at this stage finally wondering if changing the "nocontentfound.png" file makes any sense OOTB (of course we then let the problem to custom project :/)

> You cannot edit an image in content
> -----------------------------------
>
>                 Key: OFBIZ-7000
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-7000
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Release Branch 12.04, Release Branch 13.07, Release Branch 14.12, Trunk, Release Branch 15.12
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: OFBIZ-7000.patch
>
>
> If you get to
> {code}
> content/control/EditLayout?drDataResourceId=NOCONTENTFOUND&contentId=NOCONTENTFOUND
> {code}
> When trying to editing you get an error
> {code}
> 2016-04-11 10:48:42,932 |http-bio-8443-exec-9 |ScreenFactory                 |I| Got 9 screens in 0.004s from: file:/C:/projectASF-Mars/ofbiz/applications/content/widget/layout/LayoutScreens.xml
> 2016-04-11 10:48:43,051 |http-bio-8443-exec-9 |ScriptUtil                    |W| Error running script at location [component://content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy]: org.ofbiz.b
> ase.util.GeneralException: The desired mime-type is not a text type, cannot render as text: image/png
> org.ofbiz.base.util.GeneralException: The desired mime-type is not a text type, cannot render as text: image/png
>         at org.ofbiz.content.data.DataResourceWorker.renderDataResourceAsText(DataResourceWorker.java:624) ~[ofbiz-content.jar:?]
>         at org.ofbiz.content.data.DataResourceWorker.renderDataResourceAsText(DataResourceWorker.java:603) ~[ofbiz-content.jar:?]
>         at org.ofbiz.content.data.DataResourceWorker$renderDataResourceAsText.call(Unknown Source) ~[?:?]
>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-all-2.4.5.jar:2.4.5]
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[groovy-all-2.4.5.jar:2.4.5]
>         at EditSubContent.run(EditSubContent.groovy:50) ~[?:?]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)