From fbbdc301af283f01aa39c3fed65c2ad190dcf112 Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 3 Jul 2015 13:48:23 +0000 Subject: [PATCH] make filters reusable svn path=/trunk/; revision=59 --- pages/filter.sh | 3 +++ templates/filter.html.sh | 41 +++++++++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) 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 <

-- 2.39.2