In fact I don't want to create a new container.
The user create it by clicking on the "add button".
Then I want to set by default the category of this new container. 
You do that in the template "document list" with the file doc.inc.
But I don't understand how it's work.

If fact you never call the addChildObjectKey in the template and you never 
check the parent page or something else.
So I thought it was on the eventlistener.

That's why I use the eventlistener. I catch the event but I can't set category 
by this way.

I try use the savecontainer as you said but that not works and then my 
container is domaged and I have to delete the page.

I still searching and I am trying to understand how document details works.

Thanks

Nicolas




-----Message d'origine-----
De : Xavier Lawrence [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 22 juillet 2005 14:56
À : [email protected]
Objet : RE : Automatic category selection

You are right, the container needs to have been saved for it to have a 
corresponding ContentContainer...

To save the container, you have to use the saveContainer method from the 
JahiaContainerService instance.
Then, you load back the container using method loadContainer.

I suggest you check out how I implemented the blogs. Look at classes 
org.jahia.blogs.actions.AbstractAction and 
org.jahia.blogs.actions.NewPostAction. In there, you will find how you can 
create a new container, save it, load it and set its categories.

If you still have troubles, don't hesitate to come back to me...

regards

Xavier


Le 14:12 22.07.2005, vous avez écrit:
>So I miss something.
>
>Yes you can set automatically your category by this way, but, when you try 
>to do that with the eventlistener, you can't because you can't create a 
>contentContainer from "theContainer".
>
>I think this is because "theContainer" ID is 0 (not created at this time) 
>then the relative contentContainer is null.
>
>Do you have any solution?
>
>Thanks
>
>Nicolas
>
>
>-----Message d'origine-----
>De : Xavier Lawrence [mailto:[EMAIL PROTECTED]
>Envoyé : vendredi 22 juillet 2005 09:06
>À : [email protected]
>Objet : Re: Automatic category selection
>
>Hi Nicolas,
>
>Assuming all your categories have been created through the administration
>panel, here is how you progammatically set a category for a container. In
>fact, you add the container's ObjectKey to the category object:
>
>final String categoryKey = "myKey";
>final Category category = Category.getCategory(categoryKey );
>
>if (category != null) {
>          cat.addChildObjectKey(theContainer.
>                           getContentContainer().getObjectKey());
>}
>
>Regards
>
>Xavier
>
>
>
>
>
>Le 18:50 21.07.2005, vous avez écrit:
> >Hi again
> >
> >I try to understand how the "document detail" works and how the
> >containers have automatically the category.
> >In fact I want to set automatically a category to a container but I
> >don't know how to do that.
> >
> >Is anyone has an idea?
> >
> >Thanks
> >
> >Nicolas
>
>------------------=[ xlawrence at jahia dot com ]=--------------------
>Computer Science Engineer, Master's Degree
>
>Jahia : A collaborative source CMS and Portal Server
>www.jahia.org Community and product web site
>www.jahia.com Commercial services company
>www.collaborativesource.org Jahia's collaborative license
>Jahia Solutions
>Rue de la gare 45
>Ch-1260 Nyon, Switzerland
>Phone: +41 22 361 34 24
>Fax  :   +41 22 361 36 40

------------------=[ xlawrence at jahia dot com ]=--------------------
Computer Science Engineer, Master's Degree

Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company
www.collaborativesource.org Jahia's collaborative license
Jahia Solutions
Rue de la gare 45
Ch-1260 Nyon, Switzerland
Phone: +41 22 361 34 24
Fax  :   +41 22 361 36 40 


Reply via email to