Richard Frovarp wrote:
Fülöp Levente-Balázs wrote:
Hi all,
I'm working on a project based on Lenya 2.0.2.
I deployed it in the lenya-2.0.2 context path.
When I try to insert an image using BXE editor, in the "Insert Image" popup the previews for the images are missing. Looking in the generated HTML source, the <img> tag src shows the context path doubled, and this is the reason why the previews are not displayed. Taking a deeper look, it seems, that o.a.c.e.InsertAsset class creates an 'asset2proxyUrl' map, where the assets URL are put as value, but, these URLs contains the context-path. Now, the .jx file use these URLs as the src for the <img> tag. And, the context path gets duplicated, because the pipeline from usecase.xmap use the "proxy" transformer at the end.

My question is: how can be solved this problem?

Thanks in advance,
Levi


You may need to set the proxy information so that the transformer creates the proper URL. I'm guessing you'll need to change the publication proxy URLs to show the proper values. Although it should just work if you're running from Tomcat or Jetty.

I think we may need more details. What is the URL of lenya, and what is the URL showing up in the img tags?

Richard

Sorry for the late answer. Here is some more details:
- I use a plain Tomcat, so I think it should work without any proxy configuration; - Lenya is deployed under the 'lenya-2.0.2' context path, so I access Lenya with the following URL: http://localhost:8080/lenya-2.0.2/ - When I open the 'insert image' popup from BXE editor, looking in the generated page source from the browser I can see the following:

<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>Insert Image</title>
<link title="default css" href="/lenya-2.0.2/lenya/css/default.css 
<view-source:http://localhost:8080/lenya-2.0.2/lenya/css/default.css>" type="text/css" 
rel="stylesheet" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="/lenya/css/ie6hacksonly.css" 
/><![endif]-->
<link type="image/ico" href="/lenya-2.0.2/favicon.ico 
<view-source:http://localhost:8080/lenya-2.0.2/favicon.ico>" rel="icon" />
<meta content="application/xhtml+xml; charset=UTF-8" http-equiv="Content-Type" 
/>
<script type="text/javascript" 
src="/lenya-2.0.2/modules/editors/javascript/org.apache.lenya.editors.js 
<view-source:http://localhost:8080/lenya-2.0.2/modules/editors/javascript/org.apache.lenya.editors.js>">
 </script>
<script type="text/javascript" src="/lenya-2.0.2/modules/editors/javascript/insertAsset.js 
<view-source:http://localhost:8080/lenya-2.0.2/modules/editors/javascript/insertAsset.js>"> 
</script>
...
...
       <div class="lenya-box-title">Available images</div>
       <div class="lenya-box-body"><div class="lenya-box-content">
         <table class="lenya-table-list" style="border: none">
           <tr>
             <th style="background: none;" />
             <th style="background: none;">File</th>
             <th style="background: none;">Preview</th>
             <th style="background: none;">Title</th>
             <th style="background: none;">Size</th>
             <th style="background: none;">W x H</th>
             <th style="background: none;">created</th>
           </tr>
               <tr>
                 <td>
<input type="radio" name="asset" value="/html/flower1" onClick="updateData('/lenya-2.0.2/test1/authoring/html/flower1_de.jpg','Flower 1','400','600','image/jpeg')" /> </td>
                 <td>/html/flower1</td>
                 <td style="width: 50px; overflow: hidden;">
<img src="/lenya-2.0.2/lenya-2.0.2/test1/authoring/html/flower1_de.jpg?lenya.module=svg&amp;height=32&amp;width=48 <view-source:http://localhost:8080/lenya-2.0.2/lenya-2.0.2/test1/authoring/html/flower1_de.jpg?lenya.module=svg&height=32&width=48>" style="height: 32px; vertical-align: middle; margin: 3px 0px;" /> </td>
                 <td>Flower 1</td>
                 <td align="right" style="white-space: nowrap;">281.366 kB</td>
                 <td align="right" style="white-space: nowrap;">600 x 400</td>
                 <td align="right" style="white-space: nowrap;">Sep 17, 
2009</td>
               </tr>
...
...

As you can see, the URLs to CSS and JavaScript contains the correct context path and also the 
'updateData' javascript has the correct URL, but the img tag that should display the preview 
for the image has the context path doubled: 
/lenya-2.0.2/lenya-2.0.2/test1/authoring/html/flower1_de.jpg 
<view-source:http://localhost:8080/lenya-2.0.2/lenya-2.0.2/test1/authoring/html/flower1_de.jpg?lenya.module=svg&height=32&width=48>
...

Digging into the insertAsset.jx from the editors module, I see that there is variable <jx:set 
var="url" value="${asset2url.get(asset)}"/> that is used as the first parameter in 
the 'updateData' javascript function and in the src attribute of the img tag.
But, the 'url' variable already contains the 'lenya-2.0.2' context path. So, when the pipeline execution hits the 'proxy' transformer, the context path will be put at the beginning of the src attribute from the img tag doubling the context path, so the image can't be found anymore ...

How can be avoided to double the context path for the preview image?

Thanks in advance,
Levi







---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to