Modifications pour le document Liste des pages de l'espace

Modifié par Thomas Mortagne le 2023/04/25 09:57

Depuis la version 3.1
modifié par Vincent Massol
sur 2013/11/15 08:09
Commentaire de modification : Import
À la version 1.1
modifié par Vincent Massol
sur 2011/02/03 12:16
Commentaire de modification : Imported from XAR

Résumé

Détails

Propriétés de la Page
Titre
... ... @@ -1,1 +1,1 @@
1 -$services.localization.render('platform.index.spaceIndex')
1 +$msg.get("xe.space.index")
Auteur du document
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +xwiki:XWiki.VincentMassol
Masqué
... ... @@ -1,1 +1,1 @@
1 -true
1 +false
Contenu
... ... @@ -1,7 +1,15 @@
1 1  {{velocity}}
2 2  #if("$!request.space" != "") #set($space=$request.space) #else #set($space = $doc.space) #end
3 -$services.localization.render('platform.index.spaceIndexDescription', [$space])
4 -
5 -{{documents space="$space.replaceAll('["~]', '~$0')" id="spaceindex"/}}
3 +$msg.get('xe.space.index.description', [$space])
4 +#set($collist = ["doc.name","doc.date", "doc.author", "_actions"])
5 +#set($colprops = {
6 + "doc.name" : { "type" : "text" , "size" : 30, "link" : "view"},
7 + "doc.date" : { "type" : "date" },
8 + "doc.author" : { "type" : "text", "link" : "author"},
9 + "_actions" : {"actions": ["copy","delete","rename","rights"]}
10 + })
11 +#set($options = { "translationPrefix" : "xe.index.",
12 + "rowCount": 15,
13 + "extraParams" : "&space=$escapetool.url($space)" })
14 +#livetable("spaceindex" $collist $colprops $options)
6 6  {{/velocity}}
7 -
XWiki.WikiMacroClass[0]
Code de la macro
... ... @@ -1,44 +1,33 @@
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 = $xcontext.macro.params.get('count'))
5 - #if ("$!limit" == '')
4 + #set($limit = $context.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 = $mathtool.toInteger($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 = $xcontext.macro.params.get('space'))
13 - #if ("$!spaceMacroParam" != '')
14 - #set ($spaceParam = $spaceMacroParam)
11 + #set($spaceParam = $doc.space)
12 + #set($spaceMacroParam = $context.macro.params.get('space'))
13 + #if("$!spaceMacroParam" != "")
14 + #set($spaceParam = $spaceMacroParam)
15 15   #end
16 - #set ($docNames = $services.query.hql('where doc.space=? order by doc.creationDate desc').setLimit($limit).bindValues([${spaceParam}]).execute())
16 + #set($docNames = $xwiki.searchDocuments("where doc.space='${spaceParam}' order by doc.creationDate desc", $limit, 0))
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 = $services.query.xwql('where doc.space = :space').bindValue('space', $spaceParam).addFilter('unique').count())
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 - // $services.localization.render('xe.dashboard.space.remainingDocumentsInSpace', [$remaining, $spaceParam])
28 - [[$services.localization.render('xe.dashboard.space.visitSpaceIndex')>>Main.SpaceIndex?space=${escapetool.url($spaceParam)}]] //
27 + // $msg.get('xe.dashboard.space.remainingDocumentsInSpace', [$remaining, $spaceParam])
28 + [[$msg.get('xe.dashboard.space.visitSpaceIndex')>>Main.SpaceIndex?space=$spaceParam]] //
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')">$services.localization.render('platform.index.spaceIndexDocumentListCreate')</a></li>
40 - </ul>
41 - {{/html}}
42 - #end
43 43  {{/velocity}}
44 44