[opencms-dev] Creating categories from API and select them in CategoryWidget

Mario Jäger m.jaeger at alkacon.com
Wed Nov 24 10:05:55 CET 2010


Hi,

I have reproduced your scenario. I have created a new category folder using your jsp code. Then, I could select the new category in the category widget in the xml content.

But, I also get the error "No category selected", when I select no category in the other languages in the xml content.

That is why, check the category choice in the other languages in the xml content, please.

-- 
Kind Regards,
Mario.

-------------------
Mario Jäger

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org


Am 22.11.2010 16:07, schrieb Sandrine Prousteau:
> Hi all,
>
> I've got a problem creating categories with API.
>
> I want to create categories folders with java in jsp'code, with this :
>
> String uri = "/_categories/onetheme/mycategory/";
> if(!cmsAdmin.existsResource(uri,CmsResourceFilter.DEFAULT_FOLDERS)){
> CmsResource folder = cmsAdmin.createResource(uri,0);
> cmsAdmin.lockResource(uri);
> cmsAdmin.writeResource(folder);
> cmsAdmin.writePropertyObject(uri, new CmsProperty("Title", mytitle,
> null));
> }
>
> The folder is created to /sites/default/_categories/onetheme/
> mycategory/ with his title. Good.
>
> I have a custom xmlcontent, with CategoryWidget fields pointing to the
> category themes, with xsd like this :
>
> <xsd:element name="OneThemeCategory" type="OpenCmsString"
> minOccurs="0"/>
> ...
> <layout element=" OneThemeCategory " widget="CategoryWidget" />
>
> If I don't have creating category folders under the themes (the themes
> are empty), I can select category themes in my xmlcontent. If I have
> created category folder under themes, with or without publishing them, I
> can't select themes categories anymore: The list of themes categories
> appear, but when I select one, it says I've selected nothing and don't
> want to register...
>
> I don't understand.
> Please help!
>
> _______________________________________________
> 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/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list