diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml index 0f5a6ce0e56b..552292c41d3b 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml @@ -257,64 +257,52 @@ Generates: {{velocity}} #if ("$!xcontext.macro.params.columns" != "") - #set ($collist = []) + #set ($properties = []) #foreach ($colname in $xcontext.macro.params.columns.split(',')) - #set ($discard = $collist.add($colname.trim())) + #set ($discard = $properties.add($colname.trim())) #end #else - #set($collist = ['doc.title', 'doc.location', 'doc.date', 'doc.author']) + #set($properties = ['doc.title', 'doc.location', 'doc.date', 'doc.author']) #end -#set($colprops = { - 'doc.title' : { 'size' : 30, 'link' : 'view' }, - 'doc.location' : { 'html': true }, - 'doc.fullName' : { 'size' : 30, 'link' : 'view' }, - 'doc.name' : { 'size' : 30, 'link' : 'view' }, - 'doc.space' : { 'link' : 'space' }, - 'doc.author' : { 'link' : 'author' } -}) -#set($options = { +#set($sourceParameters = { 'translationPrefix' : 'platform.index.', - 'rowCount' : $xcontext.macro.params.count, 'description' : 'This table lists documents found on this wiki based on passed criteria. The columns can be sorted and some can be filtered.' }) #if ("$!xcontext.macro.params.space" != "") - #set ($extraParams = "&space=$escapetool.url($xcontext.macro.params.space)") -#end -#if ("$!xcontext.macro.params.location" != "") - #set ($extraParams = "$!{extraParams}&location=$escapetool.url($xcontext.macro.params.location)") + #set ($discard = $sourceParameters.put('space', $xcontext.macro.params.space)) #end -#if ("$!xcontext.macro.params.parent" != "") - #set ($extraParams = "$!{extraParams}&parent=$escapetool.url($xcontext.macro.params.parent)") +#if ("$!xcontext.macro.params.location" != "") + #set ($discard = $sourceParameters.put('location', $xcontext.macro.params.location)) #end -#if ("$!extraParams" != "") - #set($discard = $options.put('extraParams', $extraParams)) +#if ("$!xcontext.macro.params.parent" != "") + #set ($discard = $sourceParameters.put('parent', $xcontext.macro.params.parent)) #end +#set ($propertyDescriptors = []) #if(!$isGuest && $xcontext.macro.params.actions == "true") - #set($discard = $collist.add('_actions')) - #set($discard = $colprops.put('_actions', { - 'actions': ['copy', 'rename', 'rights', 'delete'], - 'filterable': false, - 'sortable': false - })) + #set ($discard = $propertyDescriptors.add({ 'id': '_actions', 'displayer': { 'id': 'actions', 'actions': ['copy', 'rename', 'rights', 'delete'] }})) + #set ($discard = $properties.add('_actions')) #end #if ("$!services.like" != "") - #set($discard = $collist.add('_likes')) ## We can't make it sortable or filterable right now since it's not stored in DB. - #set($discard = $colprops.put('_likes', { - 'filterable': false, - 'sortable': false - })) -#end -#if ($collist.contains('doc.location')) - #set ($discard = $options.put('selectedColumn','doc.location')) + #set ($discard = $propertyDescriptors.add({ 'id': '_likes', 'sortable': false, 'filterable': false })) + #set ($discard = $properties.add('_likes')) #end +#set ($liveDataConfig = {'meta': {'propertyDescriptors': $propertyDescriptors}}) #if ("$!xcontext.macro.params.id" != "") - #set ($livetableId = $xcontext.macro.params.id) + #set ($livedataId = $xcontext.macro.params.id) #else ## TODO: Improve this since we could have several livetables on the same page with same ids - #set ($livetableId = "documents-$mathtool.random(1, 1000)") + #set ($livedataId = "documents-$mathtool.random(1, 1000)") #end -#livetable($livetableId $collist $colprops $options) + +{{liveData + id="$livedataId" + properties="$stringtool.join($properties, ',')" + source="liveTable" + sourceParameters="$escapetool.url($sourceParameters)" + #if ($properties.contains('doc.location'))sort="doc.location"#end + #if ("$!xcontext.macro.params.count" != '')limit="$xcontext.macro.params.count"#end +}}$jsontool.serialize($liveDataConfig){{/liveData}} {{/velocity}}