ORDER="$(GET o |grep -m1 -axE 'Date|Name|Length' || printf Name)"
LISTSIZE="$(COOKIE pagesize |grep -m1 -axE '[1-9][0-9]*' || printf 50)"
ITEM="$(PATH "${PATH_INFO#/}")"
+ACTION="$(GET a)"
-case $(GET a) in
+case $ACTION in
setprefs)
SET_COOKIE +$((86400 * 90)) pagesize="$(POST pagesize |grep -m1 -axE '[1-9][0-9]*' || printf 50)"
SET_COOKIE +$((86400 * 90)) mode="$(POST mode |grep -m1 -axE 'browse|index' || printf browse)"
[ -r "$_DATA/$ITEM" ] && FILE "$_DATA/$ITEM" \
|| FILE "$_EXEC/style.css"
elif [ -f "$_DATA/$ITEM" ]; then
- case $(GET a) in
+ case $ACTION in
tag)
;;
thumbnail)
;;
esac
elif [ -d "$_DATA/$ITEM" ]; then
- case $(GET a) in
+ case $ACTION in
advsearch)
. "$_EXEC/advsearch.sh"
;;
- spawnindex)
- if [ "$(POST recursive)" = yes ]; then
- find "$_DATA/$ITEM" -depth -type d \! -name .index \
- -exec mkdir -p '{}'/.index \;
- else
- mkdir -p "$_DATA/$ITEM/.index"
- fi
- REDIRECT "$(POST ref)"
- ;;
multitag)
+ if [ "$(POST spawn)" = spawn ]; then
+ case "$(POST recursive)" in
+ yes) find "$_DATA/$ITEM" \
+ -depth -type d \! -name .index \
+ -exec mkdir -p '{}'/.index \;
+ ;;
+ *) mkdir -p "$_DATA/$ITEM/.index";;
+ esac
+ else
. "$_EXEC/multitag.sh"
+ fi
REDIRECT "$(POST ref)"
;;
*) . "$_EXEC/list.sh"
w_index(){
[ -d "$_DATA/$ITEM/.index" ] && return 1 || printf '
- [form #index method="POST" action="?a=spawnindex"
+ [form #index method="POST" action="?a=multitag"
[hidden "ref" "%s"]
[label Set up for Index view: ]
[checkbox "recursive" "yes" #spawn_recursive] [label for=spawn_recursive Include subdirectories]
w_tagging(){
local tag category
- printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
+ printf '[a href="#multitag" Add Tags]
+ [div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
printf '[a href="#" Hide][br]'
printf 'Tags\n%s\n' "$w_tagcategories" \