Wiki source code of ExportDocumentTree

Show last authors
1 {{velocity}}
2 #if ($xcontext.action != 'get')
3 {{html clean="false"}}
4 #template('export_macros.vm')
5 #exportTreeSelector({
6 'filter': 'pristineInstalledExtensionDocument',
7 'root': "wiki:$xcontext.database"
8 })
9 {{/html}}
10 #end
11 {{/velocity}}
12
13 {{velocity}}
14 #if ($xcontext.action == 'get')
15 {{include reference="XWiki.DocumentTreeMacros" /}}
16 #end
17 {{/velocity}}
18
19 {{velocity output="false"}}
20 #macro (postProcessDocumentTreeData $data)
21 #if ($request.data == 'children')
22 ## Change the icons in order to be able to differentiate content pages from extension pages and from customized
23 ## extension pages.
24 #foreach ($node in $data)
25 #if ($node.data.type == 'document')
26 #set ($documentReference = $services.model.resolveDocument($node.data.id))
27 #set ($iconName = 'file-text')
28 #set ($iconStyle = 'text-success')
29 #if ($services.extension.xar.isExtensionDocument($documentReference))
30 #if ($services.extension.xar.isCustomizedExtensionDocument($documentReference))
31 #set ($iconName = 'file-code')
32 #set ($iconStyle = 'text-warning')
33 #if ($services.extension.xar.isEditAllowed($documentReference))
34 ## Distinguish safe modifications (e.g. configuration) from unsafe modifications (code).
35 #set ($iconStyle = 'text-success')
36 #end
37 #if ($request.filters == 'installedExtensionDocument')
38 ## This node is visible probably because it has some child content pages, but the user should not be able
39 ## to select it with the current filter.
40 #set ($node.state = {'disabled': true, 'undetermined': true})
41 #end
42 #else
43 #set ($iconName = 'file-white')
44 #set ($iconStyle = 'text-danger')
45 #if ($request.filters == 'pristineInstalledExtensionDocument'
46 || $request.filters == 'installedExtensionDocument')
47 ## This node is visible probably because it has some child content pages or child customized extension
48 ## pages, but the user should not be able to select it with the current filter.
49 #set ($node.state = {'disabled': true, 'undetermined': true})
50 #end
51 #end
52 ## Show the extension name and id as a tool tip for the tree node.
53 #set ($installedExtensions = $services.extension.xar.getInstalledExtensions($documentReference))
54 #set ($tooltip = [])
55 #foreach ($installedExtension in $installedExtensions)
56 #set ($discard = $tooltip.add("$installedExtension.name ($installedExtension.id)"))
57 #end
58 #if ($tooltip.size() > 0)
59 #set ($node.a_attr.title = $stringtool.join($tooltip, ', '))
60 #end
61 #end
62 #set ($iconMetaData = $services.icon.getMetaData($iconName))
63 #if ($iconMetaData.iconSetType == 'IMAGE')
64 #set ($node.icon = $iconMetaData.url)
65 #elseif ($iconMetaData.iconSetType == 'FONT')
66 #set ($node.icon = "$iconMetaData.cssClass $iconStyle")
67 #end
68 #elseif ($node.data.type == 'empty')
69 #set ($node.state = {'disabled': true, 'selected': false})
70 #set ($node.a_attr = {'class': 'jstree-no-checkboxes'})
71 #end
72 #end
73 #end
74 #end
75 {{/velocity}}
76
77 {{velocity}}
78 #if ($xcontext.action == 'get')
79 #updateDocTreeConfigFromRequest
80 #handleDocumentTreeRequest
81 #end
82 {{/velocity}}