RequestStructuredDocuments Macro
This is a Velocity macro, which isn't bundled with any XWiki product by default.
Macro contributed by Thomas Eveilleau.
This macro cannot currently be downloaded separately.
Macro contributed by Thomas Eveilleau.
This macro cannot currently be downloaded separately.
RequestStructuredDocuments Macro
Allow you to easily list all the documents containing an object of a given class (without having to write the HQL request) - ordered by creation date desc.Usage
#requestdocuments("Class FullName" "Template FullName" )Parameters definition
| Name | Optional | Allowed values | Default value | Description |
|---|---|---|---|---|
| Class FullName | no | Space.Page | none | FullName of the page containing the Class |
| Template FullName | yes | Space.Page | none | FullName of the Template page (for an exclusion) |
Example
#requestdocuments("XWiki.XWikiUsers" "")
#foreach ($results in $result)
* $results
#endResult
Installation
This a Velocity macro. Since it's not bundled by default you'll have to copy/paste the following code to use it:#macro(requestdocuments $class $template)
#if($template!="")
#set($exclude = "and doc.fullName!='${template}'")
#else
#set($exclude = "")
#end
#set ($request = ", BaseObject as obj where doc.fullName=obj.name and obj.className='${class}' $exclude order by doc.creationDate desc")
#set($result=$xwiki.searchDocuments($request))
#end