[opencms-dev] Allow links to non-existing resources

Paul-Inge Flakstad flakstad at npolar.no
Fri Dec 2 14:44:28 CET 2016


Hi Lorenz,

This would work great sometimes. But what about elements that should also allow links to regular, existing VFS resources? For those, I'd really like to use OpenCmsVfsFile / OpenCmsVarLink, so that the VFS browser widget and link checking is enabled. (And by "link checking" I mean when publishing/deleting - not when editing.)

Also, there's the issue of links in the text: Can I rely on the editor to not strip away links to internal resources that do not exist?

Anyway, I really appreciate your input! I actually hadn't considered the approach you're suggesting here ;)

My idea was to link to e.g. "/en/people/lookup?id=jane.doe" => "lookup" would be a JSP that issues a 301 redirect to "/en/people/jane.doe/". This should work - but all existing URIs in OpenCmsVfsFile/OpenCmsVarLink element fields would have to be changed (I think).

Thanks,
Paul

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Lorenz Lammersdorf
Sent: 2. desember 2016 11:02
To: The OpenCms mailing list <opencms-dev at opencms.org>
Subject: Re: [opencms-dev] Allow links to non-existing resources


maybe i've misunderstood your approach, but why do you need links? i'd build a xml scheme linke this:



<xsd:element name="externalResourceLanguage" type="OpenCmsString" />

<xsd:element name="externalResourcePool" type="OpenCmsString" />

<xsd:element name="externalResourceIdentifier" type="OpenCmsString" />



<layout element="externalResourceLanguage" widget="SelectorWidget" configuration="en | klyngon | l33t | whatever" />

<layout element="externalResourcePool" widget="SelectorWidget" configuration="people | dogs | cats | penguins" />



and based on this i'd "manufacture" the link in the template. of course it's a little more work for your editors, but you get rid of the whole dummy folders and files.

________________________________
Von: opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org> <opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org>> im Auftrag von Paul-Inge Flakstad <flakstad at npolar.no<mailto:flakstad at npolar.no>>
Gesendet: Freitag, 2. Dezember 2016 10:40:21
An: The OpenCms mailing list
Betreff: [opencms-dev] Allow links to non-existing resources

Hi all,

Our OpenCms site integrates some externally stored content - for example, person details (name, email, phone, etc.). I'll use this example to explain.

Each person page has a unique, human-friendly URI, like "/en/people/jane.doe/".

Up until now, we've employed one dummy folder + index file in the VFS for every person. These are just empty resources; all the magic happens in the index file's template, which uses the ID found in the URI (e.g. "jane.doe") to fetch the externally stored content and render the page.

This approach works great with respect to the internal workings of OpenCms, but it's not very efficient. In an attempt to remedy that, I decided to write a resource initializer for requests to stuff inside the "/en/people/" folder. It works great. All our person URIs work - they are in fact unchanged - with only the folder "/en/people/" existing in the VFS.

Finally we can get rid of those unnecessary dummy resources!

...there's just this tiiiny little problem...

Links won't work anymore(!!!). At least not link fields in xmlcontent - imagine f.ex. a dedicated field called "Author" or "Contact person".

Naturally, once all the dummy stuff is gone, adding a link to "/en/people/######" will produce an error. "Invalid reference, the resource can not be found." And it's correct, of course; the ###### resource doesn't exist in the VFS. I'd still like to save the link, though.

Is there a way to circumvent this problem? Or am I forced to handle the issue another way? (I have good ideas on how to, but they would require modifying all existing links - and we have thousands of pages...)

Thanks in advance,
Paul



Lorenz Lammersdorf
Entwickler
+41 58 255 13 06

Aktuell im Blog: Social Media im B2B: Eine grosse Chance für Ihr Unternehmen<http://mensch-marke.info/social-media-b2b-gruende/>

Kernbrand AG
Teufener Strasse 11
9000 St. Gallen
www.kernbrand.ch<https://kernbrand.ch>

Folgen Sie uns: Facebook<http://bit.ly/Kernbrand_Facebook> | Pinterest<http://bit.ly/Kernbrand_Pinterest> | LinkedIn<http://bit.ly/Kernbrand_LinkedIn1> | Twitter<http://bit.ly/Kernbrand_Twitter> | Youtube<http://bit.ly/Kernbrand_Youtube>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20161202/f2890222/attachment.htm>


More information about the opencms-dev mailing list