Hi there,
We want to give visibilty to all users on the spaces created, by adding this information on the dashboard.
So I am trying to create a simple user macro to list the 10 last created spaces.
It was quite easy to list all spaces with creation date.
But now, I am looking for some help regarding more complex algo to sort and select only the 10 last spaces.
This is my script right now.
----------------------------------------------------------------------------
## @noparams
#set($containerManagerClass=$content.class.forName("com.atlassian.spring.container.ContainerManager"))
#set($getInstanceMethod=$containerManagerClass.getDeclaredMethod("getInstance",null))
#set($containerManager=$getInstanceMethod.invoke(null,null))
#set($containerContext=$containerManager.containerContext)
#set($spaceLabelManager=$containerContext.getComponent("spaceLabelManager"))
#set ($spaces = $spaceManager.getAllSpaces())
<table class="confluenceTable">
<tr>
<th class="confluenceTh">Espace</th>
<th class="confluenceTh">Date de Création</th>
<th class="confluenceTh">Catégorie(s)</th>
</tr>
#foreach ( $space in $spaces )
#if ($space.isGlobal())
#end
#end
#foreach ( $space in $spaces )
#if ($space.isGlobal())
<tr>
#set($result=$space.getDescription().getDescriptionTitle())
#set($creationdate=$space.getCreationDate())
<td class="confluenceTd"><a href="$req.contextPath$space.getUrlPath()"><img class="space logo" width="32" height="32" src="$spaceManager.getLogoForSpace($space.key).getDownloadPath()" alt="$space.key"/> $space.getName()</a></td>
<td class="confluenceTd">$creationdate</td>
<td class="confluenceTd">
#foreach ($label in $spaceLabelManager.getTeamLabelsOnSpace($space.key))
<ac:structured-macro ac:name="status" ac:schema-version="1" ac:macro-id="73f05bec-6b92-413f-a826-3ff2d59096b3"><ac:parameter ac:name="subtle">true</ac:parameter><ac:parameter ac:name="title">$label.getName()</ac:parameter></ac:structured-macro>
#end
</td>
</tr>
#end
#end
</table>
--------------------------------------------------------------------------------------
Any idea, clue, advice on how to this ?
Thanks !