[opencms-dev] Locale macro in XSD schema

Paul-Inge Flakstad flakstad at npolar.no
Mon Feb 18 15:23:07 CET 2013


Hi again,

Forgot to say so but yes, our category widget does work just the way I assume you would like it to. When editing a page in a specific language, categories in the widget drop-down are also displayed in that language.

I'd recommend testing this approach and see if it will work for you. It's way more simple than writing a custom widget.

Best regards,
Paul

-----Original Message-----
From: Paul-Inge Flakstad 
Sent: 18. februar 2013 12:39
To: 'Arturo Martín Lladó'
Subject: RE: [opencms-dev] Locale macro in XSD schema

Hi again Arturo,

I'll stick with the example I provided - a list of news articles with category filters.

In the news article's XSD, the category element has this configuration:
<layout element="Category" widget="CategoryWidget" configuration="onlyleafs=true|property=category" />

By setting a value for the "category" property on a VFS resource (typically a parent folder of the appropriate content - in the example case this would be the "news" folder), you can control what categories are available in the category widget when editing news articles.

In the example, the property value would be "theme/" (without quotes).

The value "theme/" is a reference to the (category) folder /sites/default/__LOCALE__/_categories/theme/, which is the parent category of all the categories visible as category filters in the news list. By setting this value, the category widget for news articles will contain only these categories. Other categories will not be available.

You can of course also omit setting any value on the "category" property. In that case, all categories that are available for the path of the resource you're editing will also be available in the category widget.

Hope I was able to explain this, please let me know if anything is still unclear. :)

Cheers,
Paul

-----Original Message-----
From: Arturo Martín Lladó [mailto:arturo.martin.llado at gmail.com]
Sent: 18. februar 2013 12:13
To: The OpenCms mailing list
Cc: Paul-Inge Flakstad
Subject: Re: [opencms-dev] Locale macro in XSD schema

Hi, Paul:

Are you able to offer (with your categories taxonomy) a CategoryWidget dialog using this kind of configuration?

<layout element="CategoryExample" widget="CategoryWidget"
configuration="category=/__LOCALE__/_categories/Example/"/>

Obviously, __LOCALE__ (and with this, the category under the user would search) must change when the user tries to edit the content using another locale.

I believe the problem would be the same, both using /__LOCALE__/_categories/ or /_categories/__LOCALE__ as configuration value.

Regards.

2013/2/18 Paul-Inge Flakstad <flakstad at npolar.no>:
> Hi Arturo,
>
> Sorry I'm not answering your question per se, but I'm just curious; *must* your categories be organized like /sites/default/_categories/__LOCALE__/?
>
> We do have a multi-language site and use categories, but have organized them this way: /sites/default/__LOCALE__/_categories/. To me, this seems to be the most convenient approach.
>
> The downside:
> The categories must be defined separately for each locale. In our case 
> the category folders must have identical names, to enable easy 
> switching between languages. (So in other words, everything should be 
> identical, except for the Title property.)
>
> The upside:
> It works like you want it to (I think). The categories are localized to the correct language both in the widget when editing pages and on the screen when viewing the site.
>
> A live example from our site:
> http://www.npolar.no/en/news/. Category filters to the right. Language switch next to the site search (the flag icon).
>
> Cheers,
> Paul
>
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Arturo Martín 
> Lladó
> Sent: 15. februar 2013 14:27
> To: The OpenCms mailing list
> Subject: [opencms-dev] Locale macro in XSD schema
>
> Hi, list.
>
> Is there available any locale macro for using it in XSD schemas?
>
> I'd like to do something like this:
>
>         <layouts>
>                 [...]
>                 <layout element="Categoria" widget="CategoryWidget"
> configuration="category=/_categories/__LOCALE_MACRO___/tipoDocumento/|onlyleafs=true"/>
>         </layouts>
>
> This is because our categories tree is organized this way:
> /sites/default/_categories/__LOCALE__/...
>
> Kind regards.
>
> --
> Arturo Martín Lladó
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list To change 
> your list options, or to unsubscribe from the list, please visit 
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list To change 
> your list options, or to unsubscribe from the list, please visit 
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>



--
Arturo Martín Lladó



More information about the opencms-dev mailing list