Wiki-Quellcode von Top Contributors

Zuletzt geändert von Holger Engels am 2025/05/13 15:02

Verstecke letzte Bearbeiter
Holger Engels 1.1 1 {{velocity}}
2 ##
3 ## Define the scope: $top most active contributors in $group
4 ##
5 #set($group = "XWiki.XWikiAllGroup")
6 #set($top = 10)
7 #set($scope = "select prop.value from BaseObject obj, StringProperty prop where obj.className = 'XWiki.XWikiGroups' and obj.name = ? and prop.id.id = obj.id and prop.name = 'member'")
8 ##
9 ## Define the period: last $days days
10 ##
Holger Engels 2.1 11 #set($days = 100)
Holger Engels 1.1 12 #set($period = $xwiki.criteriaService.periodFactory.createSinceDaysPeriod($days))
13 #set($startDate = $util.getDate($xwiki.criteriaService.periodFactory.createDayPeriod($period.start).start))
14 #set($endDate = $util.getDate($xwiki.criteriaService.periodFactory.createDayPeriod($period.end).end))
15 ##
16 ## Retrieve the stats.
17 ##
18 #set($hql = "select vs.name, sum(vs.pageSaves) from VisitStats vs where ? <= vs.startDate and vs.endDate < ? and vs.pageSaves > 0 and vs.name in (${scope}) group by vs.name order by sum(vs.pageSaves) desc")
19 #set($stats = $context.xWiki.store.search($hql, $top, 0, [$startDate, $endDate, $group], $context.context))
20 ##
21 ## Display the stats.
22 ##
23 |=User|=Edits
24 #foreach($stat in $stats)
25 |$stat.get(0)|(% style="text-align:right;" %)$stat.get(1)
26 #end
27 {{/velocity}}
Holger Engels 2.1 28
29 {{velocity}}
30 #set($days = 100)
31 #set($period = $xwiki.criteriaService.periodFactory.createSinceDaysPeriod($days))
32 #set($startDate = $util.getDate($xwiki.criteriaService.periodFactory.createDayPeriod($period.start).start))
33
34 #set($hql = "select f.title, f.author from FeedEntryClass f where f.date > ?")
35 #set($stats = $context.xWiki.store.search($hql, $top, 0, [$startDate], $context.context))
36 ##
37 ## Display the stats.
38 ##
39 |=User|=Edits
40 #foreach($stat in $stats)
41 |$stat.get(0)|(% style="text-align:right;" %)$stat.get(1)
42 #end
43 {{/velocity}}
44