Änderungen von Dokument Contributors

Zuletzt geändert von xwikiadmin am 2025/01/07 11:39

Von Version 2.1
bearbeitet von xwikiadmin
am 2025/01/07 11:39
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.25.4]
Auf Version 1.1
bearbeitet von xwikiadmin
am 2024/06/24 14:35
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.19.4]

Zusammenfassung

Details

XWiki.WikiMacroClass[0]
Makro-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}}