X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Ffilter_card.sh;fp=cards%2Ffilter_card.sh;h=9c79459fab9fe4b84dda311bd7e70c8d876c8caa;hp=d09adabc07cf5f23c8b9d5925cf296835f3cb09a;hb=516b1d6b0427b42924a60bd63ed48d8087a9e4e8;hpb=d5fb0b81bce3f19153b9c74f4bc17fe7a3043a7c diff --git a/cards/filter_card.sh b/cards/filter_card.sh index d09adab..9c79459 100755 --- a/cards/filter_card.sh +++ b/cards/filter_card.sh @@ -20,7 +20,17 @@ if [ "$(POST choice)" = new_filter ]; then filter="$( seq 0 100 |while read n; do - printf %s "$(POST filter$n)" + filter_type="$(POST "filter_type${n}")" + filter_text="$(POST "filter_text${n}")" + [ ! "$filter_type" -a ! "$filter_text" ] && break + if [ "$filter_type" = CATEGORIES ]; then + printf '^CATEGORIES:' + seq 0 $(POST_COUNT filter_cat$n) |while read m; do + printf '|%s' "$(POST filter_cat$n $m)" + done + else + printf '^%s:%s' "$filter_type" "$filter_text" + fi done | sed -r \ 's;\|+;\|;g; s;\^+;\^;g; s;:\|;:;g; :X; s;\^[^:]*:\^;\^;g; /\^[^:]*:\^/bX;