[opencms-dev] XmlContent & Mapping on "Assign categories", howto
Paul-Inge Flakstad
flakstad at npolar.no
Wed Oct 10 16:40:28 CEST 2012
Hi again Sandrine,
I'd be happy to help you if I can, but I've read your posts again, and unfortunately I still don't understand exactly what it is you want to do. Nor can I see exactly what your question is.
What I tried to explain is the typical way you'd implement a way to assign categories directly from the XML content editor, using a widget. (I included _additionally_ storing the category references as a property [collector.categories] value.)
This method and the context menu's "Assign categories" are equivalent with regard to the assigning of categories.
They are, however, not _fully_ equivalent:
When using "Assign categories" from the context menu, the property value (the mapping) will be left unmodified, and so will the XML content. And the widget uses the XML content - so any category assigned using the context menu will _not_ appear as an assigned category when you edit the file. (Quite misleading, isn't it? But at least the other way around is more like one would expect: Categories assigned using the widget when editing _does_ appear in the "Assigned categories" list of the "Assign categories" view.)
Best regards,
Paul
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Sandrine Prousteau
Sent: 9. oktober 2012 15:05
To: The OpenCms mailing list
Subject: Re: [opencms-dev] XmlContent & Mapping on "Assign categories", howto
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> [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/20121010/582a5dfd/attachment.htm>
More information about the opencms-dev
mailing list