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
Version 6.1 last modified by VincentMassol on 19/06/2008 at 22:11
Comments: 0