cat="$(POST cat_$n)"
for m in $(seq 1 $(POST_COUNT tag_$n)); do
tag="$(POST tag_$n $m)"
- [ ! "${tag##${cat}:*}" ] || [ "$cat" = '*' -a "${tag##*:*}" ] \
+ [ ! "${tag##${cat}:*}" ] || [ ! "${tag##-${cat}:*}" ] || [ "$cat" = '*' -a "${tag##*:*}" ] \
&& f="${f}${tag}|"
done
f="${f%[|^]}^"
"$width" "$height" \
"$(printf '%s\n' "${tags#tags=}" \
| sed -r "$UNSTRING"' s;^;,;; s;,+;,;g; s;,$;;;
- :X s;,([^,]+)(,|$); [span .tag\n \1]\2;; tX;'
+ :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;'
)" "$name" "$link" "$link"
else
printf 'Canning record for nonexist file: %s\n' "$name" >&2
read -r length width height tags comment fn <<-EOF
$(meta_info "$file")
EOF
- tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
if [ ! "$deltags" ]; then
+ extags="$(printf '%s' "$newtags" |tr , '\n' |grep -e "^-" |cut -d: -f1 )"
+ tags="$(UNSTRING "${tags#tags=}" |tr , '\n' |grep -vwFe "$extags")"
+ if printf %s "$extags" |grep -vq :; then
+ tags="$(printf %s\\n "$tags" |grep -vE '^-[^:]+$')"
+ fi
tags="$(printf '%s\n' "${tags},${newtags}" \
| tr , '\n' |sort -u |tr '\n' , \
| STRING)"
else
+ tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
detag="${deltags},"; while [ "$detag" ]; do
tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%,*}")"
detag="${detag#*,}"
' "$(HTML "${ITEM##*/}" |sed -r "$w_ascii"' s;[^0-9a-zA-Z&#];&[wbr];g')" \
"$((length / 60))" "$((length % 60))" "$width" "$height" \
"$(printf '%s\n' "${tags#tags=}" |sed -r "$UNSTRING"'
- s;^;,;; s;,+;,;g; s;,$;;; :X s;,([^,]+)(,|$); [span .tag\n \1]\2;; tX;'
+ s;^;,;; s;,+;,;g; s;,$;;; :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;'
)"
printf '
[div #editing
done
} |sort -rn |cut -f2- |HTML |sed "$w_ascii s- -\n-g; s;\n\n;\n;g;" |tee "$w_tags" )"
w_tagcategories="$(printf %s "$w_tags" \
- | cut -sd: -f1 |sort -u \
+ | sed -rn '/:/s;^-?([^:]+):.*$;\1;p' |sort -u \
| tee "$w_tagcategories" )"
else
w_tags="$(cat "$w_tags")"
}
w_advsearch(){
- local n lbid tag category filter f t
+ local n lbid tag category filter f t d
filter="$(HTML "${FILTER}^" |sed "$w_ascii")"
printf '[form #advsearch action=?a=advsearch method=POST
t=''
[ "$category" = '*' -a "${f%%|${category}:*}" ] && t=checked
[ "$category" != '*' -a ! "${f%%|${category}:*}" ] && t=checked
+ [ "$category" != '*' -a ! "${f%%|-${category}:*}" ] && t=checked
printf '[radio "cat_%i" "%s" .cat %s id="%s"][label for="%s" %s]
[select name=tag_%s size=10 multiple' \
| { [ "$category" = '*' ] && grep -avF ':' || grep -awF "${category}"; } \
| { for n in 1 2 3 4 5 6 7 8 9 0; do
read -r line && printf '%s\n' "$line" || break;
- done; # path 10 lines through without modification
+ done; # pass 10 lines through without modification
sort; # and sort remaining lines
} | while read -r tag; do
[ "$tag" ] || continue
t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked
- printf '[option %s value="%s"\n%s]' "$t" "$tag" "${tag#*:}"
+ d="${tag#-}"; d="${d#*:}"
+ printf '[option %s value="%s"\n%s]' "$t" "$tag" "$d"
done
printf '\n]'
done
}
w_tagging(){
- local tag category
+ local tag category d
printf '[a href="#multitag" Add Tags / Remove Tags]
[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
printf '[a href="#" Hide][br]'
sort;
} | while read -r tag; do
[ "$tag" ] || continue
- printf '[option value="%s"\n%s]' "$tag" "${tag#*:}"
+ d="${tag#-}"; d="${d#*:}"
+ printf '[option value="%s"\n%s]' "$tag" "$d"
done
printf ']]'
done