X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=list.sh;h=18799f3ec3af2f77442224ca7191d62aeca1d88f;hb=6505a2726aa04b8b0b37af689535bde67f99238a;hp=d729c6c34a8c35c11a590752bc35378c62b3b8ba;hpb=e141ec4a5b7d0ec0da9fd9e3860bd003ad2d758e;p=serve0 diff --git a/list.sh b/list.sh index d729c6c..18799f3 100644 --- a/list.sh +++ b/list.sh @@ -4,9 +4,10 @@ . "$_EXEC/widgets.sh" list_item() { - local name path length width height tags comment n + local name link path length width height tags comment n name="$(HTML "$1")" - path="$(URL "$ITEM/$1")" + link="$(URL "$ITEM/$1")" + path="$(HTML "$ITEM/$1")" qry=$(HTML "$QUERY_STRING") if [ -d "$_DATA/$ITEM/$1" ]; then @@ -16,11 +17,11 @@ list_item() { $(meta_info "$_DATA/$ITEM/$1") EOF 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:%imin] [span .dim %ix%i] %s - [checkbox "select" "%s" id="select_%s" form="multitag"][label for="select_%s" +] + [checkbox "select" "%s" id="select_%s"][label for="select_%s" +] ]' \ - "$path" "$path" "$name" \ + "$link" "$link" "$name" \ "$((length / 60))" "$((length % 60))" \ "$width" "$height" \ "$(UNSTRING "${tags#tags=}" |tr , '\0' |xargs -r0 printf ' [span .tag %s]')" \ @@ -69,27 +70,30 @@ list_filemeta(){ if [ $ORDER = Name ]; then sort -k6 "$meta" elif [ $ORDER = Length ]; then - sort -n "$meta" + sort -n -k1 "$meta" else cat "$meta" fi \ | if [ "$FILTER" ]; then sed -nr "$list_fex" elif [ "${SEARCH#!}" != "${SEARCH}" ]; then - grep -viE "$(STRING "${SEARCH#!}")" + grep -aviE "$(STRING "${SEARCH#!}" |sed -r ':x s;((^|[^\\])(\\\\)*)\+;\1\\+;g; tx;')" else - grep -iE "$(STRING "${SEARCH}")" + grep -aiE "$(STRING "${SEARCH}" \ + | sed -r ':x s;((^|[^\\])(\\\\)*)\+;\1 ;g; tx; + s;((^|[^\\])(\\\\)*)\\\+;\1+;g; + s; ;\\+;g;')" fi |cut -f6 | UNSTRING \ | while read -r fn; do printf '%s\n' "${base}/${fn%${CR}}" - done + done | tee .index/debug } list_index(){ local meta (cd "$_DATA/$ITEM"; find ./ -path '*/.index/meta' - ) | while meta="$(line)"; do + ) | while read -r meta; do list_filemeta "${meta%/.index/meta}" done } @@ -105,7 +109,7 @@ list_dateorder(){ list_items() { local mode - mode="$(COOKIE mode |grep -m1 -xE 'index|browse' || printf browse )" + mode="$(COOKIE mode |grep -m1 -axE 'index|browse' || printf browse )" [ "$mode" = browse -a "$ITEM" ] && printf '..\n' @@ -124,7 +128,7 @@ list_items() { list_paginate() { local page i c n end - page="$(GET p |grep -xE '[0-9]+' || printf 1)"; c=1 + page="$(GET p |grep -axE '[0-9]+' || printf 1)"; c=1 end=$((page + LISTSIZE)) printf '[div .itemlist ' @@ -158,8 +162,9 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' [a #t_avsearch href="#advsearch" Advanced] [a #t_prefs href="#prefs" ⚙] ]' - w_prefs + w_bookmarks w_advsearch + w_prefs printf ' [form method=POST action="?a=multitag"' list_items \