+
+ # attachments in holding directory
+ my $dir=attachment_holding_location($page);
+ my $heldmsg=gettext("this attachment is not yet saved");
+ foreach my $file (glob("$dir/*")) {
+ $file=Encode::decode_utf8($file);
+ next unless -f $file;
+ my $base=IkiWiki::basename($file);
+ my $f=$loc.$base;
+ $attachments{$f}={
+ $std->($f, (stat($file))[9]*2, stored_msg(), (stat(_))[7]),
+ link => $base,
+ }
+ }
+
+ # Sort newer attachments to the end of the list.
+ return sort { $a->{mtime_raw} <=> $b->{mtime_raw} || $a->{link} cmp $b->{link} }
+ values %attachments;
+}
+
+sub stored_msg {
+ gettext("just uploaded");
+}