From 16a8c233e95c6bd55ac52a6fa95c0ab25c9ff113 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 22 Sep 2014 01:10:01 +0000 Subject: [PATCH] simplified filter mechanism svn path=/trunk/; revision=15 --- actions/filter.sh | 10 +--------- templates/filterdiag.html.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/actions/filter.sh b/actions/filter.sh index 32f867d..ea0f85c 100755 --- a/actions/filter.sh +++ b/actions/filter.sh @@ -14,19 +14,11 @@ for fn in {0..9}; do egrep -q '(^|\^|\||!)$' <<<"$filters" || filters="${filters}^" fi - n='' - while [ -n "$_POST[\"filter${fn}_$n\"]" ]; do - filter="$(echo "$_POST[\"filter${fn}_$n\"]" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)" - egrep -q '(^|\^|\||!)$' <<<"${filters}" || filters="${filters}|" - filters="${filters}${filter}" - [ -z "$n" ] && n=0 || n=$(($n + 1)) - done - n='' while [ -n "$_POST[\"cfilter${fn}_$n\"]" ]; do cfilter="$(echo "$_POST[\"cfilter${fn}_$n\"]" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)" egrep -q '(^|\^|\||!)$' <<<"${filters}" || filters="${filters}|" - filters="${filters}${category}:${cfilter}" + [ "$category" = "none" ] && filters="${filters}${cfilter}" || filters="${filters}${category}:${cfilter}" [ -z "$n" ] && n=0 || n=$(($n + 1)) done done diff --git a/templates/filterdiag.html.sh b/templates/filterdiag.html.sh index 9a38888..3e81b28 100755 --- a/templates/filterdiag.html.sh +++ b/templates/filterdiag.html.sh @@ -44,7 +44,7 @@ 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 - hideall="$(sed -rn "s;^([^:]+):.*$;hide('${n}_\\1')\\;;p" <<<"$taglist" |sort -u)hide('${n}_none');" + hideall="$(echo "$taglist" |sed -rn "s;^([^:]+):.*$;hide('${n}_\\1')\\;;p" |sort -u)hide('${n}_none');" echo "
and @@ -54,16 +54,16 @@ cat <Category: - - $(sed -rn 's;^([^:]+):.*$;\1;p' <<<"$taglist" |sort -u |while read cat; do echo " + $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u |while read cat; do echo " " done)
" -- 2.39.2