Изменения документа Поддомены2


<
От версии < 3.1 >
отредактировано Andrey Shilin
на 2025/04/18 16:10
К версии < 6.1
отредактировано Andrey Shilin
на 2025/07/10 15:52
Изменить комментарий: Imported from XAR

Комментарий

Подробности

Свойства страницы
Содержимое
... ... @@ -5,6 +5,8 @@
5 5  #if ($request.getCookie('subdomain'))
6 6   #set($cookie = $request.getCookie('subdomain'))
7 7   #set ($currentSubDomain = $util.decodeURI($cookie.value))
8 +#elseif($request.get('subdomain'))
9 + #set ($currentSubDomain = $request.get('subdomain'))
8 8  #end
9 9  #set ($mainDoc = $xwiki.getDocument('Main.WebHome'))
10 10  #set ($subdomains= [] )
... ... @@ -26,12 +26,15 @@
26 26   #if ($docTitle == '')
27 27   #set ($docTitle = $childDoc.getDocumentReference().getParent().getName())
28 28   #end
31 + #set($docRef = $childDoc.getDocumentReference().getParent().getName())
29 29   #if($selfShow)
30 - #set($row = '[[' + $docTitle + '>>' + $doc.getTranslatedDocument() + '||value="' + $escapetool.xml($docTitle) + '"]]')
33 + #set($row = '[[' + $docTitle + '>>' + $doc.getTranslatedDocument() + '||value="' + $escapetool.xml($docRef) + '"]]')
31 31   #else
32 32   #set($row = $docTitle)
33 33   #end
34 - #set ($discard = $subdomains.add({"title": $docTitle, "value": $row}))
37 + #set($sortCode = "99999999")
38 + #set($sortCode = $xobject.getValue('sortCode'))
39 + #set ($discard = $subdomains.add({"title": $docTitle, "value": $row, "docRef":$docRef,"sortCode":$sortCode}))
35 35   #end
36 36  #end
37 37  ## Пункт "Все"
... ... @@ -40,10 +40,10 @@
40 40  #else
41 41   #set($row = "Все")
42 42  #end
43 -#set ($menuSubDomains = [{"title": '', "value": $row}])
44 -#set ($discard = $menuSubDomains.addAll($collectiontool.sort($subdomains, ["title", "value"])))
48 +#set ($menuSubDomains = [{"title": '', "docRef":'',"value": $row}])
49 +#set ($discard = $menuSubDomains.addAll($collectiontool.sort($subdomains, ["sortCode","title", "value"])))
45 45  #foreach ($row in $menuSubDomains)
46 -#if ($row.title == $currentSubDomain and $selfShow)
51 +#if ($row.docRef == $currentSubDomain and $selfShow)
47 47  * **$row.value**
48 48  #else
49 49  * $row.value
XWiki.UIExtensionClass[0]
Executed Content
... ... @@ -1,18 +1,21 @@
1 -{{velocity}}
1 +{{velocity output="false"}}
2 2  ##Показать меню подразжелов только на определенных страницах
3 -###set ($classesForMenu = ['SUZ.Materials.Code.MaterialsSectionClass', 'SUZ.Methodology.Code.MethodologySectionClass', 'SUZ.Indicators.Code.IndicatorsClass']) ##Массив классов, где нужно показывать меню
4 -###set ($selfShow = false)
5 -###set ($objNames = $doc.getxWikiObjects().keySet()) ##Список наименований классов в текущем объекте
6 -###foreach ($obj in $objNames)
7 -## #if ($classesForMenu.contains($obj))
8 -## #set ($selfShow = true)
9 -## #end
10 -###end
11 -###if ($selfShow) ##Условие показа меню
3 +#set ($classesForMenu = ['SUZ.Materials.Code.MaterialsSectionClass', 'SUZ.Methodology.Code.MethodologySectionClass', 'SUZ.Indicators.Code.IndicatorsClass']) ##Массив классов, где нужно показывать меню
4 +#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%' and doc.fullName not like '%SUZ%'")
5 +#set($query = $services.query.hql($q).execute())
6 +#set ($selfShow = false)
7 +#set ($objNames = $doc.getxWikiObjects().keySet()) ##Список наименований классов в текущем объекте
8 +#foreach ($obj in $objNames)
9 + #if ($classesForMenu.contains($obj) && $query.size() > 0)
10 + #set ($selfShow = true)
11 + #end
12 +#end
13 +{{/velocity}}{{velocity}}
14 +#if($selfShow)
12 12  #panelheader($services.localization.render('suz.menu.'+'Поддомены'))
13 13  {{menu type="vertical collapsible open" id="subdomains"}}
14 14  {{include reference="$uix.doc.documentReference" /}}
15 15  {{/menu}}
16 16  #panelfooter()
17 -###end
20 +#end
18 18  {{/velocity}}

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

Языки