On 02/09/2015 10:15 AM, Pascal BASTIEN wrote:
Hello,
I read/apply this doc with succcess:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsinapage
With this code I can display all objects ATTACHED to THIS page.
***
#set($class = $obj.xWikiClass) ## access the class object representing
SomeSpace.SomeClass
#foreach($prop in $class.properties) ## go through all properties
...
***
but if I attached some class to another page, how can I list properties?
the $xwiki object has a method to access the class if you know the name
#set( $someClass = $xwiki.getClass(SomeSpace.SomeClass))
http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/XWiki.html#getClass%28java.lang.String%29
Another question:
I have a page with 3 same Class, how to list them (like ?editor=class did)?
you can get a list of of objects of a certain class via
$doc.getObjects(SomeSpace.SomeClass)
http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/Document.html#getObjects%28java.lang.String%29
An example:
MySpaceMyClass contain this Class properties:
- My Field ID (IdField: String)
- My Lib Field (LibField: String)
I create MySpace.MyNiceDoc and add my previous Class
MySpace/MyNiceDoc?editor=object
and contain:
Objets de type MySpace.MyClass (2)
* MyClass 0
- My Field ID
- My Lib Field
*MyClass 1:
- My Field ID
- My Lib Field
With it I like to fill a select list from this doc (but from another doc to).
How can I proceed? because on MySpace.MyNiceDoc I can only display one/First
Lib values with this code:
{{velocity}}
## Retrieve the first object (index [0]) among all objects attached to this
page and of a certain class
#set($obj = $doc.getObject('MySpace.MyClass'))
#set($class = $obj.xWikiClass) ## access the class object representing
SomeSpace.SomeClass
#foreach($prop in $class.properties) ## go through all properties
* ${prop.prettyName} : $doc.display($prop.getName())
#end
{{/velocity}}
I guess i need a loop but which one?
And the big question (who I think it will interest everyone), how can I use
documentation
( http://platform.xwiki.org/xwiki/bin/view/SRD/Navigation?xpage=embed and or
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/platform/xwiki-platform-oldcore/6.4/xwiki-platform-oldcore-6.4-javadoc.jar/!/index.html
)
to guess xWikiClass (or my loop) by example?
A doc/example to use documentation will be welcome. :-)
thxs for any help.
Pascal B
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
mit freundlichen Grüßen
Clemens Klein-Robbenhaar
--
Clemens Klein-Robbenhaar
Software Development
EsPresto AG
Breite Str. 30-31
10178 Berlin/Germany
Tel: +49.(0)30.90 226.763
Fax: +49.(0)30.90 226.760
robbenh...@espresto.com
HRB 77554 B - Berlin-Charlottenburg
Vorstand: Maya Biersack, Peter Biersack
Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber
Zertifiziert nach ISO 9001:2008
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users