Hi, I would like some direction in learning to understand things like this (code I found in your demo database): #set($obj = $doc.getObject("XWiki.FAQClass","language",$language, true)) #set($class = $obj.xWikiClass) #foreach($prop in $class.properties) 1.1 ${prop.prettyName}: $doc.display($prop.getName(), "rendered", $obj) <br /> #end ...will I have to look at the code to understand usage on things like "XWiki.FAQClass.properties" in my scripts? Or is there another resource? The above works, but what I really want to do is modify that code to loop thru the objects present in a "table" such as "Blog.Categories" that came with demo. ...But in a nested loop: #set($obj = $doc.getObject("XWiki.MyTable","language",$language, true)) #set($class = $obj.xWikiClass) <--- what is this? #foreach(...object in that class??...) 1 ${...thatObject.Name} #set ($sql = ", BaseObject as obj where obj.name=CONCAT(XWD_WEB,'.',XWD_NAME) and obj.className='Csdg.ArticleClass' and obj.name<>'Csdg.ArticleClassTemplate'") #foreach ($item in $xwiki.searchDocuments($sql)) #set($bentrydoc = $xwiki.getDocument($item)) #set($bentryobj = $bentrydoc.getObject("Csdg.ArticleClass", "language", $language, true)) #if (${bentrydoc.display("audience","view", $bentryobj)} == "Users") * [$item] #end #end #end ...I'm not sure how much help to expect with this, but any comment would be great. thank you in adv. -Ken
Hi Ken, [email protected] a écrit :
Hi,
I would like some direction in learning to understand things like this (code I found in your demo database):
#set($obj = $doc.getObject("XWiki.FAQClass","language",$language, true)) #set($class = $obj.xWikiClass) #foreach($prop in $class.properties) 1.1 ${prop.prettyName}: $doc.display($prop.getName(), "rendered", $obj) <br /> #end
...will I have to look at the code to understand usage on things like "XWiki.FAQClass.properties" in my scripts? Or is there another resource?
I've started putting some documentation in the Javadoc for the API http://build.xpertnet.biz/doc/api/com/xpn/xwiki/api/package-summary.html And also to document in the DevGuide: http://www.xwiki.org/xwiki/bin/view/DevGuide/Scripting
The above works, but what I really want to do is modify that code to loop thru the objects present in a "table" such as "Blog.Categories" that came with demo.
...But in a nested loop:
#set($obj = $doc.getObject("XWiki.MyTable","language",$language, true)) #set($class = $obj.xWikiClass) <--- what is this?
#foreach(...object in that class??...)
1 ${...thatObject.Name}
#set ($sql = ", BaseObject as obj where obj.name=CONCAT(XWD_WEB,'.',XWD_NAME) and obj.className='Csdg.ArticleClass' and obj.name<>'Csdg.ArticleClassTemplate'")
#foreach ($item in $xwiki.searchDocuments($sql))
#set($bentrydoc = $xwiki.getDocument($item)) #set($bentryobj = $bentrydoc.getObject("Csdg.ArticleClass", "language", $language, true)) #if (${bentrydoc.display("audience","view", $bentryobj)} == "Users") * [$item] #end
#end #end
...I'm not sure how much help to expect with this, but any comment would be great.
First Blog.Categories are just in one document, so you don't really need a query... #set($catdoc = $xwiki.getDocument("Blog.Categories")) ## they are in document Blog.Categories #foreach($catobj in $catdoc.getObjects("Blog.Categories")) ## objects are of class Blog.Categories * $catobj.display("name") $catobj.description * $catdoc.display("name", "view", $catobj) * $catdoc.display("description", "view", $catobj) #end Ludovic
thank you in adv. -Ken
------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic
Thank you, Ludovic. I forgot that the xwiki sites are growing and I need to check it! These links put me on the path:
http://build.xpertnet.biz/doc/api/com/xpn/xwiki/api/package-summary.html (I can at least pick out method names and try to use them in my velocity)
http://www.xwiki.org/xwiki/bin/view/DevGuide/Scripting (that's what I thought but never really figured out)
and I think this is a great idea: http://www.xwiki.org/xwiki/bin/view/DevGuide/Scripting That answer you provided for the nested loop seems to work, I just need to tweak it. I had seen those sorts of calls, I just didn't realize what I was dealing with. Yeah page objects versus fields of an object on a page ...I'll get it as some point. Thanks! -Ken
participants (2)
-
kenk@ucar.edu -
Ludovic Dubost