Changes for page Contributors

Last modified by Frank Fock on 2026/04/03 11:52

From version 4.1
edited by Frank Fock
on 2025/04/04 21:18
Change comment: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.26.14]
To version 2.1
edited by Frank Fock
on 2024/05/23 17:17
Change comment: Install extension [com.xwiki.pro:xwiki-pro-macros/1.17.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]})
... ... @@ -42,12 +42,12 @@
42 42   #end
43 43  #end
44 44  #macro (executeMacro)
45 - #set ($include = "$!xcontext.macro.params.include")
46 - #set ($include = $include.split("\s*,\s*"))
45 + #set($include = "$!wikimacro.parameters.get('include')")
46 + #set($include = $include.split("\s*,\s*"))
47 47   #if ($include.isEmpty())
48 48   #set($include = ["authors"]) ## Other supported values: "comments", "labels", "watches"
49 49   #end
50 - #set ($order = "$!xcontext.macro.params.order")
50 + #set($order = "$!wikimacro.parameters.get('order')")
51 51   #if ($order.isEmpty())
52 52   #set ($order = "count")
53 53   #end
... ... @@ -58,7 +58,7 @@
58 58   #else
59 59   #set($limit = $numbertool.toNumber($limit))
60 60   #end
61 - #set ($isList = "$!xcontext.macro.params.mode" == "list")
61 + #set($isList = "$!wikimacro.parameters.get('mode')" == "list")
62 62   #set($showCount = "$!wikimacro.parameters.get('showCount')" == "true" || "$!wikimacro.parameters.get('showCount')" == "1")
63 63   #set($showLastTime = "$!wikimacro.parameters.get('showLastTime')" == "true" || "$!wikimacro.parameters.get('showLastTime')" == "1")
64 64   #set($showPages = "$!wikimacro.parameters.get('showPages')" == "true" || "$!wikimacro.parameters.get('showPages')" == "1")
... ... @@ -66,15 +66,8 @@
66 66   #if ($noneFoundMessage.isEmpty())
67 67   #set($noneFoundMessage = "$services.localization.render('confluence.nonefound')")
68 68   #end
69 - #set ($scope = "$!xcontext.macro.params.scope")
70 - #if ($scope == 'specified')
71 - #set ($scope = "")
72 - #end
73 - ## TODO When https://jira.xwiki.org/browse/XWIKI-18965 is fixed move back to the newer $wikimacro API
74 - #set ($spaces = "$!xcontext.macro.params.spaces")
75 - #if ($xcontext.macro.params.global != 'false')
76 - #set ($spaces = "@ALL")
77 - #end
69 + #set($scope = "$!wikimacro.parameters.get('scope')")
70 + #set($spaces = "$!wikimacro.parameters.get('spaces')")
78 78   #set($global = $spaces.contains("@ALL") || $spaces.contains("@global"))
79 79   #set($page = "$!wikimacro.parameters.get('page')")
80 80   #if ($page.isEmpty())
... ... @@ -100,7 +100,7 @@
100 100   #else
101 101   #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())
102 102   #end
103 - #elseif ($scope == "descendents" || $scope == "descendants")
96 + #elseif ($scope == "descendents")
104 104   #set($pages = [])
105 105   #if ($global)
106 106   #set($pages = $services.query.xwql("select distinct doc.fullName from Document doc where doc.fullName not like '%.WebPreferences' $hqlHiddenFilter $hqlOrder").execute())
... ... @@ -113,14 +113,19 @@
113 113   #set($pages = [$page])
114 114   #end
115 115   #set($contributors = {})
116 - #if ($include.contains('authors'))
117 - #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"))
118 - #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
119 119   #end
120 - #if ($include.contains('comments'))
121 - #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"))
122 - #addContributions($query, $pages)
123 - #end
124 124   #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse))
125 125  
126 126  {{html clean=false}}
... ... @@ -178,7 +178,7 @@
178 178  ## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
179 179  ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
180 180  ## don't have view right on those pages.
181 -#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))
179 +#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
182 182   #executeMacro
183 183  #else
184 184   {{missingLicenseMessage extensionName="proMacros.extension.name"/}}
Default categories
... ... @@ -1,1 +1,0 @@
1 -Content
Macro description
... ... @@ -1,0 +1,1 @@
1 +Contributors Confluence Bridge macro to show the contributors of a given document.
XWiki.WikiMacroParameterClass[0]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +kind of contributions to include ("authors", "comment")
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.pickers.contributors.Include
XWiki.WikiMacroParameterClass[1]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Which order to use
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.pickers.contributors.Order
XWiki.WikiMacroParameterClass[2]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Should the order be reversed?
XWiki.WikiMacroParameterClass[3]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Maximum number of contributions to show
XWiki.WikiMacroParameterClass[4]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Display as bullet list ("list") or as comma-separated sentence ("inline")
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.pickers.contributors.Mode
XWiki.WikiMacroParameterClass[5]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +should the number of contributions per authors be shown?
XWiki.WikiMacroParameterClass[6]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Should the time of the last contribution be shown?
XWiki.WikiMacroParameterClass[7]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Which page to show? (by default, the current one)
XWiki.WikiMacroParameterClass[8]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Which spaces to show?
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.pickers.SuggestSpacesReference
XWiki.WikiMacroParameterClass[9]
Parameter default value
... ... @@ -1,1 +1,0 @@
1 -specified
Parameter description
... ... @@ -1,0 +1,1 @@
1 +show the selected pages only (leave empty), their direct children ("children"), or all children ("descendents")
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.pickers.contributors.Scope
XWiki.WikiMacroParameterClass[10]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Should the list of used pages be shown?
XWiki.WikiMacroParameterClass[11]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Message to show when pages are not shown
XWiki.WikiMacroParameterClass[12]
Parameter default value
... ... @@ -1,1 +1,0 @@
1 -false
Parameter mandatory
... ... @@ -1,1 +1,0 @@
1 -No
Parameter name
... ... @@ -1,1 +1,0 @@
1 -global
Parameter type
... ... @@ -1,1 +1,0 @@
1 -java.lang.Boolean