Änderungen von Dokument Contributors

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

Von Version 5.1
bearbeitet von xwikiadmin
am 2025/12/11 06:32
Änderungskommentar: Migrated property [executionIsolated] from class [XWiki.WikiMacroClass]
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
... ... @@ -121,7 +121,11 @@
121 121   #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"))
122 122   #addContributions($query, $pages)
123 123   #end
124 - #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()))
125 125  
126 126  {{html clean=false}}
127 127   <div class="confluence-contributors">
... ... @@ -133,7 +133,7 @@
133 133   #foreach ($page in $pages)
134 134   #if (!$foreach.first), #end##
135 135   #set($d = $xwiki.getDocument($page))
136 - <a href="$escapetool.xml($d.getURL())">##
127 + <a class="contributors-page" href="$escapetool.xml($d.getURL())">##
137 137   #set($title = "$!d.getRenderedTitle($xwiki.currentContentSyntaxId)")
138 138   #if ($title != "")
139 139   $escapetool.xml($title)##
... ... @@ -159,7 +159,7 @@
159 159   </ul>
160 160   #else
161 161   #foreach($contribution in $contributions)
162 - #if(!$foreach.first), #end
153 + #if(!$foreach.first),#end
163 163   #showContribution($contribution)
164 164   #end
165 165   #end