Changes for page Documents Macro

Last modified by superadmin on 2017/11/28 14:52
From empty
To version 1.1
edited by superadmin
on 2017/11/28 14:52
Change comment: Install extension [org.xwiki.platform:xwiki-platform-index-ui/9.9]

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +Documents Macro
Parent
... ... @@ -1,0 +1,1 @@
1 +Main.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.XWikiGuest
1 +xwiki:XWiki.superadmin
Hidden
... ... @@ -1,1 +1,1 @@
1 -false
1 +true
Content
... ... @@ -1,0 +1,7 @@
1 +Example:
2 +
3 +##{{{{{documents id="example" count="5" actions="false" columns="doc.title, doc.location"/}}}}}##
4 +
5 +Generates:
6 +
7 +{{documents id="example" count="5" actions="false" columns="doc.title, doc.location"/}}
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,0 +1,50 @@
1 +{{velocity}}
2 +#if ("$!xcontext.macro.params.columns" != "")
3 + #set ($collist = [])
4 + #foreach ($colname in $xcontext.macro.params.columns.split(','))
5 + #set ($discard = $collist.add($colname.trim()))
6 + #end
7 +#else
8 + #set($collist = ['doc.title', 'doc.location', 'doc.date', 'doc.author'])
9 +#end
10 +#set($colprops = {
11 + 'doc.title' : { 'size' : 30, 'link' : 'view', 'filterable': false, 'sortable': false },
12 + 'doc.location' : { 'html': true },
13 + 'doc.fullName' : { 'size' : 30, 'link' : 'view' },
14 + 'doc.name' : { 'size' : 30, 'link' : 'view' },
15 + 'doc.space' : { 'link' : 'space' },
16 + 'doc.author' : { 'link' : 'author' }
17 +})
18 +#set($options = {
19 + 'translationPrefix' : 'platform.index.',
20 + 'rowCount' : $xcontext.macro.params.count,
21 + 'description' : 'This table lists documents found on this wiki based on passed criteria. The columns can be sorted and some can be filtered.'
22 +})
23 +#if ("$!xcontext.macro.params.space" != "")
24 + #set ($extraParams = "&space=$escapetool.url($xcontext.macro.params.space)")
25 +#end
26 +#if ("$!xcontext.macro.params.location" != "")
27 + #set ($extraParams = "$!{extraParams}&location=$escapetool.url($xcontext.macro.params.location)")
28 +#end
29 +#if ("$!xcontext.macro.params.parent" != "")
30 + #set ($extraParams = "$!{extraParams}&parent=$escapetool.url($xcontext.macro.params.parent)")
31 +#end
32 +#if ("$!extraParams" != "")
33 + #set($discard = $options.put('extraParams', $extraParams))
34 +#end
35 +#if(!$isGuest && $xcontext.macro.params.actions == "true")
36 + #set($discard = $collist.add('_actions'))
37 + #set($discard = $colprops.put('_actions', {
38 + 'actions': ['copy', 'rename', 'rights', 'delete'],
39 + 'filterable': false,
40 + 'sortable': false
41 + }))
42 +#end
43 +#if ("$!xcontext.macro.params.id" != "")
44 + #set ($livetableId = $xcontext.macro.params.id)
45 +#else
46 + ## TODO: Improve this since we could have several livetables on the same page with same ids
47 + #set ($livetableId = "documents-$mathtool.random(1, 1000)")
48 +#end
49 +#livetable($livetableId $collist $colprops $options)
50 +{{/velocity}}
Macro content type
... ... @@ -1,0 +1,1 @@
1 +No content
Default category
... ... @@ -1,0 +1,1 @@
1 +Content
Macro description
... ... @@ -1,0 +1,1 @@
1 +Displays a list of documents in a Livetable
Macro id
... ... @@ -1,0 +1,1 @@
1 +documents
Macro name
... ... @@ -1,0 +1,1 @@
1 +Documents
Supports inline mode
... ... @@ -1,0 +1,1 @@
1 +No
Macro visibility
... ... @@ -1,0 +1,1 @@
1 +Current Wiki
XWiki.WikiMacroParameterClass[0]
Parameter default value
... ... @@ -1,0 +1,1 @@
1 +15
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Number of items to display by default
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +count
XWiki.WikiMacroParameterClass[1]
Parameter default value
... ... @@ -1,0 +1,1 @@
1 +true
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Whether to show the actions columns or not
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +actions
XWiki.WikiMacroParameterClass[2]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Only lists documents found in the passed space
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +space
XWiki.WikiMacroParameterClass[3]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Livetable id
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +id
XWiki.WikiMacroParameterClass[4]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Only list pages having the specified parent
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +parent
XWiki.WikiMacroParameterClass[5]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Specifies the list of columns to display (e.g. "doc.name,doc.space"). If not specified then the default column list of used ("doc.name,doc.space,doc.date,doc.author")
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +columns
XWiki.WikiMacroParameterClass[6]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Only lists documents having a full reference matching the passed location (e.g. passing "Beau" would match a document reference of "France.Paris.Beaubourg.Office")
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +location