Lol

In fact that was too easy that's why I didn't find :=)))
If you want to automatically select a category for your container, don't use 
eventListener.

Just add this line where myContainerList is the name of the containerlist and 
emploi is the key of automatic category.

JahiaContainerList myCategoryContainerList = 
jData.containers().getContainerList( "myContainerList" );
HttpSession thisSession = request.getSession( true );
ArrayList testArray = new ArrayList();
testArray.add("emploi");
thisSession.setAttribute("defaultCategories_" + 
myCategoryContainerList.getDefinition().getObjectKey(), testArray);



Nicolas 

-----Message d'origine-----
De : Nicolas Lafaury 
Envoyé : mardi 2 août 2005 14:28
À : [email protected]
Objet : RE : RE : RE : Automatic category selection

Hello again

By damaged, I mean I can't use it after ly program and I have to delete the 
page and create a new one.
I have tried to print definition, ID... after and before saving, but I still 
have a problem.
If I find a new way I will told you because for the moment, my category doesn't 
happened in the container.

Thanks

Nicolas

-----Message d'origine-----
De : Xavier Lawrence [mailto:[EMAIL PROTECTED] Envoyé : lundi 25 juillet 2005 
09:50 À : [email protected] Objet : RE : RE : Automatic category selection


 From what you've written, the approach to use an eventlistener seems 
correct. Now, you should be able to save and set the category of your 
container in the listener. This is what we do in the blogs template and 
there is no reason why you could not do the same in your template.

A couple of things that comes into my mind, regarding that your container 
gets damaged:
- What do you exactly mean by "damaged" ?
- Have you tried printing the apect of your container, before and after the 
save to see what are the values of the container variables ?

Good luck.

Xavier

Le 16:17 22.07.2005, vous avez écrit:
>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

------------------=[ 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