> All the available methods are described (well, at least listed) in our > javadoc. > http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki-core-1.7.1-javadoc.zip/index.html > -> Document > void setContent(java.lang.String content)Jean-Vincent Drean a > écrit : > I ran throught the javadoc and thought of insertText but not setContent, that is why I was a bit lost.
>> #if($createDomain!="") >> #set($newDoc=$xwiki.createDocument()) >> #set($newName="Project."+$newDomainId) >> > > You can't manipulate strings like this with velocity, see bellow. > Why ? It works quite well like that. > > You don't have to create then rename a document, see bellow. > In the javadoc, the createDocument method does not have any parameter, and without parameter, it is the Main.WebHome page that is affected, that is why I renamed the page after the creation. > Anyway what you should do here is creating a page with the default > content and object (and call it a template) and copy it in your > script. > > #if($createDomain!="") > $xwiki.copyDocument("Project.ProjectTemplate", "Project.${newDomainId}") > #set($domainDoc = $xwiki."Project.${newDomainId}") > #set($domainObj = $newDoc.getObject("XWiki.DomainClass")) > $domainObj.set("id", $newDomainId) > $domainObj.set("name",$createDomain) > $domainDoc.save() > #end > > I tried putting my template in my page using setDefaultTemplate() but with no success, I did not thought of the copy method. Thanks for the hint. Anyway, here is the code I put (everything works fine): #if($createDomain!="") $xwiki.copyDocument("XWiki.DomainClassTemplate", "Project.${newDomainId}") #set($domainDoc = $xwiki.getDocument("Project.${newDomainId}")) #set($domainObj = $domainDoc.newObject("XWiki.DomainClass")) $domainObj.set("id", $newDomainId) $domainObj.set("name",$createDomain) $domainDoc.save() #end By not putting the object in the template, I can choose not to have one on the page (we never know) and the code is the same size. Anyway, I ran through the javadoc, but what you said is true, the method are only listed (and maybe not all the methods), so I had to guess on the aim of methods and the goal of the parameters, with only their names, that is a bit long and not intuitive, a small effort on the javadoc can help a lot ;). I will try help on this if I have time once I finish my project. > JV. > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > > -- ---- Jean Couteau Code Lutin - http://www.codelutin.com 44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28 _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users