Сайт кафедры теоретической механики и сопротивления материалов УДХТУ

Изменения документа Индекс раздела

Редактировал(а) Dmitry Fedin 2023/04/25 09:16

От версии Icon 6.1 Icon
отредактировано Dmitry Fedin
на 2013/01/07 22:57
Изменить комментарий: Импортировано из XAR
К версии Icon 7.1 Icon
отредактировано Dmitry Fedin
на 2014/10/22 14:26
Изменить комментарий: Install extension [org.xwiki.platform:xwiki-platform-index-ui-6.2.2]

Комментарий

Подробности

Icon Свойства страницы
Название
... ... @@ -1,1 +1,1 @@
1 -$msg.get("platform.index.spaceIndex")
1 +$services.localization.render('platform.index.spaceIndex')
Содержимое
... ... @@ -1,6 +1,6 @@
1 1  {{velocity}}
2 2  #if("$!request.space" != "") #set($space=$request.space) #else #set($space = $doc.space) #end
3 -$msg.get('platform.index.spaceIndexDescription', [$space])
3 +$services.localization.render('platform.index.spaceIndexDescription', [$space])
4 4  
5 5  {{documents space="$space.replaceAll('["~]', '~$0')" id="spaceindex"/}}
6 6  {{/velocity}}
Icon XWiki.WikiMacroClass[0]
Код
... ... @@ -1,6 +1,6 @@
1 1  {{velocity}}
2 - ## TODO: add me a parameter to specify the style, list or livetable
3 - ## get the number of documents to display
2 + ## TODO: add a parameter to specify the style, list or livetable
3 + ## Get the number of documents to display
4 4   #set ($limit = $xcontext.macro.params.get('count'))
5 5   #if ("$!limit" == '')
6 6   ## 100 documents displayed by default if no value is specified
... ... @@ -7,13 +7,26 @@
7 7   #set ($limit = '100')
8 8   #end
9 9   #set ($limit = $mathtool.toInteger($limit))
10 - ## get the space to display the documents for
10 + ## Compute the XWQL portion related to sorting, based on the passed "sort" parameter
11 + ## Valid values are "creationDate", "modificationDate" and "docName"
12 + #set ($sort = $xcontext.macro.params.get('sort'))
13 + #if ("$sort" == 'docName')
14 + ## Sorting alphabetically
15 + #set ($sortQuery = 'doc.name asc')
16 + #elseif ("$sort" == 'modificationDate')
17 + ## Sorting by update date
18 + #set ($sortQuery = 'doc.contentUpdateDate desc')
19 + #else
20 + ## Sort by creation date by default
21 + #set ($sortQuery = 'doc.creationDate desc')
22 + #end
23 + ## Get the space to display the documents for
11 11   #set ($spaceParam = $doc.space)
12 12   #set ($spaceMacroParam = $xcontext.macro.params.get('space'))
13 13   #if ("$!spaceMacroParam" != '')
14 14   #set ($spaceParam = $spaceMacroParam)
15 15   #end
16 - #set ($docNames = $xwiki.searchDocuments('where doc.space=? order by doc.creationDate desc', $limit, 0, [${spaceParam}]))
29 + #set ($docNames = $services.query.hql("where doc.space=? order by $sortQuery").addFilter('currentlanguage').addFilter('hidden').setLimit($limit).bindValues([${spaceParam}]).execute())
17 17   {{html}}
18 18   #displayDocumentList($docNames false [])
19 19   ## Note: we pass an empty blacklistedSpaces list since we are used as a space dashboard, not a global dashboard
... ... @@ -20,12 +20,12 @@
20 20   {{/html}}
21 21  
22 22   #if ($docNames.size() == $limit)
23 - #set ($docCount = $xwiki.countDocuments('where doc.space=?', [${spaceParam}]))
36 + #set ($docCount = $services.query.xwql('where doc.space = :space').bindValue('space', $spaceParam).addFilter('unique').count())
24 24   #set ($remaining = $mathtool.sub($docCount, $limit))
25 25   #if ($remaining > 0)
26 26   (% class="documentListMore" %) (((
27 - // $msg.get('xe.dashboard.space.remainingDocumentsInSpace', [$remaining, $spaceParam])
28 - [[$msg.get('xe.dashboard.space.visitSpaceIndex')>>Main.SpaceIndex?space=${escapetool.url($spaceParam)}]] //
40 + // $services.localization.render('xe.dashboard.space.remainingDocumentsInSpace', [$remaining, $spaceParam])
41 + [[$services.localization.render('xe.dashboard.space.visitSpaceIndex')>>Main.SpaceIndex?space=${escapetool.url($spaceParam)}]] //
29 29   )))
30 30   #end
31 31   #end
... ... @@ -36,7 +36,7 @@
36 36   #if ($hasCreatePage)
37 37   {{html}}
38 38   <ul class="xlist">
39 - <li class="page create"><a href="$doc.getURL('create')">$msg.get('platform.index.spaceIndexDocumentListCreate')</a></li>
52 + <li class="page create"><a href="$doc.getURL('create')">$services.localization.render('platform.index.spaceIndexDocumentListCreate')</a></li>
40 40   </ul>
41 41   {{/html}}
42 42   #end
Описание
... ... @@ -1,1 +1,1 @@
1 -Lists the documents in a space.
1 +Lists documents in a space.
Icon XWiki.WikiMacroParameterClass[2]
Значение параметра по-умолчанию
... ... @@ -1,0 +1,1 @@
1 +creationDate
Описание параметра
... ... @@ -1,0 +1,5 @@
1 +Optional parameter to choose the sorting of the list of document.
2 +Value must be:
3 +- creationDate sort by creation date (default)
4 +- modificationDate sort by update date
5 +- or docName sort alphabetically
Обязательность параметра
... ... @@ -1,0 +1,1 @@
1 +Нет
Имя параметра
... ... @@ -1,0 +1,1 @@
1 +sort