Исходный код вики Поддомены2


Скрыть последних авторов
Andrey Shilin 1.1 1 {{velocity}}
2 ##
3 #set ($discard = $xwiki.jsx.use('SUZ.Menu.Поддомены2.WebHome'))
4 #set ($currentSubDomain = '')
5 #if ($request.getCookie('subdomain'))
6 #set($cookie = $request.getCookie('subdomain'))
7 #set ($currentSubDomain = $util.decodeURI($cookie.value))
8 #end
9 #set ($mainDoc = $xwiki.getDocument('Main.WebHome'))
10 #set ($subdomains= [] )
11 #set ($classesForMenu = ['SUZ.Materials.Code.MaterialsSectionClass', 'SUZ.Methodology.Code.MethodologySectionClass', 'SUZ.Indicators.Code.IndicatorsClass']) ##Массив классов, где нужно показывать меню
12 #set ($selfShow = false)
13 #set ($objNames = $doc.getxWikiObjects().keySet()) ##Список наименований классов в текущем объекте
14 #foreach ($obj in $objNames)
15 #if ($classesForMenu.contains($obj))
16 #set ($selfShow = true)
17 #end
18 #end
19 #foreach ($child in $mainDoc.getChildrenReferences())
20 #set ($childDoc = $xwiki.getDocument($child).getTranslatedDocument())
21 #set ($xobject = $childDoc.getObject('SUZ.Code.SubDomainClass'))
22 #if ($xobject) ##Включаем только страницы с SubDomainClass
23 #set ($docTitle = $childDoc.getTitle())
24 #if ($docTitle == '')
25 #set ($docTitle = $childDoc.getDocumentReference().getParent().getName())
26 #end
27 #if($selfShow)
28 #set($row = '[[' + $docTitle + '>>' + $doc.getTranslatedDocument() + '||value="' + $escapetool.xml($docTitle) + '"]]')
29 #else
30 #set($row = $docTitle)
31 #end
32 #set ($discard = $subdomains.add({"title": $docTitle, "value": $row}))
33 #end
34 #end
35 ## Пункт "Все"
36 #if($selfShow)
37 #set ($row = '[[' + 'Все' + '>>' + $doc.getTranslatedDocument() + '||value=""]]')
38 #else
39 #set($row = "Все")
40 #end
41 #set ($menuSubDomains = [{"title": '', "value": $row}])
Andrey Shilin 2.1 42 #set ($discard = $menuSubDomains.addAll($collectiontool.sort($subdomains, ["title", "value"])))
Andrey Shilin 1.1 43 #foreach ($row in $menuSubDomains)
44 #if ($row.title == $currentSubDomain and $selfShow)
45 * **$row.value**
46 #else
47 * $row.value
48 #end
49 #end
50 {{/velocity}}

Содружество стран

Языки