Wiki source code of Makro: Verwandte Themen (automatisch)
Version 1.1 by Dimitri Rupp on 2026/06/11 08:39
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{velocity}} | ||
| 2 | #set($ownTags = $xwiki.tag.getTagsFromDocument($doc.fullName)) | ||
| 3 | #if($ownTags && $ownTags.size() > 0) | ||
| 4 | #set($scores = {}) | ||
| 5 | #foreach($t in $ownTags) | ||
| 6 | #foreach($d in $xwiki.tag.getDocumentsWithTag($t)) | ||
| 7 | #if($d != $doc.fullName && !$d.startsWith('IT-Wiki.Vorlagen') && !$d.startsWith('IT-Wiki.Makros')) | ||
| 8 | #if($scores.containsKey($d)) | ||
| 9 | #set($void = $scores.put($d, $mathtool.add($scores.get($d), 1))) | ||
| 10 | #else | ||
| 11 | #set($void = $scores.put($d, 1)) | ||
| 12 | #end | ||
| 13 | #end | ||
| 14 | #end | ||
| 15 | #end | ||
| 16 | #if($scores.size() > 0) | ||
| 17 | //Automatisch vorgeschlagen (gemeinsame Tags: #foreach($t in $ownTags)##$t## #end):// | ||
| 18 | |||
| 19 | #set($shown = 0) | ||
| 20 | #foreach($minScore in [3, 2, 1]) | ||
| 21 | #foreach($entry in $scores.entrySet()) | ||
| 22 | #if($entry.value == $minScore && $shown < 6) | ||
| 23 | #set($rdoc = $xwiki.getDocument($entry.key)) | ||
| 24 | * [[$rdoc.plainTitle>>doc:$entry.key]] | ||
| 25 | #set($shown = $mathtool.add($shown, 1)) | ||
| 26 | #end | ||
| 27 | #end | ||
| 28 | #end | ||
| 29 | #end | ||
| 30 | #end | ||
| 31 | {{/velocity}} |