Changes for page Contributors

Last modified by Yana Oksner on 2026/01/08 11:01

From version 5.1
edited by Yana Oksner
on 2025/04/30 10:28
Change comment: Migrated property [featureMandatory] from class [XWiki.WikiMacroParameterClass]
To version 3.1
edited by Yana Oksner
on 2024/04/08 11:44
Change comment: Install extension [com.xwiki.pro:xwiki-pro-macros/1.16.3]

Summary

Details

Page properties
Parent
... ... @@ -1,1 +1,1 @@
1 -WebHome
1 +Confluence.Macros.WebHome
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -28,8 +28,8 @@
28 28   <span class="contributor-last-contribution-date">($xwiki.formatDate($contribution['update']))</span>
29 29   #end
30 30  #end
31 -#macro (addContributions $query $pages)
32 - #foreach($r in $query.bindValue('d', $pages).execute())
31 +#macro (addContributions $query $page)
32 + #foreach($r in $query.bindValue('d', $page).execute())
33 33   #set($c = $contributors[$r[0]])
34 34   #if (!$c)
35 35   #set($contributors[$r[0]] = {"name": $r[0], "update": $r[1], "count": $r[2]})
... ... @@ -93,7 +93,7 @@
93 93   #else
94 94   #set($pages = $services.query.hql("select distinct doc.fullName from XWikiDocument doc where doc.space in :spaces and doc.fullName not like '%.WebPreferences' $hqlHiddenFilter $hqlOrder").bindValue('spaces', $spaces).execute())
95 95   #end
96 - #elseif ($scope == "descendents" || $scope == "descendants")
96 + #elseif ($scope == "descendents")
97 97   #set($pages = [])
98 98   #if ($global)
99 99   #set($pages = $services.query.xwql("select distinct doc.fullName from Document doc where doc.fullName not like '%.WebPreferences' $hqlHiddenFilter $hqlOrder").execute())
... ... @@ -103,18 +103,22 @@
103 103   #end
104 104   #end
105 105   #else
106 - FALLBACK
107 107   #set($pages = [$page])
108 108   #end
109 109   #set($contributors = {})
110 - #if ($include.contains('authors'))
111 - #set($query = $services.query.hql("select rcs.author, max(rcs.date), 1 from XWikiDocument doc, XWikiRCSNodeInfo rcs where doc.fullName in (:d) and doc.id = rcs.id.docId group by rcs.author"))
112 - #addContributions($query, $pages)
109 + #foreach ($page in $pages)
110 + #set($d = $xwiki.getDocument($page))
111 + #if (!$d.isNew())
112 + #if ($include.contains('authors'))
113 + #set($query = $services.query.hql("select rcs.author, max(rcs.date), 1 from XWikiDocument doc, XWikiRCSNodeInfo rcs where doc.fullName = :d and doc.id = rcs.id.docId group by rcs.author"))
114 + #addContributions($query, $page)
115 + #end
116 + #if ($include.contains('comments'))
117 + #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 = :d group by comment.author"))
118 + #addContributions($query, $page)
119 + #end
120 + #end
113 113   #end
114 - #if ($include.contains('comments'))
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 - #addContributions($query, $pages)
117 - #end
118 118   #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse))
119 119  
120 120  {{html clean=false}}
... ... @@ -172,7 +172,7 @@
172 172  ## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
173 173  ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
174 174  ## don't have view right on those pages.
175 -#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))
179 +#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
176 176   #executeMacro
177 177  #else
178 178   {{missingLicenseMessage extensionName="proMacros.extension.name"/}}