Änderungen von Dokument Contributors
Zuletzt geändert von xwikiadmin am 2025/12/11 07:47
Von Version 6.1
bearbeitet von xwikiadmin
am 2025/12/11 07:47
am 2025/12/11 07:47
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.28.5]
Auf Version 1.1
bearbeitet von xwikiadmin
am 2024/06/24 15:09
am 2024/06/24 15:09
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.19.4]
Zusammenfassung
-
Objekte (13 geändert, 0 hinzugefügt, 1 gelöscht)
- XWiki.WikiMacroClass[0]
- XWiki.WikiMacroParameterClass[0]
- XWiki.WikiMacroParameterClass[1]
- XWiki.WikiMacroParameterClass[2]
- XWiki.WikiMacroParameterClass[3]
- XWiki.WikiMacroParameterClass[4]
- XWiki.WikiMacroParameterClass[5]
- XWiki.WikiMacroParameterClass[6]
- XWiki.WikiMacroParameterClass[7]
- XWiki.WikiMacroParameterClass[8]
- XWiki.WikiMacroParameterClass[9]
- XWiki.WikiMacroParameterClass[10]
- XWiki.WikiMacroParameterClass[11]
- XWiki.WikiMacroParameterClass[12]
Details
- XWiki.WikiMacroClass[0]
-
- Makro-Code
-
... ... @@ -1,3 +1,16 @@ 1 +{{groovy output="false"}} 2 + xcontext.put("sortContributions", (contributions, key, reverse) -> { 3 + def c = new ArrayList(contributions) 4 + Collections.sort(c, new Comparator<HashMap>() { 5 + @Override 6 + public int compare(HashMap<String, Object> v1, HashMap<String, Object> v2) { 7 + return reverse ? v2.get(key).compareTo(v1.get(key)) : v1.get(key).compareTo(v2.get(key)) 8 + } 9 + }) 10 + return c 11 + }) 12 +{{/groovy}} 13 + 1 1 {{velocity output="false"}} 2 2 #macro (datemax $d1 $d2) 3 3 #if ($d1.compareTo($d2))## ... ... @@ -7,7 +7,7 @@ 7 7 #end 8 8 #end 9 9 #macro (showContribution $contribution) 10 - <a class="contributor-name" href="$escapetool.xml($xwiki.getURL($contribution['name']))">$xwiki.getUserName($contribution['name'] , false)</a>23 + <a class="contributor-name" href="$escapetool.xml($xwiki.getURL($contribution['name']))">$xwiki.getLocalUserName($contribution['name'])</a> 11 11 #if ($showCount) 12 12 <span class="contributor-contribution-count"> $contribution['count'] </span> 13 13 #end ... ... @@ -15,8 +15,8 @@ 15 15 <span class="contributor-last-contribution-date">($xwiki.formatDate($contribution['update']))</span> 16 16 #end 17 17 #end 18 -#macro (addContributions $query $page s)19 - #foreach($r in $query.bindValue('d', $page s).execute())31 +#macro (addContributions $query $page) 32 + #foreach($r in $query.bindValue('d', $page).execute()) 20 20 #set($c = $contributors[$r[0]]) 21 21 #if (!$c) 22 22 #set($contributors[$r[0]] = {"name": $r[0], "update": $r[1], "count": $r[2]}) ... ... @@ -29,12 +29,12 @@ 29 29 #end 30 30 #end 31 31 #macro (executeMacro) 32 - #set ($include = "$!xcontext.macro.params.include")33 - #set ($include = $include.split("\s*,\s*"))45 + #set($include = "$!wikimacro.parameters.get('include')") 46 + #set($include = $include.split("\s*,\s*")) 34 34 #if ($include.isEmpty()) 35 35 #set($include = ["authors"]) ## Other supported values: "comments", "labels", "watches" 36 36 #end 37 - #set ($order = "$!xcontext.macro.params.order")50 + #set($order = "$!wikimacro.parameters.get('order')") 38 38 #if ($order.isEmpty()) 39 39 #set ($order = "count") 40 40 #end ... ... @@ -45,7 +45,7 @@ 45 45 #else 46 46 #set($limit = $numbertool.toNumber($limit)) 47 47 #end 48 - #set ($isList = "$!xcontext.macro.params.mode" == "list")61 + #set($isList = "$!wikimacro.parameters.get('mode')" == "list") 49 49 #set($showCount = "$!wikimacro.parameters.get('showCount')" == "true" || "$!wikimacro.parameters.get('showCount')" == "1") 50 50 #set($showLastTime = "$!wikimacro.parameters.get('showLastTime')" == "true" || "$!wikimacro.parameters.get('showLastTime')" == "1") 51 51 #set($showPages = "$!wikimacro.parameters.get('showPages')" == "true" || "$!wikimacro.parameters.get('showPages')" == "1") ... ... @@ -53,15 +53,8 @@ 53 53 #if ($noneFoundMessage.isEmpty()) 54 54 #set($noneFoundMessage = "$services.localization.render('confluence.nonefound')") 55 55 #end 56 - #set ($scope = "$!xcontext.macro.params.scope") 57 - #if ($scope == 'specified') 58 - #set ($scope = "") 59 - #end 60 - ## TODO When https://jira.xwiki.org/browse/XWIKI-18965 is fixed move back to the newer $wikimacro API 61 - #set ($spaces = "$!xcontext.macro.params.spaces") 62 - #if ($xcontext.macro.params.global != 'false') 63 - #set ($spaces = "@ALL") 64 - #end 69 + #set($scope = "$!wikimacro.parameters.get('scope')") 70 + #set($spaces = "$!wikimacro.parameters.get('spaces')") 65 65 #set($global = $spaces.contains("@ALL") || $spaces.contains("@global")) 66 66 #set($page = "$!wikimacro.parameters.get('page')") 67 67 #if ($page.isEmpty()) ... ... @@ -87,7 +87,7 @@ 87 87 #else 88 88 #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()) 89 89 #end 90 - #elseif ($scope == "descendents" || $scope == "descendants")96 + #elseif ($scope == "descendents") 91 91 #set($pages = []) 92 92 #if ($global) 93 93 #set($pages = $services.query.xwql("select distinct doc.fullName from Document doc where doc.fullName not like '%.WebPreferences' $hqlHiddenFilter $hqlOrder").execute()) ... ... @@ -100,19 +100,20 @@ 100 100 #set($pages = [$page]) 101 101 #end 102 102 #set($contributors = {}) 103 - #if ($include.contains('authors')) 104 - #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")) 105 - #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 106 106 #end 107 - #if ($include.contains('comments')) 108 - #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")) 109 - #addContributions($query, $pages) 110 - #end 111 - #set ($limit = $numbertool.toNumber($limit).intValue()) 112 - #if (!$limit) 113 - #set ($limit = -1) 114 - #end 115 - #set ($contributions = $services.contributors.sortContributors($contributors.values(), $order, $reverse, $numbertool.toNumber($limit).intValue())) 122 + #set($contributions = $xcontext.get('sortContributions').doCall($contributors.values(), $order, $reverse)) 116 116 117 117 {{html clean=false}} 118 118 <div class="confluence-contributors"> ... ... @@ -124,7 +124,7 @@ 124 124 #foreach ($page in $pages) 125 125 #if (!$foreach.first), #end## 126 126 #set($d = $xwiki.getDocument($page)) 127 - <a class="contributors-page"href="$escapetool.xml($d.getURL())">##134 + <a href="$escapetool.xml($d.getURL())">## 128 128 #set($title = "$!d.getRenderedTitle($xwiki.currentContentSyntaxId)") 129 129 #if ($title != "") 130 130 $escapetool.xml($title)## ... ... @@ -150,7 +150,7 @@ 150 150 </ul> 151 151 #else 152 152 #foreach($contribution in $contributions) 153 - #if(!$foreach.first),#end 160 + #if(!$foreach.first), #end 154 154 #showContribution($contribution) 155 155 #end 156 156 #end - Default categories
-
... ... @@ -1,1 +1,0 @@ 1 -Content - Makrobeschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Contributors Confluence Bridge macro to show the contributors of a given document.
- XWiki.WikiMacroParameterClass[0]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +kind of contributions to include ("authors", "comment") - Parameter-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -com.xwiki.pickers.contributors.Include
- XWiki.WikiMacroParameterClass[1]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Which order to use - Parameter-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -com.xwiki.pickers.contributors.Order
- XWiki.WikiMacroParameterClass[2]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Should the order be reversed?
- XWiki.WikiMacroParameterClass[3]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Maximum number of contributions to show
- XWiki.WikiMacroParameterClass[4]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Display as bullet list ("list") or as comma-separated sentence ("inline") - Parameter-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -com.xwiki.pickers.contributors.Mode
- XWiki.WikiMacroParameterClass[5]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +should the number of contributions per authors be shown?
- XWiki.WikiMacroParameterClass[6]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Should the time of the last contribution be shown?
- XWiki.WikiMacroParameterClass[7]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Which page to show? (by default, the current one)
- XWiki.WikiMacroParameterClass[8]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Which spaces to show? - Parameter-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -com.xwiki.pickers.SuggestSpacesReference
- XWiki.WikiMacroParameterClass[9]
-
- Parameter-Vorgabe
-
... ... @@ -1,1 +1,0 @@ 1 -specified - Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +show the selected pages only (leave empty), their direct children ("children"), or all children ("descendents") - Parameter-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -com.xwiki.pickers.contributors.Scope
- XWiki.WikiMacroParameterClass[10]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Should the list of used pages be shown?
- XWiki.WikiMacroParameterClass[11]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Message to show when pages are not shown
- XWiki.WikiMacroParameterClass[12]
-
- Parameter-Vorgabe
-
... ... @@ -1,1 +1,0 @@ 1 -false - Parameter-Name
-
... ... @@ -1,1 +1,0 @@ 1 -global - Parameter-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -java.lang.Boolean - Parameter verpflichtend
-
... ... @@ -1,1 +1,0 @@ 1 -Nein