Исходный код вики Поддомены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))
Михаил Бич 5.1 8 #elseif($request.get('subdomain'))
9 #set ($currentSubDomain = $request.get('subdomain'))
Andrey Shilin 1.1 10 #end
11 #set ($mainDoc = $xwiki.getDocument('Main.WebHome'))
12 #set ($subdomains= [] )
13 #set ($classesForMenu = ['SUZ.Materials.Code.MaterialsSectionClass', 'SUZ.Methodology.Code.MethodologySectionClass', 'SUZ.Indicators.Code.IndicatorsClass']) ##Массив классов, где нужно показывать меню
14 #set ($selfShow = false)
15 #set ($objNames = $doc.getxWikiObjects().keySet()) ##Список наименований классов в текущем объекте
16 #foreach ($obj in $objNames)
17 #if ($classesForMenu.contains($obj))
18 #set ($selfShow = true)
19 #end
20 #end
Andrey Shilin 3.1 21 #set($q = "select doc.fullName from XWikiDocument as doc, BaseObject as obj where doc.fullName = obj.name and obj.className like 'SUZ.Code.SubDomainClass' and doc.space not like '%Sandbox%'")
22 #set($query = $services.query.hql($q).execute())
23 #foreach ($child in $query)
Andrey Shilin 1.1 24 #set ($childDoc = $xwiki.getDocument($child).getTranslatedDocument())
25 #set ($xobject = $childDoc.getObject('SUZ.Code.SubDomainClass'))
26 #if ($xobject) ##Включаем только страницы с SubDomainClass
27 #set ($docTitle = $childDoc.getTitle())
28 #if ($docTitle == '')
29 #set ($docTitle = $childDoc.getDocumentReference().getParent().getName())
30 #end
31 #if($selfShow)
32 #set($row = '[[' + $docTitle + '>>' + $doc.getTranslatedDocument() + '||value="' + $escapetool.xml($docTitle) + '"]]')
33 #else
34 #set($row = $docTitle)
35 #end
36 #set ($discard = $subdomains.add({"title": $docTitle, "value": $row}))
37 #end
38 #end
39 ## Пункт "Все"
40 #if($selfShow)
41 #set ($row = '[[' + 'Все' + '>>' + $doc.getTranslatedDocument() + '||value=""]]')
42 #else
43 #set($row = "Все")
44 #end
45 #set ($menuSubDomains = [{"title": '', "value": $row}])
Andrey Shilin 2.1 46 #set ($discard = $menuSubDomains.addAll($collectiontool.sort($subdomains, ["title", "value"])))
Andrey Shilin 1.1 47 #foreach ($row in $menuSubDomains)
48 #if ($row.title == $currentSubDomain and $selfShow)
49 * **$row.value**
50 #else
51 * $row.value
52 #end
53 #end
54 {{/velocity}}

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

Языки