Changes for page Treeview

Last modified by Ludovic Dubost on 2023/04/25 09:12

From version 21.1
edited by Ludovic Dubost
on 2010/11/03 01:27
Change comment: There is no comment for this version
To version 13.1
edited by Ludovic Dubost
on 2010/11/03 01:20
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,6 +1,2 @@
1 1  
2 -{{treeview page="Test.TestParent1" maxdepth="1" /}}
3 -
4 -{{treeview page="Test.TestParent1" maxdepth="2" /}}
5 -
6 6  {{treeview page="Test.TestParent1" maxdepth="3" /}}
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,7 +1,7 @@
1 1  {{velocity}}
2 2  {{html clean=false}}
3 3  #set($rootpage = $xcontext.macro.params.page)
4 -#set($maxdepth = $util.parseInt($xcontext.macro.params.maxdepth))
4 +#set($maxdepth = $xcontext.macro.params.maxdepth)
5 5  #set($selectlist = $util.arrayList)
6 6  #set($treelist = $util.arrayList)
7 7  #set($ok = $treelist.add({"id" : $rootpage, "value" : $rootpage, "parent" : "", "url" : $xwiki.getURL($rootpage), "expanded" : true}))
... ... @@ -21,7 +21,7 @@
21 21   #end
22 22  #end
23 23  #set($sql = "select doc.fullName, doc.parent from XWikiDocument as doc where doc.parent in ('${parentlist}')")
24 -#foreach($res in $xwiki.search($sql, 40, 0))
24 +#foreach($res in $xwiki.search($sql, 0, 40))
25 25   #set($page = $listtool.get($res, 0))
26 26   #if($page!="")
27 27   #set($parent = $listtool.get($res, 1))
... ... @@ -30,11 +30,11 @@
30 30   #end
31 31  #end
32 32  #set($pages = $newpages)
33 -##PAGES: $pages
33 +## PAGES: $pages
34 34  #end
35 35  #end ## end macro
36 36  ## adding $maxdepth level
37 -#if(!$maxdepth)
37 +#if($maxdepth)
38 38   #set($maxdepth = 3)
39 39  #end
40 40  #foreach($i in [1..$maxdepth])
... ... @@ -71,10 +71,6 @@
71 71   parent2 = nodes[parent];
72 72   nodes[id] = new YAHOO.widget.TextNode(text, parent2, expanded);
73 73   nodes[id].href = url;
74 - if (expanded)
75 - nodes[id].expand()
76 - else
77 - nodes[id].collapse()
78 78   }
79 79  
80 80   function treeInit${tviewid}() {