X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=list.sh;h=e9a98c0ecf8e75d8a338c8d06350d612568edaf9;hb=b3e752c8f50110859bc9e3aaf9d709e2006b3de6;hp=55fe33176901c1c5b207b16f28e81a31f2f25edc;hpb=3aa5a049de785dfe848d69d34606dfc6d05d2638;p=serve0 diff --git a/list.sh b/list.sh index 55fe331..e9a98c0 100644 --- a/list.sh +++ b/list.sh @@ -29,7 +29,7 @@ list_item() { name="$(HTML "$ITEM/$name")" printf '[div .list .file [a href="%s" [img src="%s?a=thumbnail"]][label %s] - [span .time %i:%imin] [span .dim %ix%i] %s + [span .time %i:%02imin] [span .dim %ix%i] %s [checkbox "select" "%s" id="select_%s"][label for="select_%s" +] ]' \ "$link" "$link" "${name##*/}" \ @@ -37,11 +37,11 @@ list_item() { "$width" "$height" \ "$(printf '%s\n' "${tags#tags=}" \ | sed -r "$UNSTRING"' s;^;,;; s;,+;,;g; s;,$;;; - :X s;,([^,]+)(,|$); [span .tag \1]\2;; tX;' + :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;' )" "$name" "$link" "$link" else printf 'Canning record for nonexist file: %s\n' "$name" >&2 - # meta_purge "$_DATA/$ITEM/$name" + meta_purge "$_DATA/$ITEM/$name" fi } @@ -160,10 +160,16 @@ list_paginate() { done printf ']' + [ $(( c % LISTSIZE )) -gt 0 ] \ + && end=$((c / LISTSIZE + 1)) \ + || end=$((c / LISTSIZE)) + printf '[div .pagination' - for n in $( seq 1 $((c / LISTSIZE + 1)) ); do - printf '[a .page href="%s" %s]' \ - "?p=$(( (n - 1) * LISTSIZE + 1))&${qry}" "$n" + for n in $( seq 1 $end ); do + c=$(( (n - 1) * LISTSIZE + 1 )) + [ $c = $page ] \ + && printf '[a .page .current href="%s" %s]' "?p=${c}&${qry}" "$n" \ + || printf '[a .page href="%s" %s]' "?p=${c}&${qry}" "$n" done printf ']' } @@ -190,13 +196,18 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' [form method=POST action="?a=multitag"' list_items \ | list_paginate - printf ' - [div #editing - [a href="#multitag" Add Tags]' + [ -d "$_DATA/$ITEM/.index" ] && { printf ' + [div #editing' w_tagging - w_index - printf ' - ] - ] + printf ' + ]'; } + printf ' + ]' + [ ! -d "$_DATA/$ITEM/.index" ] && { printf ' + [div #editing' + w_index + printf ' + ]'; } + printf ' ] ] '; } | "$_EXEC/cgilite/html-sh.sed"