Изменения документа Document Tree Macros

Редактировал(а) Alexey Semenihin 23.10.2026, 15:12

От версии 1.1
отредактировано Admin xWiKi
на 15.10.2019, 13:19
Изменить комментарий: Install extension [org.xwiki.platform:xwiki-platform-index-tree-macro/11.8.1]
К версии 2.1
отредактировано Dmitriy Rybakov
на 04.10.2024, 00:07
Изменить комментарий: Install extension [org.xwiki.platform:xwiki-platform-index-tree-macro/15.10.12]

Сводка

Подробности

Свойства страницы
Автор документа
... ... @@ -1,1 +1,1 @@
1 -XWiki.admin
1 +XWiki.rybakovds
Содержимое
... ... @@ -94,6 +94,7 @@
94 94   #getSuggestions($data)
95 95   #end
96 96   #if ($data)
97 + #postProcessDocumentTreeData($data)
97 97   #jsonResponse($data)
98 98   #else
99 99   $response.sendError(404)
... ... @@ -101,6 +101,10 @@
101 101   #end
102 102  #end
103 103  
105 +#macro (postProcessDocumentTreeData $data)
106 + ## This is just a hook to allow post processing the document tree data.
107 +#end
108 +
104 104  ##------------------------------------------------------------
105 105  ## Children
106 106  ##------------------------------------------------------------
... ... @@ -114,11 +114,11 @@
114 114   ## Return the children of the specified node.
115 115   #set ($actualNodeId = $nodeId)
116 116   #end
117 - #set ($offset = $mathtool.max($mathtool.toInteger($request.offset), 0))
122 + #set ($offset = $mathtool.max($numbertool.toNumber($request.offset).intValue(), 0))
118 118   #if ("$!offset" == '')
119 119   #set ($offset = 0)
120 120   #end
121 - #set ($limit = $mathtool.max($mathtool.toInteger($request.limit), 1))
126 + #set ($limit = $mathtool.max($numbertool.toNumber($request.limit).intValue(), 1))
122 122   #if ("$!limit" == '')
123 123   #set ($limit = 15)
124 124   #end
... ... @@ -311,10 +311,6 @@
311 311   #if ($canViewDoc && $docTreeConfig.showDocumentTitle)
312 312   ## Display the translated title.
313 313   #set ($translatedDocument = $xwiki.getDocument($documentReference).translatedDocument)
314 - ## Make sure the displayed title is not affected by the sheet request parameter (e.g. when $translatedDocument is
315 - ## the current document). By setting the title (even if we don't change it) the internal document instance is cloned
316 - ## so it's going to be different than the current document instance (which is the target of the sheet parameter).
317 - #set ($discard = $translatedDocument.setTitle($translatedDocument.title))
318 318   #set ($plainTitle = $translatedDocument.plainTitle)
319 319   #if (!$stringtool.isBlank($plainTitle))
320 320   #set ($label = $plainTitle)
... ... @@ -478,7 +478,8 @@
478 478   'canDelete': $canEditDoc,
479 479   'canMove': $canEditDoc,
480 480   'canCopy': true,
481 - 'deleteURL': $attachment.document.getAttachmentURL($attachment.filename, 'delattachment')
482 + 'deleteURL': $attachment.document.getAttachmentURL($attachment.filename, 'delattachment'),
483 + 'mimetype': $attachment.mimeType
482 482   },
483 483   'a_attr': {
484 484   'href': $attachment.document.getAttachmentURL($attachment.filename)
... ... @@ -672,8 +672,8 @@
672 672   ## Object name is: Space.Class[index]
673 673   #set ($separatorIndex = $objectReference.name.lastIndexOf('['))
674 674   #set ($classId = $objectReference.name.substring(0, $separatorIndex))
675 - #set ($objectNumber = $mathtool.toInteger($objectReference.name.substring($mathtool.add($separatorIndex, 1),
676 - $mathtool.sub($objectReference.name.length(), 1))))
677 + #set ($objectNumber = $numbertool.toNumber($objectReference.name.substring($mathtool.add($separatorIndex, 1),
678 + $mathtool.sub($objectReference.name.length(), 1))).intValue())
677 677   #set ($document = $xwiki.getDocument($objectReference))
678 678   #set ($object = $document.getObject($classId, $objectNumber))
679 679  #end
... ... @@ -1120,6 +1120,7 @@
1120 1120  #macro (searchAttachmentsSolr $text $limit $return)
1121 1121   #set ($params = [
1122 1122   'fq=type:ATTACHMENT',
1125 + 'fq=locale:*',
1123 1123   'qf=filename^4 attcontent',
1124 1124   'fl=type wiki spaces name filename'
1125 1125   ])
... ... @@ -1264,7 +1264,7 @@
1264 1264   #set ($input = [])
1265 1265   #foreach ($list in $lists)
1266 1266   ## We use queues to be able to easily remove items from the start.
1267 - #set ($queue = $collectionstool.queue)
1270 + #set ($queue = $collectiontool.queue)
1268 1268   #set ($discard = $queue.addAll($list))
1269 1269   #set ($discard = $input.add($queue))
1270 1270   ## We will add (part of) the items back later.