}
#advsearch .help {
display: block;
- margin: -1em 1em 1em 1em;
+ margin: -1em .625em 1em .625em;
padding: .5em 1em;
background-color: #444;
line-height: 1.5em;
display: inline-block;
vertical-align: top;
margin: 0 .5% 1em .5%;
- width: 4%;
+ width: 4%; min-width: 4em;
padding: .5em 0;
text-align: center;
font-weight: bold;
#advsearch input.and:checked + label:nth-of-type(2),
#advsearch input.and:checked + label { display: none; }
+#advsearch .submit,
#advsearch input.and + label + .select:first-of-type,
#advsearch input.and:checked + label + .select {
display: inline-block;
min-height: 12em;
overflow: hidden;
text-align: left;
+ vertical-align: top;
}
+#advsearch .submit { min-height: 0; }
+#advsearch .submit * { width: 50%; }
+
#advsearch .select input.pol {
margin: .5em .25em 0 .5em;
}
. "$_EXEC/cgilite/storage.sh"
w_refuri="$(HTML "$REQUEST_URI")"
+
w_tags="$(find "$_DATA/" -path '*/.index/meta' -print0 \
| xargs -r0 cut -f4 \
| cut -d= -f2- |tr , '\n' | sort -u)"
w_tags="$(UNSTRING "$w_tags")"
+w_tagcategories="$(printf %s "$w_tags" |cut -sd: -f1 |sort -u)"
w_search(){
printf '
][fieldset .select
[input .pol type="radio" name=pol_%i %s id="pol_pos_%i"][label for=pol_pos_%i Any]
[input .pol type="radio" name=pol_%i %s id="pol_neg_%i"][label for=pol_neg_%i None]
- [label .head Category:]
- [input .cat type=radio name="cat_%i" %s id="%s" ][label for="%s" %s]
- [select name=tag_%s size=10 multiple="multiple"' \
+ [label .head Category:]' \
$n "$([ "$f" ] && printf 'checked="checked"')" $n \
- $n "$([ "$f" -a \! "${f%%~*}" ] || printf 'checked="checked"')" $n $n \
- $n "$([ "$f" -a \! "${f%%~*}" ] && printf 'checked="checked"')" $n $n \
- $n "$([ "$f" = "${f%:*}" ] && printf 'checked="checked"')" "$lbid" "$lbid" "(none)" \
- $n
-
+ $n "$([ "$f" -a ! "${f%%~*}" ] || printf 'checked="checked"')" $n $n \
+ $n "$([ "$f" -a ! "${f%%~*}" ] && printf 'checked="checked"')" $n $n
f="|${f#~}|"
- printf %s "$w_tags" |grep -vF ":" \
- | while read -r tag; do
- [ ! "$tag" ] && continue
- tg="$(HTML "$tag")"
- printf '[option %s value="%s" %s]' \
- "$([ "$f" != "${f%|${tag}|*}" ] && printf 'selected="selected"')" \
- "$tg" "$tg"
- done
- printf ']'
- printf %s "$w_tags" |cut -sd: -f1 |sort -u \
+
+ printf '*\n%s\n' "$w_tagcategories" \
| while read -r category; do
lbid="$(HTML "cat_${n}_${category}")"
- printf '[input .cat type=radio name="cat_%i" %s id="%s"][label for="%s" %s]
+ printf '[input .cat type=radio %s name="cat_%i" id="%s"][label for="%s" %s]
[select name=tag_%s size=10 multiple="multiple"' \
- $n "$([ "$f" != "${f%|${category}:*}" ] && printf 'checked="checked"')" \
- "$lbid" "$lbid" "$(HTML "$category")" $n
- printf %s "$w_tags" |grep -wF "${category}" \
+ "$([ ! "${f%%*|${category}:*}" -o ! "${category%\*}" ] && printf 'checked="checked"')" \
+ $n "$lbid" "$lbid" "$(HTML "$category")" $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" %s]' \
- "$([ "$f" != "${f%|${tag}|*}" ] && printf 'selected="selected"')" \
+ "$([ ! "${f%%*|${tag}|*}" ] && printf 'selected="selected"')" \
"$tg" "$tn"
done
- printf ']'
+ printf '\n]'
done
printf ']'
done
- printf ']'
+ printf '[fieldset .submit [select name=order
+ [option disabled=disabled Order By]
+ [option value=Name Name]
+ [option value=Date Date]
+ [option value=Length Length]
+ ][button type=submit Apply Filter]]
+ ]'
}
w_tagging(){
printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
printf '[a href="#" Hide][br]'
- printf '[fieldset [legend %s:][select name=tag size=4 multiple' "Tags"
- printf %s "$w_tags" |grep -vF ":" \
- | while read -r tag; do
- [ ! "$tag" ] && continue
- printf '[option value="%s" %s]' "$(HTML "$tag")" "$(HTML "$tag")"
- done
- printf ']]'
-
- printf %s "$w_tags" |cut -sd: -f1 |sort -u \
+ printf 'Tags\n%s\n' "$w_tagcategories" \
| while read -r category; do
printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$(HTML "$category")"
- printf %s "$w_tags" |grep -wF "${category}" \
+ printf %s "$w_tags" \
+ | { [ "$category" = 'Tags' ] && grep -vF ':' || grep -wF "${category}"; } \
| while read -r tag; do
+ [ ! "$tag" ] && continue
tag="$(HTML "$tag")"; tn="${tag#*:}"
printf '[option value="%s" %s]' "$tag" "$tn"
done