Исходный код вики Поддомены
Скрыть последних авторов
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | {{velocity}} |
| 2 | ## | ||
| 3 | #set ($currentSubDomain = '') | ||
| 4 | #if ($request.get('subdomain')) | ||
| 5 | #set ($currentSubDomain = $request.get('subdomain')) | ||
| 6 | #end | ||
| 7 | #set ($mainDoc = $xwiki.getDocument('Main.WebHome')) | ||
| 8 | #set ($subdomains= [] ) | ||
| 9 | #foreach ($child in $mainDoc.getChildrenReferences()) | ||
| 10 | #set ($childDoc = $xwiki.getDocument($child).getTranslatedDocument()) | ||
| 11 | #set ($xobject = $childDoc.getObject('SUZ.Code.SubDomainClass')) | ||
| 12 | #if ($xobject) ##Включаем только страницы с SubDomainClass | ||
| 13 | #set ($docTitle = $childDoc.getTitle()) | ||
| 14 | #if ($docTitle == '') | ||
| 15 | #set ($docTitle = $childDoc.getDocumentReference().getParent().getName()) | ||
| 16 | #end | ||
| 17 | #set($row = '[[' + $docTitle + '>>' + $doc.getTranslatedDocument() + '||queryString="subdomain=' + $docTitle + '"]]') | ||
| 18 | #set ($discard = $subdomains.add({"title": $docTitle, "value": $row})) | ||
| 19 | #end | ||
| 20 | #end | ||
| 21 | ## Пункт "Все" | ||
| 22 | #set ($row = '[[' + 'Все' + '>>' + $doc.getTranslatedDocument() + ']]') | ||
| 23 | #set ($menuSubDomains = [{"title": '', "value": $row}]) | ||
| 24 | #set ($discard = $menuSubDomains.addAll($sorttool.sort($subdomains, ["title", "value"]))) | ||
| 25 | #foreach ($row in $menuSubDomains) | ||
| 26 | #if ($row.title == $currentSubDomain) | ||
| 27 | * **$row.value** | ||
| 28 | #else | ||
| 29 | * $row.value | ||
| 30 | #end | ||
| 31 | #end | ||
| 32 | {{/velocity}} |