- printf '[fieldset [legend %s:][select name=tag size=4 multiple' "Tags"
- printf %s "$w_tags" |grep -vF ":" |grep -vxF '' \
- | while read -r tag; do
- printf '[option value="%s" %s]' "$(HTML "$tag")" "$(HTML "$tag")"
+ printf '[form #advsearch action=?a=advsearch method=POST
+ [a href="#" Hide]
+ [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard.[br]
+ Refine the search further by setting additional search tags using the [strong "+and"] button.]
+ '
+
+ for n in 1 2 3 4 5 6 7 8 9 10; do
+ f="${filter%%^*}"; filter="${filter#*^}"
+
+ lbid="$(HTML "cat_${n}_(none)")"
+ printf '[input .and type=checkbox name=and id="and_%i" %s][label for="and_%i" +and
+ ][fieldset .select
+ [radio "pol_%i" "pos" .pol %s #pol_pos_%i"][label for=pol_pos_%i Any]
+ [radio "pol_%i" "neg" .pol %s #pol_neg_%i"][label for=pol_neg_%i None]
+ [label .head Category:]' \
+ $n "$([ "$f" ] && printf checked)" $n \
+ $n "$([ "$f" -a ! "${f%%~*}" ] || printf checked)" $n $n \
+ $n "$([ "$f" -a ! "${f%%~*}" ] && printf checked)" $n $n
+ f="|${f#~}|"
+
+ printf '*\n%s\n' "$w_tagcategories" \
+ | while read -r category; do
+ catn="$(HTML "$category")"
+ lbid="cat_${n}_${catn}"
+ printf '[radio "cat_%i" "%s" .cat id="%s" %s][label for="%s" %s]
+ [select name=tag_%s size=10 multiple' \
+ $n "$catn" "$lbid" \
+ "$([ ! "${f%%*|${category}:*}" -o ! "${category%\*}" ] && printf checked)" \
+ "$lbid" "$catn" $n
+
+ printf %s "$w_tags" \
+ | { [ "$category" = '*' ] && grep -vF ':' || grep -wF "${category}"; } \
+ | while read -r tag; do
+ [ ! "$tag" ] && continue
+ tg="$(HTML "$tag")"; tn="${tg#*:}"
+ printf '[option %s value="%s"\n%s]' \
+ "$([ ! "${f%%*|${tag}|*}" ] && printf selected)" \
+ "$tg" "$tn"
+ done
+ printf '\n]'
+ done
+ printf ']'