Wiki source code of DocsJSON4Section
Last modified by Eugen Colesnicov on 2013/03/24 06:00
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{include document="XWiki.LiveTableResultsMacros" /}} | ||
2 | |||
3 | {{velocity}} | ||
4 | #if("$!{request.xpage}" == 'plain') | ||
5 | $response.setContentType('application/json') | ||
6 | #end | ||
7 | #set($map = {}) | ||
8 | #set($sp=$!request.classname) | ||
9 | #set($sp=$!request.space) | ||
10 | ###gridresultwithfilter_buildJSON("$!request.classname" $request.collist.split(',') '' "and doc.space='$!request.space'" [] $map) | ||
11 | #gridresult_buildJSON("$!request.classname" $request.collist.split(',') $map) | ||
12 | #foreach($row in $map.get('rows')) | ||
13 | #set($rowDoc = $xwiki.getDocument($row.get('doc_fullName'))) | ||
14 | #set($parentDoc=$xwiki.getDocument($rowDoc.getParent())) | ||
15 | #set($value1="<a href='$parentDoc.getExternalURL()'>$parentDoc.display('Index') - $parentDoc.display('Title')</a>") | ||
16 | #set($children=$rowDoc.getChildren()) | ||
17 | #set($value2="") | ||
18 | #foreach($child in $children) | ||
19 | #set($childDoc=$xwiki.getDocument($child)) | ||
20 | #set($value2=$value2+"<a href='$childDoc.getExternalURL()'>$childDoc.getDisplayTitle()</a>"+"<br/>") | ||
21 | #end | ||
22 | #set($discard = $row.put('Folder', "$value1")) | ||
23 | #set($discard = $row.put('Pages', "$value2")) | ||
24 | #end | ||
25 | $jsontool.serialize($map) | ||
26 | {{/velocity}} |