Changes for page Document Tree
Last modified by Ludovic Dubost on 2024/07/22 15:50
From version 1.1
edited by Ludovic Dubost
on 2014/11/18 12:31
on 2014/11/18 12:31
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-index-ui-6.3]
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
-
Objects (2 modified, 4 added, 0 removed)
Details
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -1,4 +1,5 @@ 1 1 {{velocity}} 2 +#macro (escapeMacroParam $value)$!value.replaceAll('([~"])', '~$1')#end 2 2 #set ($docTreeConfig = { 3 3 'showWikis': false, 4 4 'showWikiPrettyName': true, ... ... @@ -8,7 +8,10 @@ 8 8 'showAttachments': true, 9 9 'showObjects': false, 10 10 'showClassProperties': false, 11 - 'showChildDocuments': true 12 + 'showChildDocuments': true, 13 + 'showOnlyViewable': true, 14 + 'filterByClass': '', 15 + 'root': '' 12 12 }) 13 13 #set ($resourceParams = {'outputSyntax': 'plain'}) 14 14 #foreach ($entry in $docTreeConfig.entrySet()) ... ... @@ -17,11 +17,26 @@ 17 17 #set ($discard = $resourceParams.put($entry.key, $value)) 18 18 #end 19 19 #end 24 +#set ($reference = "path:$xwiki.getURL($xcontext.macro.doc.documentReference, 'get', $escapetool.url($resourceParams))") 20 20 #set ($editable = $xcontext.macro.params.readOnly != 'true') 21 21 #set ($isFullWidthAvailable = $xcontext.macro.params.compact != 'true') 22 22 #set ($links = $xcontext.macro.params.links == 'true') 23 23 #set ($checkboxes = $xcontext.macro.params.checkboxes == 'true') 24 -{{tree reference="path:$xwiki.getURL($xcontext.macro.doc.documentReference, 'get', $escapetool.url($resourceParams))" 25 - root="$!xcontext.macro.params.root" dragAndDrop="$editable" contextMenu="$editable" icons="$isFullWidthAvailable" 26 - edges="$isFullWidthAvailable" links="$links" checkboxes="$checkboxes" /}} 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" /}} 27 27 {{/velocity}}
- XWiki.WikiMacroParameterClass[10]
-
- Parameter description
-
... ... @@ -1,1 +1,1 @@ 1 -The root node id. This is useful if you want to display only the descendants of a given node (which is the specified root). The tree displays the children of the root node on the first level, so the root node is not actually displayed. The entire tree is displayed if the root node is not specified. 1 +The root node id. This is useful if you want to display only the descendants of a given node (which is the specified root). The tree displays the children of the root node on the first level, so the root node is not actually displayed. The entire tree is displayed if the root node is not specified. The format of a node identifier is entityType:entityReference, where the entity type can be for instance wiki, space, document. E.g.: wiki:xwiki, space:xwiki:Main, document:xwiki:Main.WebHome
- XWiki.WikiMacroParameterClass[14]
-
- Parameter description
-
... ... @@ -1,0 +1,1 @@ 1 +The id of the node to open the tree to. All the ancestors of the specified node, up to the root of the tree, will be opened also. The format of the node id is the one used for the root parameter. - Parameter mandatory
-
... ... @@ -1,0 +1,1 @@ 1 +No - Parameter name
-
... ... @@ -1,0 +1,1 @@ 1 +openTo
- XWiki.WikiMacroParameterClass[15]
-
- Parameter default value
-
... ... @@ -1,0 +1,1 @@ 1 +true - Parameter description
-
... ... @@ -1,0 +1,1 @@ 1 +Show only the wiki, space and document nodes for which the current user has view right. If this is set to false then the wiki, space and document nodes that are not viewable by the current user are listed in the tree using their names. The user won't be able to see their content by following their links though (the user will just be aware of their existence). - Parameter mandatory
-
... ... @@ -1,0 +1,1 @@ 1 +No - Parameter name
-
... ... @@ -1,0 +1,1 @@ 1 +showOnlyViewable
- XWiki.WikiMacroParameterClass[16]
-
- Parameter description
-
... ... @@ -1,0 +1,1 @@ 1 +Show only the documents that have an object of the specified type. The value of this parameter is the full name of an XWiki document that holds a class definition. For example, 'Blog.CategoryClass' can be used to show only the documents that represent blog categories. Leave this parameter empty if you don't want to restrict the type of documents shown in the tree. - Parameter mandatory
-
... ... @@ -1,0 +1,1 @@ 1 +No - Parameter name
-
... ... @@ -1,0 +1,1 @@ 1 +filterByClass
- XWiki.WikiMacroParameterClass[17]
-
- Parameter default value
-
... ... @@ -1,0 +1,1 @@ 1 +false - Parameter description
-
... ... @@ -1,0 +1,1 @@ 1 +Show a text input that can be used to find tree nodes. The input is displayed above the tree and offers suggestions as you type based on the content of the tree. When a suggestion is selected the tree is expanded up to the corresponding node. - Parameter mandatory
-
... ... @@ -1,0 +1,1 @@ 1 +No - Parameter name
-
... ... @@ -1,0 +1,1 @@ 1 +finder