Modifications pour le document RecentlyUpdated
Modifié par superadmin le 21/07/2025 - 08:55
Résumé
-
Propriétés de la Page (1 modifications, 0 ajouts, 0 suppressions)
-
Objets (4 modifications, 4 ajouts, 0 suppressions)
Détails
- Propriétés de la Page
-
- Contenu
-
... ... @@ -6,17 +6,20 @@ 6 6 = Parameters = 7 7 8 8 |=Parameter|=Description|=Required|=Default 9 -|**types**|Comma-separated list of types ({{{ page }}}, {{{ blogpost }}}, {{{ comment }}} or {{{ attachment }}}), possibly prefixed with "-".|No|//all types// 10 -|**spaces**|Comma-separated list of spaces, possibly prefixed with "+" or "-", or special value like {{{ @self }}}, {{{ @global }}} or {{{ @all }}}.|No|{{{ @self }}} 11 -|**author**|Comma-separated list of authors.|No| 12 -|**labels**|Comma-separated list of tags, possibly prefixed with "+" or "-".|No| 9 +|**types**|Select one or multiple content types. The macro will display only the content of the type you specify here.|No|//all types// 10 +|**spaces**|Select one or multiple spaces. The macro will display only the documents present in the selected spaces.|No|{{{@self}}} 11 +|**author**|Comma-separated list of authors.|No| 12 +|**labels**|Comma-separated list of tags.|No| 13 +|**excludedLabels**|Comma-separated list of tags.|No| 13 13 |**max**|Maximum number of results.|No| {{{ 15 }}} 14 14 |**theme**|Appearance of the macro ({{{ concise }}}, {{{ social }}}, {{{ sidebar }}}).|No| {{{ concise }}} 15 15 |**width**|Width of the macro in percentage.|No| {{{ 100% }}} 16 16 |**hideHeading**|Whether to hide the text "Recently Updated" as title|No| {{{ false }}} 17 17 |**showProfilePic**|Whether to show the profile picture of users|No| {{{ false }}} 19 +|**currentWiki**|If this parameter is selected then the spaces & excluded spaces parameters are ignored and the macro will display the documents from the current wiki.|No| {{{ false}}} 20 +|**excludedSpaces**|Select one or multiple spaces. The macro will not display the documents present in the selected spaces.|No| 21 +|**global**|If this parameter is selected then spaces, excluded spaces and the current wiki parameters are ignored and the macro will display the documents from the current wiki and subwikis. |No| {{{ false}}} 18 18 19 - 20 20 = Example Usage = 21 21 22 22 {{code}}
- XWiki.WikiMacroClass[0]
-
- Code de la macro
-
... ... @@ -43,6 +43,60 @@ 43 43 #setVariable("$return" $types) 44 44 #end 45 45 46 +## Creates the final space parameter. ConfluenceSpaces comes from migreations and is a mix of prefixed(+/-) spaces and excludedSpaces comes 47 +## from XWiki and are the spaces that should be excluded when doing the solr query. 48 +#macro (constructSpaceParameter $confluenceSpaces, $excludedSpaces) 49 + #set ($exclude = "") 50 + #foreach ($excludedSpace in $excludedSpaces.split(",")) 51 + #if (!$excludedSpace.trim().isBlank()) 52 + #if ($foreach.first) 53 + #set ($exclude = "-$excludedSpace") 54 + #else 55 + #set ($exclude = "$exclude,-$excludedSpace") 56 + #end 57 + #end 58 + #end 59 + #if (!$confluenceSpaces.trim().isEmpty() && !$exclude.trim().isEmpty()) 60 + #set ($finalSpace = "${confluenceSpaces},${exclude}") 61 + #elseif(!$confluenceSpaces.trim().isEmpty()) 62 + #set ($finalSpace = $confluenceSpaces) 63 + #else 64 + #set ($finalSpace = $exclude) 65 + #end 66 +#end 67 + 68 +## Determine if the search should be done in the currentWiki, globally or only on specific spaces. 69 +#macro (determinateSpaceScope $confluenceSpacesString) 70 + ## If the global parameter is marked then we set the search to everywhere, if the currentWiki is marked then we select the current wiki 71 + ## otherwise we just the actual space selected. 72 + #if ($xcontext.macro.params.global == "true") 73 + #set ($confluenceSpacesString = '@all') 74 + #elseif ($xcontext.macro.params.currentWiki == "true") 75 + #set ($confluenceSpacesString = '@global') 76 + #end 77 +#end 78 + 79 +## Handles the construction of the tags parameter. 80 +#macro (constructTagsParameter $confluenceTags, $excludedTags) 81 + #set ($exclude = "") 82 + #foreach ($excludedSpace in $excludedTags.split(",")) 83 + #if (!$excludedSpace.trim().isBlank()) 84 + #if ($foreach.first) 85 + #set ($exclude = "-$excludedSpace") 86 + #else 87 + #set ($exclude = "$exclude,-$excludedSpace") 88 + #end 89 + #end 90 + #end 91 + #if (!$confluenceTags.trim().isEmpty() && !$exclude.trim().isEmpty()) 92 + #set ($finalTags = "${confluenceTags},${exclude}") 93 + #elseif (!$confluenceTags.trim().isEmpty()) 94 + #set ($finalTags = $confluenceTags) 95 + #else 96 + #set ($finalTags = $exclude) 97 + #end 98 +#end 99 + 46 46 ## Init options from macro parameters 47 47 #macro (initOptionsFromParameters $return) 48 48 ## Gather every parameter in an option object that will be returned ... ... @@ -56,9 +56,11 @@ 56 56 ## Authors 57 57 #set ($options.authors = "$!stringtool.strip($!stringtool.join($!wikimacro.parameters.author, ','))") 58 58 ## Wiki & Spaces 59 - #set ($confluenceSpacesString = "$!stringtool.strip($!wikimacro.parameters.spaces)") 113 + #set ($excludedSpaces = "$!xcontext.macro.params.excludedSpaces") 114 + #set ($confluenceSpacesString = "$!stringtool.strip($!xcontext.macro.params.spaces)") 60 60 #set ($options.spaces = $NULL) 61 61 #set ($options.wiki = $doc.wiki) 117 + #determinateSpaceScope($confluenceSpacesString) 62 62 #if ( 63 63 $confluenceSpacesString.equals('') 64 64 || $confluenceSpacesString.equals('@self') ... ... @@ -84,14 +84,16 @@ 84 84 #set ($options.wiki = $NULL) 85 85 #else 86 86 ## Search in specified spaces 87 - #set ($options.spaces = $confluenceSpacesString) 143 + #constructSpaceParameter($confluenceSpacesString, $excludedSpaces) 144 + #set ($options.spaces = $finalSpace) 88 88 #end 89 89 90 90 ## Tags 91 - #set ($options.tags = "$!stringtool.strip($!wikimacro.parameters.labels)") 148 + #constructTagsParameter("$!stringtool.strip($!xcontext.macro.params.labels)", "$!stringtool.strip($!xcontext.macro.params.excludedLabels)") 149 + #set ($options.tags = $finalTags) 92 92 93 93 ## Types 94 - #set ($confluenceTypesString = "$!stringtool.strip($! wikimacro.parameters.types)")152 + #set ($confluenceTypesString = "$!stringtool.strip($!xcontext.macro.params.types)") 95 95 #parseTypes($confluenceTypesString, $types) 96 96 #set ($options.types = $types) 97 97
- XWiki.WikiMacroParameterClass[1]
-
- Type du paramètre
-
... ... @@ -1,1 +1,1 @@ 1 - java.lang.String1 +com.xwiki.pickers.SuggestSpacesReference
- XWiki.WikiMacroParameterClass[2]
-
- Description du paramètre
-
... ... @@ -1,1 +1,0 @@ 1 -Filter the results by label. The macro will display only the pages etc which are tagged with the label(s) you specify here. You can specify one or more label values, separated by a comma or a space. To exclude content which matches a given label, put a minus sign (-) immediately in front of that label value. For example: If you specify a label value of -badpage you will get only content which is not labeled with 'badpage'. To indicate that the results** **must match a given label value, put a plus sign (+) immediately in front of that label value. For example: If you specify a label value of +superpage,+goodpage you will get only content which has at least two labels, being 'superpage' and 'goodpage'. The labels parameter only applies to the page and blog content types. - Type du paramètre
-
... ... @@ -1,1 +1,1 @@ 1 - java.lang.String1 +com.xwiki.pickers.TagsReference
- XWiki.WikiMacroParameterClass[4]
-
- Description du paramètre
-
... ... @@ -1,1 +1,0 @@ 1 -This parameter allows you to filter content by content type. The macro will display only the content of the type you specify here. You can specify one or more types, separated by a comma or a space. To exclude content of a given content type, put a minus sign (-) immediately in front of that content type. For example: If you specify a content type of -blogpost you will get pages and all other content except for blog posts. Available values: "page" - documents, "blogpost" or "news" - blogpost documents, "comment" - comments on documents, "attachment" - attachments - Type du paramètre
-
... ... @@ -1,1 +1,1 @@ 1 - java.lang.String1 +com.xwiki.pickers.recentlyupdated.RecentlyUpdateType
- XWiki.WikiMacroParameterClass[9]
-
- Nom du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +excludedLabels - Type du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +com.xwiki.pickers.TagsReference
- XWiki.WikiMacroParameterClass[10]
-
- Valeur par défaut du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +false - Paramètre obligatoire
-
... ... @@ -1,0 +1,1 @@ 1 +Non - Nom du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +global - Type du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +java.lang.Boolean
- XWiki.WikiMacroParameterClass[11]
-
- Valeur par défaut du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +false - Paramètre obligatoire
-
... ... @@ -1,0 +1,1 @@ 1 +Non - Nom du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +currentWiki - Type du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +java.lang.Boolean
- XWiki.WikiMacroParameterClass[12]
-
- Nom du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +excludedSpaces - Type du paramètre
-
... ... @@ -1,0 +1,1 @@ 1 +com.xwiki.pickers.SuggestSpacesReference