Änderungen von Dokument Contributors
Zuletzt geändert von Daniel Herrmann am 2025/11/08 02:47
Von Version
9.1
bearbeitet von Daniel Herrmann
am 2025/09/20 09:55
am 2025/09/20 09:55
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.28.0]
Auf Version
8.1
bearbeitet von Daniel Herrmann
am 2025/09/20 09:54
am 2025/09/20 09:54
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.27.3]
Zusammenfassung
Details
- XWiki.WikiMacroClass[0]
-
- Makro-Code
-
... ... @@ -1,3 +1,20 @@ 1 +{{groovy output="false"}} 2 + xcontext.put("sortContributions", (contributions, key, reverse, limit) -> { 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 + if (limit != null && limit > 0) { 11 + return c.take(limit) 12 + } 13 + 14 + return c 15 + }) 16 +{{/groovy}} 17 + 1 1 {{velocity output="false"}} 2 2 #macro (datemax $d1 $d2) 3 3 #if ($d1.compareTo($d2))## ... ... @@ -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())) 128 + #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse, $mathtool.toInteger($limit))) 116 116 117 117 {{html clean=false}} 118 118 <div class="confluence-contributors">