#!/bin/sh
. "$_EXEC/cgilite/cgilite.sh"
. "$_EXEC/acl.sh"
. "$_EXEC/tools.sh"
[ $# = 0 ] && set -- "*"
printf '
'
for glob in "$@"; do
page="${glob%/*}"
[ "$page" = "$glob" ] && page=./
[ ! "$page" ] && page=/
acl_read "$(page_abs "${page}")" \
&& attachment_glob "$glob"
done \
| grep -xiE '.*\.jpe?g|.*\.png|.*\.gif' \
| while read attachment; do
case $attachment in
*/*)
printf '
' \
"${attachment%/*}/[attachment]/${attachment##*/}" "${attachment}"
;;
*)
printf '
' \
"[attachment]/${attachment}" "${attachment}"
;;
esac
done
printf '
'