Änderungen von Dokument Contributors

Zuletzt geändert von xwikiadmin am 2025/12/11 07:49

Von Version 3.1
bearbeitet von xwikiadmin
am 2025/05/21 09:23
Änderungskommentar: Migrated property [feature] from class [XWiki.WikiMacroParameterClass]
Auf Version 6.1
bearbeitet von xwikiadmin
am 2025/12/11 07:49
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.28.5]

Zusammenfassung

Details

XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,16 +14,3 @@
1 -{{groovy output="false"}}
2 - xcontext.put("sortContributions", (contributions, key, reverse) -> {
3 - def c = new ArrayList(contributions)
4 - Collections.sort(c, new Comparator<HashMap>() {
5 - @Override
6 - public int compare(HashMap<String, Object> v1, HashMap<String, Object> v2) {
7 - return reverse ? v2.get(key).compareTo(v1.get(key)) : v1.get(key).compareTo(v2.get(key))
8 - }
9 - })
10 - return c
11 - })
12 -{{/groovy}}
13 -
14 14  {{velocity output="false"}}
15 15  #macro (datemax $d1 $d2)
16 16   #if ($d1.compareTo($d2))##
... ... @@ -20,7 +20,7 @@
20 20   #end
21 21  #end
22 22  #macro (showContribution $contribution)
23 - <a class="contributor-name" href="$escapetool.xml($xwiki.getURL($contribution['name']))">$xwiki.getLocalUserName($contribution['name'])</a>
10 + <a class="contributor-name" href="$escapetool.xml($xwiki.getURL($contribution['name']))">$xwiki.getUserName($contribution['name'], false)</a>
24 24   #if ($showCount)
25 25   <span class="contributor-contribution-count"> $contribution['count'] </span>
26 26   #end
... ... @@ -42,12 +42,12 @@
42 42   #end
43 43  #end
44 44  #macro (executeMacro)
45 - #set($include = "$!wikimacro.parameters.get('include')")
46 - #set($include = $include.split("\s*,\s*"))
32 + #set ($include = "$!xcontext.macro.params.include")
33 + #set ($include = $include.split("\s*,\s*"))
47 47   #if ($include.isEmpty())
48 48   #set($include = ["authors"]) ## Other supported values: "comments", "labels", "watches"
49 49   #end
50 - #set($order = "$!wikimacro.parameters.get('order')")
37 + #set ($order = "$!xcontext.macro.params.order")
51 51   #if ($order.isEmpty())
52 52   #set ($order = "count")
53 53   #end
... ... @@ -58,7 +58,7 @@
58 58   #else
59 59   #set($limit = $numbertool.toNumber($limit))
60 60   #end
61 - #set($isList = "$!wikimacro.parameters.get('mode')" == "list")
48 + #set ($isList = "$!xcontext.macro.params.mode" == "list")
62 62   #set($showCount = "$!wikimacro.parameters.get('showCount')" == "true" || "$!wikimacro.parameters.get('showCount')" == "1")
63 63   #set($showLastTime = "$!wikimacro.parameters.get('showLastTime')" == "true" || "$!wikimacro.parameters.get('showLastTime')" == "1")
64 64   #set($showPages = "$!wikimacro.parameters.get('showPages')" == "true" || "$!wikimacro.parameters.get('showPages')" == "1")
... ... @@ -66,8 +66,15 @@
66 66   #if ($noneFoundMessage.isEmpty())
67 67   #set($noneFoundMessage = "$services.localization.render('confluence.nonefound')")
68 68   #end
69 - #set($scope = "$!wikimacro.parameters.get('scope')")
70 - #set($spaces = "$!wikimacro.parameters.get('spaces')")
56 + #set ($scope = "$!xcontext.macro.params.scope")
57 + #if ($scope == 'specified')
58 + #set ($scope = "")
59 + #end
60 + ## TODO When https://jira.xwiki.org/browse/XWIKI-18965 is fixed move back to the newer $wikimacro API
61 + #set ($spaces = "$!xcontext.macro.params.spaces")
62 + #if ($xcontext.macro.params.global != 'false')
63 + #set ($spaces = "@ALL")
64 + #end
71 71   #set($global = $spaces.contains("@ALL") || $spaces.contains("@global"))
72 72   #set($page = "$!wikimacro.parameters.get('page')")
73 73   #if ($page.isEmpty())
... ... @@ -103,7 +103,6 @@
103 103   #end
104 104   #end
105 105   #else
106 - FALLBACK
107 107   #set($pages = [$page])
108 108   #end
109 109   #set($contributors = {})
... ... @@ -115,7 +115,11 @@
115 115   #set($query = $services.query.xwql("select comment.author, max(comment.date), count(distinct comment) from Document doc, doc.object('XWiki.XWikiComments') comment where doc.fullName in (:d) group by comment.author"))
116 116   #addContributions($query, $pages)
117 117   #end
118 - #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse))
111 + #set ($limit = $numbertool.toNumber($limit).intValue())
112 + #if (!$limit)
113 + #set ($limit = -1)
114 + #end
115 + #set ($contributions = $services.contributors.sortContributors($contributors.values(), $order, $reverse, $numbertool.toNumber($limit).intValue()))
119 119  
120 120  {{html clean=false}}
121 121   <div class="confluence-contributors">
... ... @@ -127,7 +127,7 @@
127 127   #foreach ($page in $pages)
128 128   #if (!$foreach.first), #end##
129 129   #set($d = $xwiki.getDocument($page))
130 - <a href="$escapetool.xml($d.getURL())">##
127 + <a class="contributors-page" href="$escapetool.xml($d.getURL())">##
131 131   #set($title = "$!d.getRenderedTitle($xwiki.currentContentSyntaxId)")
132 132   #if ($title != "")
133 133   $escapetool.xml($title)##
... ... @@ -153,7 +153,7 @@
153 153   </ul>
154 154   #else
155 155   #foreach($contribution in $contributions)
156 - #if(!$foreach.first), #end
153 + #if(!$foreach.first),#end
157 157   #showContribution($contribution)
158 158   #end
159 159   #end
Makrobeschreibung
... ... @@ -1,1 +1,0 @@
1 -Contributors Confluence Bridge macro to show the contributors of a given document.
Default categories
... ... @@ -1,0 +1,1 @@
1 +Content
XWiki.WikiMacroParameterClass[0]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -kind of contributions to include ("authors", "comment")
Parameter-Typ
... ... @@ -1,0 +1,1 @@
1 +com.xwiki.pickers.contributors.Include
XWiki.WikiMacroParameterClass[1]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Which order to use
Parameter-Typ
... ... @@ -1,0 +1,1 @@
1 +com.xwiki.pickers.contributors.Order
XWiki.WikiMacroParameterClass[2]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Should the order be reversed?
XWiki.WikiMacroParameterClass[3]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Maximum number of contributions to show
XWiki.WikiMacroParameterClass[4]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Display as bullet list ("list") or as comma-separated sentence ("inline")
Parameter-Typ
... ... @@ -1,0 +1,1 @@
1 +com.xwiki.pickers.contributors.Mode
XWiki.WikiMacroParameterClass[5]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -should the number of contributions per authors be shown?
XWiki.WikiMacroParameterClass[6]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Should the time of the last contribution be shown?
XWiki.WikiMacroParameterClass[7]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Which page to show? (by default, the current one)
XWiki.WikiMacroParameterClass[8]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Which spaces to show?
Parameter-Typ
... ... @@ -1,0 +1,1 @@
1 +com.xwiki.pickers.SuggestSpacesReference
XWiki.WikiMacroParameterClass[9]
Parameter-Vorgabe
... ... @@ -1,0 +1,1 @@
1 +specified
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -show the selected pages only (leave empty), their direct children ("children"), or all children ("descendents")
Parameter-Typ
... ... @@ -1,0 +1,1 @@
1 +com.xwiki.pickers.contributors.Scope
XWiki.WikiMacroParameterClass[10]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Should the list of used pages be shown?
XWiki.WikiMacroParameterClass[11]
Parameter-Beschreibung
... ... @@ -1,1 +1,0 @@
1 -Message to show when pages are not shown
XWiki.WikiMacroParameterClass[12]
Parameter-Vorgabe
... ... @@ -1,0 +1,1 @@
1 +false
Parameter-Name
... ... @@ -1,0 +1,1 @@
1 +global
Parameter-Typ
... ... @@ -1,0 +1,1 @@
1 +java.lang.Boolean
Parameter verpflichtend
... ... @@ -1,0 +1,1 @@
1 +Nein