Wiki source code of DocsJSON

Last modified by Eugen Colesnicov on 2013/03/24 06:00

Show last authors
1 {{include document="XWiki.LiveTableResultsMacros" /}}
2
3 {{velocity}}
4 #if("$!{request.xpage}" == 'plain')
5 $response.setContentType('application/json')
6 #end
7 #set($map = {})
8 #gridresult_buildJSON("$!request.classname" $request.collist.split(',') $map)
9 #foreach($row in $map.get('rows'))
10 #set($rowDoc = $xwiki.getDocument($row.get('doc_fullName')))
11 #set($parentDoc=$xwiki.getDocument($rowDoc.getParent()))
12 #set($value1="<a href='$parentDoc.getExternalURL()'>$parentDoc.display('Index') - $parentDoc.display('Title')</a>")
13 #set($children=$rowDoc.getChildren())
14 #set($value2="")
15 #foreach($child in $children)
16 #set($childDoc=$xwiki.getDocument($child))
17 #set($value2=$value2+"<a href='$childDoc.getExternalURL()'>$childDoc.getDisplayTitle()</a>"+"<br/>")
18 #end
19 #set($discard = $row.put('Folder', "$value1"))
20 #set($discard = $row.put('Pages', "$value2"))
21 #end
22 $jsontool.serialize($map)
23 {{/velocity}}