Changes for page Contributors

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

From 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]
To version 4.1
edited by Yana Oksner
on 2024/12/03 16:51
Change comment: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.25.1]

Summary

Details

Page properties
Parent
... ... @@ -1,1 +1,1 @@
1 -Confluence.Macros.WebHome
1 +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 $page)
32 - #foreach($r in $query.bindValue('d', $page).execute())
31 +#macro (addContributions $query $pages)
32 + #foreach($r in $query.bindValue('d', $pages).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")
96 + #elseif ($scope == "descendents" || $scope == "descendants")
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,22 +103,18 @@
103 103   #end
104 104   #end
105 105   #else
106 + FALLBACK
106 106   #set($pages = [$page])
107 107   #end
108 108   #set($contributors = {})
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
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)
121 121   #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
122 122   #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse))
123 123  
124 124  {{html clean=false}}
... ... @@ -176,7 +176,7 @@
176 176  ## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
177 177  ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
178 178  ## don't have view right on those pages.
179 -#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
175 +#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))
180 180   #executeMacro
181 181  #else
182 182   {{missingLicenseMessage extensionName="proMacros.extension.name"/}}