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
<span class="help">Up to <b>10</b> filter boxes will appear as you start selecting tags. You can select <b>multiple</b> tags in each box by holding down the <b>Ctrl</b>-key. Click the "<b>Filter!</b>" button when you are ready.</span>
$(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 "
<div class="filter" id=\"filter$n\" $([ $n -gt 0 ] && echo 'style="display:none;"')>
<span class=\"help conjunction\">and</span>
<span class=\"label category\">Category:</span>
<select class=\"input category\" name=\"category$n\" size=\"1\" onchange=\"${hideall}show_block('${n}_'+this.options[this.options.selectedIndex].value)\">
<option>none</option>
- $(sed -rn 's;^([^:]+):.*$;<option>\1</option>;p' <<<"$taglist" |sort -u)
+ $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;<option>\1</option>;p' |sort -u)
</select>
- <select class=\"input tagfilter\" name=\"filter${n}_\" size=\"12\" multiple id=\"${n}_none\"
+ <select class=\"input tagfilter\" name=\"cfilter${n}_\" size=\"12\" multiple id=\"${n}_none\"
onchange=\"show_iblock('filter$((1+$n))')\">
- $(sed -rn 's;^([^:]+)$;<option>\1</option>;p' <<<"$taglist")
+ $(echo "$taglist" |sed -rn 's;^([^:]+)$;<option>\1</option>;p')
</select>
- $(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 "
<select class=\"input tagfilter\" name=\"cfilter${n}_\" size=\"12\" multiple id=\"${n}_$cat\" style=\"display:none;\"
onchange=\"show_iblock('filter$((1+$n))')\">
- $(sed -rn "s;^$cat:(.*)$;<option>\\1</option>;p" <<<"$taglist")
+ $(echo "$taglist" |sed -rn 's;^'"$cat"':(.*)$;<option>\1</option>;p')
</select>"
done)
</div>"