Änderungen von Dokument RecentlyUpdated
Zuletzt geändert von xwikiadmin am 2024/06/24 14:35
Von Version 4.1
bearbeitet von xwikiadmin
am 2024/06/24 14:35
am 2024/06/24 14:35
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.19.4]
Auf Version 3.1
bearbeitet von xwikiadmin
am 2023/10/26 09:38
am 2023/10/26 09:38
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros/1.12]
Zusammenfassung
-
Objekte (2 geändert, 0 hinzugefügt, 0 gelöscht)
Details
- XWiki.WikiMacroClass[0]
-
- Makro-Code
-
... ... @@ -8,6 +8,52 @@ 8 8 ## Parameter formatting macros 9 9 ## ----------------------------------------------------------------- 10 10 11 +## Format serialized comma-separated list coming from macro parameters 12 +## so that it can be used inside a solr filter query parameter 13 +## * Escape spaces inside values by wrapping them inside quotes, 14 +## making sure "+" and "-" filter modifiers stay outside the quotes 15 +## * Remove commas so that values are separated only by spaces 16 +#macro (formatSerializedList $serializedList $return) 17 + ## Wrap each value around quotes and replace commas by spaces 18 + ## (adds extra quotes / spaces at the beginning and end of the string) 19 + #set ($searchRegex = '(?:^|$|,)\s*([-+]?)') 20 + #set ($replacement = '" $1"') 21 + #if (!$serializedList) 22 + #set($serializedList = "") 23 + #end 24 + #set ($formatted = $serializedList.replace($searchRegex, $replacement)) 25 + ## Remove extra quotes / spaces at the beginning and end of the string 26 + #set ($formatted = $!stringtool.substring($formatted, 2, -2)) 27 + ## Return 28 + #set ($return = $NULL) 29 + #setVariable("$return" $formatted) 30 +#end 31 + 32 +## Format serialized comma-separated author list coming from macro parameters 33 +## Author format is different between comments and document metadata 34 +## ("xwiki:" wiki prefix is missing from comments author metadata), 35 +## so add both versions in the formatted serialized list 36 +#macro (formatSerializedAuthorList $serializedAuthorList $return) 37 + #set ($authorsList = []) 38 + #set ($splittedAuthorList = $!stringtool.split($serializedAuthorList, ',')) 39 + #foreach ($author in $splittedAuthorList) 40 + #set ($author = $!stringtool.strip($author)) 41 + #set ($modifier = '') 42 + #if ($author.startsWith('-')) 43 + #set ($modifier = '-') 44 + #set ($author = $author.substring(1)) 45 + #end 46 + #set ($resolvedAuthor = $services.model.resolveDocument($author)) 47 + #set ($discard = $authorsList.add("${modifier}${author}")) 48 + #set ($discard = $authorsList.add("${modifier}${services.model.serialize($resolvedAuthor, 'default')}")) 49 + #end 50 + #set ($authors = $!stringtool.join($authorsList, ',')) 51 + #formatSerializedList($authors, $authors) 52 + ## Return 53 + #set ($return = $NULL) 54 + #setVariable("$return" $authors) 55 +#end 56 + 11 11 ## Format serialized comma-separated types list coming from macro parameters 12 12 ## Return a list containing all the types of results that need to be displayed 13 13 #macro (parseTypes $serializedTypeList $return) ... ... @@ -54,7 +54,9 @@ 54 54 #end 55 55 56 56 ## Authors 57 - #set ($options.authors = "$!stringtool.strip($!wikimacro.parameters.author)") 103 + #set ($confluenceAuthorsString = "$!stringtool.strip($!wikimacro.parameters.author)") 104 + #formatSerializedAuthorList($confluenceAuthorsString, $authors) 105 + #set ($options.authors = $authors) 58 58 59 59 ## Wiki & Spaces 60 60 #set ($confluenceSpacesString = "$!stringtool.strip($!wikimacro.parameters.spaces)") ... ... @@ -65,7 +65,6 @@ 65 65 || $confluenceSpacesString.equals('@self') 66 66 ) 67 67 ## Search in current space 68 - ## Newly migrated content don't have @self, see https://jira.xwiki.org/projects/CONFLUENCE/issues/CONFLUENCE-236 69 69 #set ($options.spaces = $doc.space) 70 70 #elseif ( 71 71 $confluenceSpacesString.equals('@global') ... ... @@ -85,11 +85,14 @@ 85 85 #set ($options.wiki = $NULL) 86 86 #else 87 87 ## Search in specified spaces 88 - #set ($options.spaces = $confluenceSpacesString) 135 + #formatSerializedList($confluenceSpacesString, $spaces) 136 + #set ($options.spaces = $spaces) 89 89 #end 90 90 91 91 ## Tags 92 - #set ($options.tags = "$!stringtool.strip($!wikimacro.parameters.labels)") 140 + #set ($confluenceLabelString = "$!stringtool.strip($!wikimacro.parameters.labels)") 141 + #formatSerializedList($confluenceLabelString, $tags) 142 + #set ($options.tags = $tags) 93 93 94 94 ## Types 95 95 #set ($confluenceTypesString = "$!stringtool.strip($!wikimacro.parameters.types)") ... ... @@ -152,14 +152,18 @@ 152 152 #end 153 153 {{/velocity}} 154 154 205 +{{include reference="Licenses.Code.VelocityMacros"/}} 206 + 155 155 {{velocity}} 156 156 ## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right 157 157 ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that 158 158 ## don't have view right on those pages. 159 -#if ($services. promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))211 +#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference)) 160 160 #executeMacro 161 161 #else 162 - {{missingLicenseMessage extensionName="proMacros.extension.name"/}} 214 + {{error}} 215 + #getMissingLicenseMessage('proMacros.extension.name') 216 + {{/error}} 163 163 #end 164 164 {{/velocity}} 165 165 - Standardkategorie
-
... ... @@ -1,0 +1,1 @@ 1 +confluence
- XWiki.WikiMacroParameterClass[2]
-
- Parameter-Beschreibung
-
... ... @@ -1,1 +1,1 @@ 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 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.