On 05/11/2012 05:03 AM, Account wrote:
hi all,
id like to use the Space-Index macro to list all pages on the WebHome page of every
Space. With {{spaceindex count="0"/}} i get a list which is sorted by the time
the page was created (or last modified?), but i'd like a list which is sorted in
alphabetical order. Is that possible?
thanks in advance,
zae.
Well, it seems that the space index macro has a hard-coded ordering on
the creation date. You can change that in the source code of the macro:
- edit Main.SpaceIndex in the object editor
/xwiki/bin/edit/Main/SpaceIndex?editor=object&classname=XWiki.WikiMacroClass
- in the "Macro code" field of the XWiki.WikiMacroClass object, find the
line:
#set ($docNames = $xwiki.searchDocuments('where doc.space=? order by
doc.creationDate desc', $limit, 0, [${spaceParam}]))
and replace it with:
#set ($docNames = $xwiki.searchDocuments('where doc.space=? order by
doc.name', $limit, 0, [${spaceParam}]))
- save, and it should order by name now.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/