From: paul Date: Fri, 3 Jul 2015 13:48:23 +0000 (+0000) Subject: make filters reusable X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=fbbdc301af283f01aa39c3fed65c2ad190dcf112;p=serve0 make filters reusable svn path=/trunk/; revision=59 --- diff --git a/pages/filter.sh b/pages/filter.sh index 629a08f..c19589b 100755 --- a/pages/filter.sh +++ b/pages/filter.sh @@ -19,6 +19,9 @@ . $_EXEC/pages/common.sh +filters="$(echo -E "$_GET[\"f\"]" |sed -r 's;^!r*\^*;;; s;\^*!*$;;; s;!+;!;g; s;\^+;^;g')" +debug "FILTERS: $filters" + case "$1" in title) echo "Videos" diff --git a/templates/filter.html.sh b/templates/filter.html.sh index 0ba32bb..368591e 100755 --- a/templates/filter.html.sh +++ b/templates/filter.html.sh @@ -34,23 +34,46 @@ cat <Up to 10 filter boxes will appear as you start selecting tags. You can select multiple tags in each box by holding down the Ctrl-key. Click the "Filter!" button when you are ready.

$(for n in {0..9}; do + filter="$(echo -E "$filters" |cut -d^ -f$(($n+1)))" + fneg="${filter%%[a-zA-Z]*}" + filter="${filter#!}" + fcat="${filter%%:*}" + [ "$fcat" = "$filter" ] && fcat=none + + debug "fneg: $fneg fcat: $fcat filter: $filter" + cat <<-EOF - +
- - + + of the items selected here:
- $( {echo none; echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u} \ +
+ + + +
+ $( echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u \ |while read cat; do echo "
- +
" @@ -63,9 +86,9 @@ cat <