From 0f9a4a1676d24405d5051337d38277b97f3daa2b Mon Sep 17 00:00:00 2001 From: Manuel Leduc Date: Wed, 17 Jan 2024 16:35:57 +0100 Subject: [PATCH] XWIKI-19041: Replace the Livetable from DocumentsMacro with a Live Data macro - definition of a description parameter for the documents macro - the generic description is not provided by default - no description provided for the page index - the text displayed before the space index table is now used as the description (also fix the alignemnt issue) - likes column now before the actions (i.e., actions always last) --- .../src/main/resources/Main/SpaceIndex.xml | 67 ++++- .../main/resources/XWiki/DocumentsMacro.xml | 229 ++++++++++++++++-- 2 files changed, 260 insertions(+), 36 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 167b0e0cecc4..4117b03ffa3f 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 @@ -37,12 +37,20 @@ xwiki/2.0 true {{velocity}} -#if("$!request.space" != "") #set($space=$request.space) #else #set($space = $doc.space) #end -$services.localization.render('platform.index.spaceIndexDescription', [$space]) +#if("$!request.space" != "") + #set($space=$request.space) +#else + #set($space = $doc.space) +#end ## 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)... -{{documents space="$space.replaceAll('["~]', '~$0')" id="spaceindex" columns="doc.name, doc.space, doc.date, doc.author"/}} +{{documents + space="$space.replaceAll('["~]', '~$0')" + id="spaceindex" + columns="doc.name,doc.space,doc.date,doc.author" + description="$services.localization.render('platform.index.spaceIndexDescription', [$space])" +/}} #set($docextras=[]) {{/velocity}} @@ -86,7 +94,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) |, 5 0 - action=Action|doc.reference=Document|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki + action=Action|doc.reference=Document|doc.revision|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.headers|request.parameters=Request parameters|request.remoteAddr|request.session|request.url=Request URL|request.wiki=Request wiki|sheet|user=User|wiki=Wiki com.xpn.xwiki.objects.classes.StaticListClass @@ -106,6 +114,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) code 10 Macro code + 0 20 40 0 @@ -118,6 +127,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) contentDescription 9 Content description (Not applicable for "No content" type) + 0 5 40 0 @@ -186,6 +196,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 3 Macro description + 0 5 40 0 @@ -377,6 +388,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 2 Parameter description + 0 5 40 0 @@ -402,13 +414,24 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -455,6 +478,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 2 Parameter description + 0 5 40 0 @@ -480,13 +504,24 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -533,6 +568,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 2 Parameter description + 0 5 40 0 @@ -558,13 +594,24 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass 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 55e12ada415b..64113885b3fe 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 @@ -83,7 +83,7 @@ Generates: |, 5 0 - action=Action|doc.reference=Document|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki + action=Action|doc.reference=Document|doc.revision|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.headers|request.parameters=Request parameters|request.remoteAddr|request.session|request.url=Request URL|request.wiki=Request wiki|sheet|user=User|wiki=Wiki com.xpn.xwiki.objects.classes.StaticListClass @@ -103,6 +103,7 @@ Generates: code 10 Macro code + 0 20 40 0 @@ -115,6 +116,7 @@ Generates: contentDescription 9 Content description (Not applicable for "No content" type) + 0 5 40 0 @@ -183,6 +185,7 @@ Generates: description 3 Macro description + 0 5 40 0 @@ -256,7 +259,7 @@ Generates: {{velocity}} -#if ("$!xcontext.macro.params.columns" != "") +#if ("$!xcontext.macro.params.columns" != "") #set ($properties = []) #foreach ($colname in $xcontext.macro.params.columns.split(',')) #set ($discard = $properties.add($colname.trim())) @@ -264,10 +267,10 @@ Generates: #else #set ($properties = ['doc.title', 'doc.location', 'doc.date', 'doc.author']) #end -#set ($sourceParameters = { +#set ($sourceParameters = { 'translationPrefix' : 'platform.index.' }) -#if ("$!xcontext.macro.params.space" != "") +#if ("$!xcontext.macro.params.space" != "") #set ($discard = $sourceParameters.put('space', $xcontext.macro.params.space)) #end #if ("$!xcontext.macro.params.location" != "") @@ -277,15 +280,15 @@ Generates: #set ($discard = $sourceParameters.put('parent', $xcontext.macro.params.parent)) #end #set ($propertyDescriptors = []) -#if(!$isGuest && $xcontext.macro.params.actions == "true") - #set ($discard = $propertyDescriptors.add({ 'id': '_actions', 'displayer': { 'id': 'actions', 'actions': ['copy', 'rename', 'rights', 'delete'] }})) - #set ($discard = $properties.add('_actions')) -#end #if ("$!services.like" != "") ## We can't make it sortable or filterable right now since it's not stored in DB. #set ($discard = $propertyDescriptors.add({ 'id': '_likes', 'sortable': false, 'filterable': false })) #set ($discard = $properties.add('_likes')) #end +#if(!$isGuest && $xcontext.macro.params.actions == "true") + #set ($discard = $propertyDescriptors.add({ 'id': '_actions', 'displayer': { 'id': 'actions', 'actions': ['copy', 'rename', 'rights', 'delete'] }})) + #set ($discard = $properties.add('_actions')) +#end #set ($liveDataConfig = {'meta': {'propertyDescriptors': $propertyDescriptors}}) #if ("$!xcontext.macro.params.id" != "") #set ($livedataId = $xcontext.macro.params.id) @@ -299,7 +302,7 @@ Generates: properties="$stringtool.join($properties, ',')" source="liveTable" sourceParameters="$escapetool.url($sourceParameters)" - description="This table lists documents found on this wiki based on passed criteria. The columns can be sorted and some can be filtered." + description="$!xcontext.macro.params.description" #if ($properties.contains('doc.location'))sort="doc.location"#end #if ("$!xcontext.macro.params.count" != '')limit="$xcontext.macro.params.count"#end }}$jsontool.serialize($liveDataConfig){{/liveData}} @@ -320,7 +323,7 @@ Generates: - Displays a list of documents in a Livetable + Displays a list of documents in a Live Data documents @@ -366,6 +369,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -391,13 +395,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -444,6 +459,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -469,13 +485,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -522,6 +549,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -547,13 +575,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -600,6 +639,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -625,20 +665,31 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass - Livetable id + Live Data id 0 @@ -678,6 +729,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -703,13 +755,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -756,6 +819,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -781,20 +845,31 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass - 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") + 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") 0 @@ -834,6 +909,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -859,13 +935,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -884,4 +971,94 @@ Generates: + + XWiki.DocumentsMacro + 7 + XWiki.WikiMacroParameterClass + 216587c3-ad5c-45aa-a379-3e016dc72268 + + XWiki.WikiMacroParameterClass + + + + + + + + + 0 + defaultValue + 4 + Parameter default value + 30 + 0 + com.xpn.xwiki.objects.classes.StringClass + + + 0 + description + 2 + Parameter description + 0 + 5 + 40 + 0 + com.xpn.xwiki.objects.classes.TextAreaClass + + + 0 + select + yesno + mandatory + 3 + Parameter mandatory + 0 + com.xpn.xwiki.objects.classes.BooleanClass + + + 0 + name + 1 + Parameter name + 30 + 0 + com.xpn.xwiki.objects.classes.StringClass + + + 0 + Unknown + 0 + input + allowed + 1 + 0 + type + 5 + 1 + Parameter type + 0 + | + | + 1 + 0 + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass + + + + + + + Provide a description of the list of documents + + + 0 + + + description + + + + +