[opencms-dev] external links in OpenCmsVfsFile

Paul-Inge Flakstad flakstad at npolar.no
Mon Apr 5 13:41:11 CEST 2010


Hi Gleb

OpenCmsVfsFile accepts only relative paths to files that exist on your OpenCms system, and you cannot disable the existence check, as far as I know. You can however use an OpenCmsVfsFile field to refer to an external file by pointing to a VFS file of type "pointer" (called "External link" in the "New" dialog). A file of type "pointer" is simply a file that holds a reference to any URL, and if you access the pointer, you will be redirected to that URL. I would suggest using this approach if you're mostly pointing to local files, and rarely external files.

If you're often pointing to external files, then you probably want to convert the OpenCmsVfsFile field to an OpenCmsString field. For getting this job done while preserving your data, my best suggestion would be to write a custom JSP that modifies your xmlcontent files. (You will of course have to change your XSD file(s) as well, but that part should be quite straight-forward.)

Note: the administration panel has a tool under "Content tools" called "Repair XML content", which will repair xmlcontent files according to their XSD file(s). Unfortunately it cannot be used in your case, as all your data for that field would be lost. (You could have used it if you were converting the opposite way though, changing an OpenCmsString field into an OpenCmsVfsFile field.)

Best regards,
Paul

________________________________
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of gleb makarov
Sent: 5. april 2010 12:46
To: opencms-dev at opencms.org
Subject: [opencms-dev] external links in OpenCmsVfsFile

Hello everyone,

I have a problem with external links in xmlcontent. There is an  OpenCmsVfsFile  field type in xmlcontent files. It`s description in the xml scheme is <xsd:element name="Image" type="OpenCmsVfsFile" /> When I try to enter there a file name (path to file) form the different domain name (http://servername/..),  system shows an error 'Invalid reference, the resource can not be found'.

I`d like to know if there is a way to update this scheme and change the field type without data loss (for example change VfsFile to String).

Or is it possible to disable verification of the OpenCmsVfsFile field type when saving xmlcontent file?

I can`t update all xml schemes and templates manually because of their huge amount.

Thank you in advance.

--
Best regards,
Gleb Makarov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20100405/b14872fd/attachment.htm>


More information about the opencms-dev mailing list