From c821d6f0da1de98c3818980ea310bed501a7a66d Mon Sep 17 00:00:00 2001 From: Manuel Leduc Date: Tue, 30 Jan 2024 11:39:37 +0100 Subject: [PATCH] XWIKI-19041: Replace the Livetable from DocumentsMacro with a Live Data macro --- .../src/main/resources/Main/SpaceIndex.xml | 6 ++++-- .../src/main/resources/XWiki/DocumentsMacro.xml | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml index 4117b03ffa3f..88792c5c4ed6 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml @@ -45,11 +45,13 @@ ## Since we display the space index, we do not display page titles and locations, but the old columns name and space ## (old behavior consistent with this old macro)... +#set ($description = $services.localization.render('platform.index.spaceIndexDescription', [$space])) +#set ($description = $services.rendering.escape($description, 'xwiki/2.1')) {{documents - space="$space.replaceAll('["~]', '~$0')" + space="$services.rendering.escape($space, 'xwiki/2.1')" id="spaceindex" columns="doc.name,doc.space,doc.date,doc.author" - description="$services.localization.render('platform.index.spaceIndexDescription', [$space])" + description="$description" /}} #set($docextras=[]) {{/velocity}} 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 64113885b3fe..21d1a0bc0f19 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 @@ -297,14 +297,23 @@ Generates: #set ($livedataId = "documents-$mathtool.random(1, 1000)") #end +#set ($livedataId = $services.rendering.escape($livedataId, 'xwiki/2.1')) +#set ($description = '') +#if ("$!xcontext.macro.params.description" != '') + #set ($description = $services.rendering.escape($xcontext.macro.params.description, 'xwiki/2.1')) +#end +#set ($limit = '') +#if ("$!xcontext.macro.params.count" != '') + #set ($limit = $services.rendering.escape($xcontext.macro.params.count, 'xwiki/2.1')) +#end {{liveData id="$livedataId" properties="$stringtool.join($properties, ',')" source="liveTable" sourceParameters="$escapetool.url($sourceParameters)" - description="$!xcontext.macro.params.description" + #if ($description != '')description="$description"#end #if ($properties.contains('doc.location'))sort="doc.location"#end - #if ("$!xcontext.macro.params.count" != '')limit="$xcontext.macro.params.count"#end + #if ($limit != '')limit="$limit"#end }}$jsontool.serialize($liveDataConfig){{/liveData}} {{/velocity}} @@ -869,7 +878,7 @@ Generates: - Specifies the list of properties (e.g., "doc.name,doc.space"). If not specified then the default properties list of used ("doc.name,doc.space,doc.date,doc.author") + Specifies the list of properties (e.g., "doc.name,doc.space"). If not specified then the default properties list is used ("doc.name,doc.space,doc.date,doc.author") 0