This macro isn't bundled with any XWiki product by default.
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

NameOptionalAllowed valuesDefault valueDescription
Class FullNamenoSpace.PagenoneFullName of the page containing the Class
Template FullNameyesSpace.PagenoneFullName of the Template page (for an exclusion)

Example

#requestdocuments("XWiki.XWikiUsers" "")

#foreach ($results in $result) * $results #end

Result

requestresult.png

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

No comments for this document

Attachments 1

Image
requestresult.png 1.1
PostedBy: ThomasEveilleau on 12/05/2008 (14kb )

Creator: ThomasEveilleau on 2008/05/12 13:39
This wiki is licensed under a Creative Commons license
1.4.1.10194