Changes for page Document Tree
Last modified by Ludovic Dubost on 2024/07/22 15:50
From version 4.1
edited by Ludovic Dubost
on 2016/04/01 11:48
on 2016/04/01 11:48
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-index-tree-macro-8.0]
To version 3.1
edited by Ludovic Dubost
on 2015/11/28 14:58
on 2015/11/28 14:58
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-index-tree-macro-7.3]
Summary
-
Objects (1 modified, 0 added, 1 removed)
Details
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -1,11 +1,37 @@ 1 -{{ template name="documentTree_macros.vm" /}}1 +{{include reference="XWiki.DocumentTreeConfig" /}} 2 2 3 3 {{velocity}} 4 -#set ($options = {}) 5 -#foreach ($parameterName in $xcontext.macro.params.parameterNames) 6 - #set ($discard = $options.put($parameterName, $xcontext.macro.params.get($parameterName))) 4 +#macro (escapeMacroParam $value)$!value.replaceAll('([~"])', '~$1')#end 5 +## showChildDocuments is deprecated since 7.2M2. Fall-back on hierarchyMode for backwards compatibility. 6 +#if ($xcontext.macro.params.showChildDocuments == 'true') 7 + #set ($discard = $xcontext.macro.params.set('hierarchyMode', 'parentchild')) 7 7 #end 8 -{{html clean="false"}} 9 -#documentTree($options) 10 -{{/html}} 9 +#set ($resourceParams = {'outputSyntax': 'plain'}) 10 +#foreach ($entry in $docTreeConfig.entrySet()) 11 + #set ($value = $xcontext.macro.params.get($entry.key)) 12 + #if ("$!value" != '' && $value != "$!entry.value") 13 + #set ($discard = $resourceParams.put($entry.key, $value)) 14 + #end 15 +#end 16 +#set ($reference = "path:$xwiki.getURL($xcontext.macro.doc.documentReference, 'get', $escapetool.url($resourceParams))") 17 +#set ($editable = $xcontext.macro.params.readOnly != 'true') 18 +#set ($isFullWidthAvailable = $xcontext.macro.params.compact != 'true') 19 +#set ($links = $xcontext.macro.params.links == 'true') 20 +#set ($checkboxes = $xcontext.macro.params.checkboxes == 'true') 21 +#set ($finder = $xcontext.macro.params.finder == 'true') 22 +## We use directly FontAwesome for the tree node icons for two reasons: 23 +## * the XWiki icon set (available through the icon themes) is limited 24 +## * jsTree expects an URL/path or a CSS class name as the value of the tree node icon configuration when JSON source is 25 +## used; the icon theme API is currently only able to render an icon but there's no way to get the icon configuration 26 +## as jsTree expects it. The alternative is to use the HTML source to feed the tree but then the tree definition and 27 +## configuration becomes complex. 28 +## We don't load the FontAwesome CSS directly from its WebJar because it contains some relative paths that currently are 29 +## not handled correctly by the WebJar action. This has been fixed in the FontAwesome icon theme so we load the theme 30 +## SSX instead. 31 +#set ($discard = $xwiki.ssx.use('IconThemes.FontAwesome')) 32 +## Include also the fix for the FontAwesome loading issue on IE8. 33 +#set ($discard = $xwiki.jsx.use('IconThemes.FontAwesome')) 34 +{{tree reference="#escapeMacroParam($reference)" dragAndDrop="$editable" contextMenu="$editable" 35 + icons="$isFullWidthAvailable" edges="$isFullWidthAvailable" links="$links" checkboxes="$checkboxes" 36 + openTo="#escapeMacroParam($xcontext.macro.params.openTo)" finder="$finder" /}} 11 11 {{/velocity}}
- XWiki.WikiMacroParameterClass[19]
-
- Parameter default value
-
... ... @@ -1,1 +1,0 @@ 1 -true - Parameter description
-
... ... @@ -1,1 +1,0 @@ 1 -Set this parameter to false if you want to include the hidden documents in the tree. Otherwise, if the value is true, the hidden documents are excluded or included based on current user's preferences. - Parameter mandatory
-
... ... @@ -1,1 +1,0 @@ 1 -No - Parameter name
-
... ... @@ -1,1 +1,0 @@ 1 -filterHiddenDocuments