Edward,
Could you please add this to a FAQ entry on
xwiki.org.
Thanks
-Vincent
On Sep 12, 2008, at 1:20 AM, Sergiu Dumitriu wrote:
Edward Laptop wrote:
Hi again
Is there some way to ensure that the attachements display in date
order,
with say the newest at the top?
Yes, you'll have to edit attachmentsinline.vm and add the following
code:
#set($attachmentsMap = $util.hashMap)
#foreach($a in $attachments)
#set($discard = $attachmentsMap.put($a.date, $a))
#end
#set($dates = $util.arrayList)
#foreach($date in $attachmentsMap.keySet())
#set($discard = $dates.add($date))
#end
#set($dates = $util.sort($dates))
#set($dates = $util.reverseList($dates))
#set($attachments = $util.arrayList)
#foreach($date in $dates)
#set($discard = $attachments.add($attachmentsMap.get($date)))
#end
... just between the lines:
#set($attachments = $doc.attachmentList)
<div id="attachmentscontent" class="xwikiintracontent">
--
Sergiu Dumitriu
http://purl.org/net/sergiu/