Änderungen von Dokument Contributors

Zuletzt geändert von Daniel Herrmann am 2025/11/08 02:47

Von Version Icon 5.1 Icon
bearbeitet von Daniel Herrmann
am 2025/06/23 21:15
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.27.0]
Auf Version Icon 10.1
bearbeitet von Daniel Herrmann
am 2025/11/08 02:47
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.28.4]

Zusammenfassung

Details

Icon XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,20 +18,3 @@
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 -
18 18  {{velocity output="false"}}
19 19  #macro (datemax $d1 $d2)
20 20   #if ($d1.compareTo($d2))##
... ... @@ -24,7 +24,7 @@
24 24   #end
25 25  #end
26 26  #macro (showContribution $contribution)
27 - <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>
28 28   #if ($showCount)
29 29   <span class="contributor-contribution-count"> $contribution['count'] </span>
30 30   #end
... ... @@ -125,7 +125,11 @@
125 125   #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"))
126 126   #addContributions($query, $pages)
127 127   #end
128 - #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse, $mathtool.toInteger($limit)))
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()))
129 129  
130 130  {{html clean=false}}
131 131   <div class="confluence-contributors">
... ... @@ -137,7 +137,7 @@
137 137   #foreach ($page in $pages)
138 138   #if (!$foreach.first), #end##
139 139   #set($d = $xwiki.getDocument($page))
140 - <a href="$escapetool.xml($d.getURL())">##
127 + <a class="contributors-page" href="$escapetool.xml($d.getURL())">##
141 141   #set($title = "$!d.getRenderedTitle($xwiki.currentContentSyntaxId)")
142 142   #if ($title != "")
143 143   $escapetool.xml($title)##
... ... @@ -163,7 +163,7 @@
163 163   </ul>
164 164   #else
165 165   #foreach($contribution in $contributions)
166 - #if(!$foreach.first), #end
153 + #if(!$foreach.first),#end
167 167   #showContribution($contribution)
168 168   #end
169 169   #end
... ... @@ -182,7 +182,7 @@
182 182  ## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
183 183  ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
184 184  ## don't have view right on those pages.
185 -#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
172 +#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))
186 186   #executeMacro
187 187  #else
188 188   {{missingLicenseMessage extensionName="proMacros.extension.name"/}}