Änderungen von Dokument Contributors

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

Von 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]
Auf Version 5.1
bearbeitet von xwikiadmin
am 2025/12/11 06:32
Änderungskommentar: Migrated property [executionIsolated] from class [XWiki.WikiMacroClass]

Zusammenfassung

Details

XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,3 +1,16 @@
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 +
1 1  {{velocity output="false"}}
2 2  #macro (datemax $d1 $d2)
3 3   #if ($d1.compareTo($d2))##
... ... @@ -7,7 +7,7 @@
7 7   #end
8 8  #end
9 9  #macro (showContribution $contribution)
10 - <a class="contributor-name" href="$escapetool.xml($xwiki.getURL($contribution['name']))">$xwiki.getUserName($contribution['name'], false)</a>
23 + <a class="contributor-name" href="$escapetool.xml($xwiki.getURL($contribution['name']))">$xwiki.getLocalUserName($contribution['name'])</a>
11 11   #if ($showCount)
12 12   <span class="contributor-contribution-count"> $contribution['count'] </span>
13 13   #end
... ... @@ -108,11 +108,7 @@
108 108   #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"))
109 109   #addContributions($query, $pages)
110 110   #end
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()))
124 + #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse))
116 116  
117 117  {{html clean=false}}
118 118   <div class="confluence-contributors">
... ... @@ -124,7 +124,7 @@
124 124   #foreach ($page in $pages)
125 125   #if (!$foreach.first), #end##
126 126   #set($d = $xwiki.getDocument($page))
127 - <a class="contributors-page" href="$escapetool.xml($d.getURL())">##
136 + <a href="$escapetool.xml($d.getURL())">##
128 128   #set($title = "$!d.getRenderedTitle($xwiki.currentContentSyntaxId)")
129 129   #if ($title != "")
130 130   $escapetool.xml($title)##
... ... @@ -150,7 +150,7 @@
150 150   </ul>
151 151   #else
152 152   #foreach($contribution in $contributions)
153 - #if(!$foreach.first),#end
162 + #if(!$foreach.first), #end
154 154   #showContribution($contribution)
155 155   #end
156 156   #end