Changes for page Document Tree
Last modified by Ludovic Dubost on 2024/07/22 15:50
From version 9.1
edited by Ludovic Dubost
on 2019/08/02 10:59
on 2019/08/02 10:59
Change comment:
Migrated property [contentJavaType] from class [XWiki.WikiMacroClass]
To version 2.1
edited by Ludovic Dubost
on 2015/09/01 11:46
on 2015/09/01 11:46
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-index-ui-7.1]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (2 modified, 0 added, 4 removed)
Details
- Page properties
-
- Content
-
... ... @@ -17,6 +17,10 @@ 17 17 18 18 {{documentTree compact="true" /}} 19 19 20 + == Document Index Tree == 21 + 22 + {{documentTree showSpaces="true" /}} 23 + 20 20 == Wiki > Space > Page Tree == 21 21 22 22 {{documentTree showWikis="true" showSpaces="true" showTranslations="false" showAttachments="false" showChildDocuments="false" /}}
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -1,12 +3,46 @@ 1 -{{template name="documentTree_macros.vm" /}} 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))) 2 +#macro (escapeMacroParam $value)$!value.replaceAll('([~"])', '~$1')#end 3 +#set ($docTreeConfig = { 4 + 'showWikis': false, 5 + 'showWikiPrettyName': true, 6 + 'showSpaces': false, 7 + 'showDocumentTitle': true, 8 + 'showTranslations': true, 9 + 'showAttachments': true, 10 + 'showObjects': false, 11 + 'showClassProperties': false, 12 + 'showChildDocuments': true, 13 + 'showOnlyViewable': true, 14 + 'filterByClass': '', 15 + 'root': '' 16 +}) 17 +#set ($resourceParams = {'outputSyntax': 'plain'}) 18 +#foreach ($entry in $docTreeConfig.entrySet()) 19 + #set ($value = $xcontext.macro.params.get($entry.key)) 20 + #if ("$!value" != '' && $value != "$!entry.value") 21 + #set ($discard = $resourceParams.put($entry.key, $value)) 22 + #end 7 7 #end 8 -{{html clean="false"}} 9 -#prepareTreeOptions($options) 10 -#documentTree($options) 11 -{{/html}} 24 +#set ($reference = "path:$xwiki.getURL($xcontext.macro.doc.documentReference, 'get', $escapetool.url($resourceParams))") 25 +#set ($editable = $xcontext.macro.params.readOnly != 'true') 26 +#set ($isFullWidthAvailable = $xcontext.macro.params.compact != 'true') 27 +#set ($links = $xcontext.macro.params.links == 'true') 28 +#set ($checkboxes = $xcontext.macro.params.checkboxes == 'true') 29 +#set ($finder = $xcontext.macro.params.finder == 'true') 30 +## We use directly FontAwesome for the tree node icons for two reasons: 31 +## * the XWiki icon set (available through the icon themes) is limited 32 +## * jsTree expects an URL/path or a CSS class name as the value of the tree node icon configuration when JSON source is 33 +## used; the icon theme API is currently only able to render an icon but there's no way to get the icon configuration 34 +## as jsTree expects it. The alternative is to use the HTML source to feed the tree but then the tree definition and 35 +## configuration becomes complex. 36 +## We don't load the FontAwesome CSS directly from its WebJar because it contains some relative paths that currently are 37 +## not handled correctly by the WebJar action. This has been fixed in the FontAwesome icon theme so we load the theme 38 +## SSX instead. 39 +#set ($discard = $xwiki.ssx.use('IconThemes.FontAwesome')) 40 +## Include also the fix for the FontAwesome loading issue on IE8. 41 +#set ($discard = $xwiki.jsx.use('IconThemes.FontAwesome')) 42 +{{tree reference="#escapeMacroParam($reference)" root="#escapeMacroParam($xcontext.macro.params.root)" 43 + dragAndDrop="$editable" contextMenu="$editable" icons="$isFullWidthAvailable" edges="$isFullWidthAvailable" 44 + links="$links" checkboxes="$checkboxes" openTo="#escapeMacroParam($xcontext.macro.params.openTo)" 45 + finder="$finder" /}} 12 12 {{/velocity}}
- XWiki.WikiMacroParameterClass[9]
-
- Parameter default value
-
... ... @@ -1,1 +1,1 @@ 1 -re ference1 +true - Parameter description
-
... ... @@ -1,1 +1,1 @@ 1 - Specifies which hierarchytouse betweendocuments. Possiblevalues are "reference" (default) and "parentchild".If "reference" is usedthen the documenthierarchy isdefined using only the document reference, especially the nestedspaces componentofthe documentreference. If "parentchild"is used then the hierarchy is based on the parent/child relationship defined by the "parent" document fieldfrom the database.1 +Whether to show the child documents based on the document parent field. - Parameter name
-
... ... @@ -1,1 +1,1 @@ 1 -h ierarchyMode1 +showChildDocuments
- XWiki.WikiMacroParameterClass[18]
-
- Parameter default value
-
... ... @@ -1,1 +1,0 @@ 1 -false - Parameter description
-
... ... @@ -1,1 +1,0 @@ 1 -Whether to show the root node or not. The root node is not shown by default because it is usually implied from the context where the tree is displayed (e.g. a label before the tree). There are some cases though when you may want to display the root node: to be able to create a new node under the root. - Parameter mandatory
-
... ... @@ -1,1 +1,0 @@ 1 -No - Parameter name
-
... ... @@ -1,1 +1,0 @@ 1 -showRoot
- 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
- XWiki.WikiMacroParameterClass[20]
-
- Parameter default value
-
... ... @@ -1,1 +1,0 @@ 1 -15 - Parameter description
-
... ... @@ -1,1 +1,0 @@ 1 -The maximum number of child nodes to display when expanding a parent node for the first time. The rest of the child nodes are accessible through a "more ..." link. This parameter is basically used to paginate the child nodes and thus helps the tree scale when the number of child nodes is large. - Parameter mandatory
-
... ... @@ -1,1 +1,0 @@ 1 -No - Parameter name
-
... ... @@ -1,1 +1,0 @@ 1 -limit
- XWiki.WikiMacroParameterClass[21]
-
- Parameter description
-
... ... @@ -1,1 +1,0 @@ 1 -The list of nodes to exclude from the tree. The nodes are specified by their id and separated by comma. - Parameter mandatory
-
... ... @@ -1,1 +1,0 @@ 1 -No - Parameter name
-
... ... @@ -1,1 +1,0 @@ 1 -exclusions