Hello Cristian,

I tried that. But this does not direct me to the Object "form" that I can
fill out with the values for all the properties.

basically, I want to be able to create a new page and then when the user is
redirected to that page, the object should already be there for him to fill
in.

I use this script to create a new page: (Obtained from create.vm)

#set($title = $request.getParameter("title"))
#set($template = "")
#set($template = $request.getParameter("template"))
#set($parent = "")
#set($parent=$request.getParameter("parent"))
#set($auxparams="")
#set($auxparams=$request.getParameter("auxparams"))
#set($docname=$title.replaceAll("/", "."))
#set($newdoc=$xwiki.getDocument($docname))
#set($etitle = $util.encodeURI($title))
#set($etemplate = $util.encodeURI("${template}"))
#set($eparent = $util.encodeURI("${parent}${auxparams}"))
#set($object =
$newdoc.newObject("PublishAnAsset.createMarketingFlyerClass"))
$response.sendRedirect($newdoc.getURL("edit",
"template=${etemplate}&parent=${eparent}&title=$etitle&editor=object"))
###includeForm("XWiki.TodoClassSheet")

But this jsut creates the new page for me.What should I add to this script
so that the new page is created with an object of the class mentioned!

Thanks a lot for all help

On Tue, Apr 15, 2008 at 2:25 PM, <[EMAIL PROTECTED]> wrote:

> Hi,
> What you're looking for is the createNewObject method in Document Api.
> Here's a link to javadoc:
>
> http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.3.2%2Djavadoc.zip/com/xpn/xwiki/api/Document.html#createNewObject(java.lang.String)<http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.3.2%2Djavadoc.zip/com/xpn/xwiki/api/Document.html#createNewObject%28java.lang.String%29>
>
> So you can do:
> #set( $objnr = $doc.createNewObject("MySpace.MyClass"))
> or
> #set( $objnr =
>
> $xwiki.getDocument("MySpace.MyDocument").createNewObject("MySpace.MyClass"))
> This will return you the number of the object.
>
> Then you can do #set( $myobj = $doc.getObject("MySpace.MyClass",$objnr) )
> and this will get you the actual object
>
> Hope it helps ;)
>
> Kamna Jain wrote:
>
> > Hello,
> > Can anybody tell me how to add an object of an already created class to
> a
> > new page using Velocity...not the interface provided by Xwiki.
> > Which method do I need to call to achieve this!!!
> >
> > Thanks
> > _______________________________________________
> > devs mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
>
>
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to