Changes for page Space Index

Last modified by Simon Urli on 2023/05/25 15:14

<
From version < 2.1 >
edited by Vincent Massol
on 2011/10/05 19:23
To version < 3.1 >
edited by Vincent Massol
on 2012/01/11 10:37
>
Change comment: Imported from XAR

Summary

Details

Page properties
Default language
... ... @@ -1,1 +1,0 @@
1 -en
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,28 +1,28 @@
1 1  {{velocity}}
2 2   ## TODO: add me a parameter to specify the style, list or livetable
3 3   ## get the number of documents to display
4 - #set($limit = $context.macro.params.get('count'))
5 - #if ("$!limit" == "")
4 + #set ($limit = $xcontext.macro.params.get('count'))
5 + #if ("$!limit" == '')
6 6   ## 100 documents displayed by default if no value is specified
7 - #set($limit = 100)
7 + #set ($limit = '100')
8 8   #end
9 - #set($limit = $util.parseInt($limit))
9 + #set ($limit = $util.parseInt($limit))
10 10   ## get the space to display the documents for
11 - #set($spaceParam = $doc.space)
12 - #set($spaceMacroParam = $context.macro.params.get('space'))
13 - #if("$!spaceMacroParam" != "")
14 - #set($spaceParam = $spaceMacroParam)
11 + #set ($spaceParam = $doc.space)
12 + #set ($spaceMacroParam = $xcontext.macro.params.get('space'))
13 + #if ("$!spaceMacroParam" != '')
14 + #set ($spaceParam = $spaceMacroParam)
15 15   #end
16 - #set($docNames = $xwiki.searchDocuments("where doc.space='${spaceParam}' order by doc.creationDate desc", $limit, 0))
16 + #set ($docNames = $xwiki.searchDocuments('where doc.space=? order by doc.creationDate desc', $limit, 0, [${spaceParam}]))
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 20   {{/html}}
21 21  
22 - #if($docNames.size() == $limit)
23 - #set($docCount = $xwiki.countDocuments("where doc.space='${spaceParam}'"))
24 - #set($remaining = $mathtool.sub($docCount, $limit))
25 - #if($remaining > 0)
22 + #if ($docNames.size() == $limit)
23 + #set ($docCount = $xwiki.countDocuments('where doc.space=?', [${spaceParam}]))
24 + #set ($remaining = $mathtool.sub($docCount, $limit))
25 + #if ($remaining > 0)
26 26   (% class="documentListMore" %) (((
27 27   // $msg.get('xe.dashboard.space.remainingDocumentsInSpace', [$remaining, $spaceParam])
28 28   [[$msg.get('xe.dashboard.space.visitSpaceIndex')>>Main.SpaceIndex?space=$spaceParam]] //
... ... @@ -29,5 +29,16 @@
29 29   )))
30 30   #end
31 31   #end
32 + ##
33 + ## Document creation.
34 + ##
35 + ## Only if the current user has edit rights.
36 + #if ($hasCreatePage)
37 + {{html}}
38 + <ul class="xlist">
39 + <li class="page create"><a href="$doc.getURL('create')">$msg.get('xe.spaceIndex.documentList.create')</a></li>
40 + </ul>
41 + {{/html}}
42 + #end
32 32  {{/velocity}}
33 33  

Get Connected