[opencms-dev] OpenCms 8.5.1 - collector timeFrameAndCategories
Paul-Inge Flakstad
flakstad at npolar.no
Mon May 27 15:45:59 CEST 2013
Hi Davide,
If your problem is that you're seeing commas where you should see pipe, I'd check if something's been altered on the OpenCms install.
When assigning categories using the category widget provided with OpenCms (CategoryWidget), the root path of each category should be stored as a separate element in the content XML.
Example (content XML, or "control code"):
<Category><![CDATA[/sites/default/_categories/color/red/]]></Category>
<Category><![CDATA[/sites/default/_categories/temperature/hot/]]></Category>
<Category><![CDATA[/sites/default/_categories/taste/spicy/]]></Category>
If the element is property-mapped as propertyList (e.g. with <mapping element="Category" mapto="propertyList:collector.categories" />), the property value will be a single string consisting of each category's root path, separated by the pipe character.
Example (property value):
/sites/default/_categories/color/red/|/sites/default/_categories/temperature/hot/|/sites/default/_categories/taste/spicy/
(From the lines of code you're referring to, it's evident that the constant CmsProperty.VALUE_LIST_DELIMITER is used to separate multiple values. This constant is by default the pipe character.)
CmsXmlContent.getValues(String, Locale) should always return a list of I_CmsXmlContentValue objects, or just an empty list. This is true even when there's just 1 category, or none at all. You shouldn't be getting a single, comma-separated string in return from that method.
I ran a test just now on my OpenCms 8.5.1 install, and encountered no issues. You'll find my test JSP attached.
PS: Note that categories assigned using the context menu's [Relations]-->[Assign categories] are "invisible" elsewhere. You will not see these categories in the properties or when editing using the CategoryWidget. (This is because they are not hooked up to any element of your content, and not mapped to any property.) These categories must be read using the API - see for example CmsCategoryService.readResourceCategories(CmsObject, String).
HTH.
Best regards,
Paul
-----Original Message-----
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Cavva
Sent: 27. mai 2013 11:54
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] OpenCms 8.5.1 - collector timeFrameAndCategories
Hi all,
I've found the problem.
CategoryWidget does not write link in different category element, but in such way:
The CmsXmlContent.getValues give just 1 value with already joined elements by a comma also if I select propertyList.
If you want to see the code is here, starting from line 1189 of org.opencms.xml.content.CmsDefaultXmlContentHandler class
content.getValues(path, locale) does not return any list of I_CmsXmlContentValue but just one.
To solve I made another Collector with this patch
Of course I did not need just that patch, but sorting by a property not the released date.
In my point of view this is a bug because CategoryWidget is a list of properties and must be separated by pipe.
Thank you all
Davide
--
View this message in context: http://opencms.996256.n3.nabble.com/OpenCms-8-5-1-collector-timeFrameAndCategories-tp23303p23309.html
Sent from the OpenCMS mailing list archive at Nabble.com.
_______________________________________________
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: script-list-categories.jsp
Type: application/octet-stream
Size: 3214 bytes
Desc: script-list-categories.jsp
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130527/9ade7b02/attachment.obj>
More information about the opencms-dev
mailing list