cancel
Showing results for 
Search instead for 
Did you mean: 

File Attach Problem in XML Forms

Former Member
0 Kudos

Hi,

I have created a project in the XML Forms Builder on EP6 SP2. In my <i>Edit</i> form, I must allow the user to browse and attach two files, one a PDF document and another a PowerPoint file. I am assuming that these files are stored in the KM repository with a path like "/docuemnts/Images/NewsCentral_T2.pdf". In my Project Options dialog box, I have specified the location of the 'Image Path' field as "/documents/Images". Every time I want some input help with the images in this same Form, I get to choose an image from this folder. By the same technique, I have also managed to attach the files.

In my Show Form, I have put two labels for these two files and I display them as links.

But When I try to view the <i>Show</i> Form in the browser and then try to click this link to open the respective document, I get an error message saying that "...this file cannot be displayed...". This does not happen with the images, and these are properly rendered (I have used an XFImage control for that...).

It seems that there is a problem with the URL that is generated when I click the link. For the images, the link after concatenation of the Image Path and the Image Name is something like "/documents/Images/logo.gif". However, on rendering in the Browser window, this URL gets coverted to "http://ep6:50000/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/Images/logo.gif"...

In case of the file, when I click the link and try to open the document in a new browser window, the URL gets converted to

"http://ep6:50000/documents/Images/NewsCentral_T2.pdf"...this should actually be

"http://ep6:50000/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/Images/NewsCentral_T2.pdf".

I want to achieve this URL regeneration for viewing my files. If anyone has any ideas or suggestions on this, please let me know.

Thanks and Regards,

Sagar.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

don't worry it very easy, first dowload from etc/xmlforms/<proyectname> the form you use to view the files (<proyectname>RenderListItem.xsl or <proyectname>Show.xsl)

then edit the one you are using to show the files,

you will something like this

<!--

read only field with reference to element Campo15<i><b>(the name of the label you have asigned to your field, for the file browser)</b></i>

-->

<p align="left">

<xsl:if test="Link15=''">

<xsl:value-of select="Campo15" disable-output-escaping="yes"/>

</xsl:if>

<xsl:if test="Link15!=''">

<a class="a2">

<xsl:attribute name="href">

<xsl:choose>

<xsl:when test="starts-with(Link15, 'imagepath/')">

<xsl:value-of select="$imagepath"/>/<xsl:value-of select="substring-after(Link15, 'imagepath/')"/>

</xsl:when>

<xsl:when test="starts-with(Link15, '$imagepath/')">

<xsl:value-of select="$imagepath"/>/<xsl:value-of select="substring-after(Link15, '$imagepath/')"/>

</xsl:when>

<xsl:when test="starts-with(Link15, '%imagepath%/')">/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/pip_libra/Documentacion/documentos/images/<xsl:value-of select="substring-after(Link15, '%imagepath%/')"/>

</xsl:when>

<xsl:when test="starts-with(Link15, '%projectimagepath%/')">/documents/Heineken/documentos/<xsl:value-of select="substring-after(Link15, '%projectimagepath%/')"/>

</xsl:when>

<xsl:when test="starts-with(Link15, 'http')">javascript:open_url_in_window('<xsl:value-of select="Link15"/>')

</xsl:when>

<xsl:otherwise>javascript:open_url_in_window('<b>/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs</b><i>(thats the line you have to add to diplay the document)</i><xsl:value-of select="Link15"/>')</xsl:otherwise>

</xsl:choose>

</xsl:attribute>

<xsl:value-of select="Campo15" disable-output-escaping="yes"/>

</a>

</xsl:if>

</p>

</td>

<xsl:choose/>

</tr>

</table>

then when you click on the link it would open the correct url http://ep6:50000/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/Images/NewsCentral_T2.p....

adrian vindel

realtech spain