X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=list.sh;h=6c09a43ad4983c216666384e77445f0b241d802f;hb=f8c309d40c54fd0c8ad9cb6d9629d778113cb32a;hp=8ba460e066388c267eb53ae16b2df95341ac04d0;hpb=12920444497dab504b5ce596d73f7a10422bed24;p=serve0 diff --git a/list.sh b/list.sh index 8ba460e..6c09a43 100644 --- a/list.sh +++ b/list.sh @@ -9,7 +9,7 @@ list_item() { if [ "$type" = dir ]; then name="${meta%% *}"; - display="$(HTML "$name")"; link="$(URL "$ITEM/$name")" + display="$(HTML "$name")"; link="$(URL "${PATH_INFO%/}/$name")" printf '[a .list .dir href="%s" %s]' "${link}?${w_refuri#*\?}" "$name" return 0 fi @@ -24,23 +24,23 @@ list_item() { if [ "$type" = metashort ]; then name="$(list_fullname "$(UNSTRING "${name%${CR}}")")" fi - if [ -f "$_DATA/$ITEM/$name" ]; then - link="$(URL "$ITEM/$name")" - name="$(HTML "$ITEM/$name")" + if [ -f "$_DATA/${PATH_INFO%/}/$name" ]; then + link="$(URL "${PATH_INFO%/}/${name#./}")" + name="$(HTML "${PATH_INFO%/}/${name#./}")" printf '[div .list .file - [a href="%s" [img src="%s?a=thumbnail"]][label %s] + [a href="%s" [img src="%s?a=thumbnail"]][label . %s] [span .time %i:%02imin] [span .dim %ix%i] %s [checkbox "select" "%s" id="select_%s"][label for="select_%s" +] ]' \ - "$link" "$link" "${name##*/}" \ + "$link" "$link" "${name##/}" \ "$((length / 60))" "$((length % 60))" \ "$width" "$height" \ - "$(printf '%s\n' "${tags#tags=}" \ - | sed -r "$UNSTRING"' s;^;,;; s;,+;,;g; s;,$;;; + "$(UNSTRING "${tags#tags=}" \ + | sed -r 's;^;,;; s;,+;,;g; s;,$;;; :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;' )" "$name" "$link" "$link" else - printf 'Canning record for nonexist file: %s\n' "$name" >&2 + debug "Canning record for nonexist file: $name" meta_purge "$_DATA/$ITEM/$name" fi } @@ -71,7 +71,7 @@ list_fullname(){ list_filter(){ if [ "$FILTER" ]; then - printf "FEX: %s\n" "$list_fex" >&2 + debug "FEX:" "$list_fex" sed -nE "$list_fex" elif [ "${SEARCH#!}" != "${SEARCH}" ]; then grep -aviEe "$(STRING "${SEARCH}" \ @@ -207,13 +207,13 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' printf ' by %s]' "$ORDER" printf ' [meta name="viewport" content="width=device-width"] + [link rel=stylesheet href="/cgilite/common.css" ] [link rel=stylesheet href="/style.css" ] ] [body [div #navigation [a #t_bookmarks href="#bookmarks" ★]' w_search printf ' - [a #t_avsearch href="#advsearch" Advanced] [a #t_prefs href="#prefs" ⚙] ]' w_bookmarks