Show last authors
1 Here is an easy way to create Tree View that lists spaces and their children in a tree view in panel without any problem.
2
3 It is using mktree extension that could be found here
4 [[http:~~/~~/extensions.xwiki.org/xwiki/bin/view/Extension/Mktree+Application>>doc:Extension.Mktree Application]]
5
6 {{code}}
7 {{velocity}}
8 {{html wiki="true"}}
9 $xwiki.ssx.use("XWiki.mktree")
10 $xwiki.jsx.use("XWiki.mktree")
11 <ul name ="anyname" class="mktree">
12 #set ($spaces = $xwiki.spaces)
13 #foreach ($space in $spaces)
14 #if ($hasAdmin || ($xwiki.hasAccessLevel('view', "${space}.WebHome") && !$blacklistedSpaces.contains($space)))
15 #if ($foreach.index > 0)
16 (% class="pitemseparator" %) ~| (%%)##
17 #end
18 #set($query="where doc.fullName='${space}.WebHome'")
19 #set($results = false)
20 #set($results = $xwiki.searchDocuments($query, 10, 0))
21 #foreach($docname in $results)
22 #set($rdoc = $xwiki.getDocument($docname).getTranslatedDocument())
23 <li>
24 [[$rdoc.getDisplayTitle()>>$rdoc.fullName]]
25 </li>
26 #set($query2="where doc.parent='$rdoc'")
27 #set($results2 = false)
28 #set($results2 = $xwiki.searchDocuments($query2, 10, 0))
29 <ul>
30 #foreach($rdoc in $results2)
31 #set($rdoc2 = $xwiki.getDocument($rdoc).getTranslatedDocument())
32 <li>
33 [[$rdoc2.getDisplayTitle()>>$rdoc2.fullName]]
34 </li>
35 #set($query3="where doc.parent='$rdoc2'")
36 #set($results3 = false)
37 #set($results3 = $xwiki.searchDocuments($query3, 10, 0))
38 <ul>
39 #foreach($rdoc2 in $results3)
40 #set($rdoc3 = $xwiki.getDocument($rdoc2).getTranslatedDocument())
41 <li>
42 [[$rdoc3.getDisplayTitle()>>$rdoc3.fullName]]
43 </li>
44 #set($query4="where doc.parent='$rdoc3'")
45 #set($results4 = false)
46 #set($results4 = $xwiki.searchDocuments($query4, 10, 0))
47 <ul>
48 #foreach($rdoc3 in $results4)
49 #set($rdoc4 = $xwiki.getDocument($rdoc3).getTranslatedDocument())
50 <li>
51 [[$rdoc4.getDisplayTitle()>>$rdoc4.fullName]]
52 </li>
53 #set($query5="where doc.parent='$rdoc4'")
54 #set($results5 = false)
55 #set($results5 = $xwiki.searchDocuments($query5, 10, 0))
56 <ul>
57 #foreach($rdoc4 in $results5)
58 #set($rdoc5 = $xwiki.getDocument($rdoc4).getTranslatedDocument())
59 <li>
60 [[$rdoc5.getDisplayTitle()>>$rdoc5.fullName]]
61 </li>
62 #end
63 </ul>
64 #end
65 </ul>
66 #end
67 </ul>
68 #end
69 </ul>
70 #end
71 #end
72 #end
73 {{/html}}
74 {{/velocity}}
75 {{/code}}

Get Connected