[opencms-dev] XmlContent & Mapping on "Assign categories", howto

Sandrine Prousteau s.prousteau at eurelis.com
Tue Oct 9 15:04:49 CEST 2012


Thanks for your reply.

I already know that I can map the values to some properties, but this is not what I expect. I'd like to use Right Click context menu Assign categories, which works with the org.opencms.relations.CmsCategoryService.



Sandrine.



De : opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] De la part de Paul-Inge Flakstad
Envoyé : lundi 8 octobre 2012 18:08
À : The OpenCms mailing list
Objet : Re: [opencms-dev] XmlContent & Mapping on "Assign categories", howto

Hi Sandrine,

Not quite sure what you're asking, but to enable assignment of categories when editing the structured content, you need to do something like this in your XSD:
1. Define the category element, e.g.: <xsd:element name="Category" type="OpenCmsString" minOccurs="0" maxOccurs="20" />
2. Define the layout, e.g.: <layout element="Category" widget="CategoryWidget" configuration="onlyleafs=true|property=category" />
3. Define the mapping, e.g. <mapping element="Category" mapto="propertyList:collector.categories" />

The mapping is especially important. I've never tested it myself, but you should be able to place the category selector in a nested element. However, I don't think you can have one category selector in one element, and then another category selector in another element and expect that to work. (It would probably appear to work, but I don't think the mapping would survive like you'd want.)

Hope this was of some help to you.

Cheers,
Paul

From: opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org> [mailto:opencms-dev-bounces at opencms.org]<mailto:[mailto:opencms-dev-bounces at opencms.org]> On Behalf Of Sandrine Prousteau
Sent: 4. oktober 2012 12:08
To: The OpenCms mailing list
Subject: [opencms-dev] XmlContent & Mapping on "Assign categories", howto

Hi all !

I have a question about category fields on xmlcontent.
I know that, with a VfsFile field with CategoryWidget directly in my type xsd, this field content is mapped on categories stored when we do "Assign category" in context menu.
I'd like to use a similar category field which is in a nested XSD in this type XSD, like the Xpath /ID/Category, for mapping this value.
Can I do that and how?

Thanks in advance.

(I'm on OpenCms 8.0.4 / 8.5.0)

Sandrine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20121009/b4f79d2b/attachment.htm>


More information about the opencms-dev mailing list