include_widgets="$0"
. "$_EXEC/cgilite/storage.sh"
+. "$_EXEC/db_meta.sh"
w_refuri="$(URL "$PATH_INFO")?$(HTML "$QUERY_STRING")"
if [ ! -s "$c_tags" -o ! -s "$c_tagcategories" ] \
|| [ "$(find "$_DATA/" -path '*/.index/meta' -newer "$c_tags")" ]
then
- w_tags="$( local cn=1
- find "$_DATA/" -path '*/.index/meta' -print0 \
- | xargs -r0 sed -r '
- s;^.*\t.*\t.*\ttags=(.*)\tcomment=.*\t.*\r$;\1;;
- s;,;\n;g;'"$UNSTRING" \
- | { sort; printf '\n'; } \
- | while read -r tag; do
- [ "$tag" = "$otag" ] \
- && cn=$((cn + 1)) \
- || {
- printf "%i %s\n" "$cn" "$otag"
- cn=1
- }
- otag="$tag"
- done \
- |sort -rn |cut -f2- |HTML \
- |sed "s-
-\n-g; s;\n\n;\n;g;"
+ w_tags="$(
+ list_meta |sed -E '
+ s;^.*\ttags=([^\t]*)\t.*$;\1;;
+ s;,;\n;g;
+ ' \
+ | sort |uniq -c |sort -rn |sed -E 's;^ *[0-9]+ ;;;' \
+ | UNSTRING | HTML \
+ | sed -E 's;
\;;\n;g; s;\n+;\n;g;'
)"
w_tagcategories="$(printf %s "$w_tags" | sed -rn '/:/s;^-?([^:]+):.*$;\1;p' |sort -u )"
printf %s "$w_tags" >"$c_tags"
$n "${t:+checked}" $n $n
f="|${f#\~}|"
- printf '*\n%s\n' "$w_tagcategories" \
+ printf '*\n%s\n$\n' "$w_tagcategories" \
| while read -r category; do
lbid="cat_${n}_${category}"
# printf '[option %s value="%s"\n%s]' "$t" "$tag" "$d"
printf '[label [checkbox "tag_%s" "%s" %s] %s]' "$n" "$tag" "$t" "$d"
done
+ d="${f##*\$:}" d="${d%%\|*}"
+ [ "$category" = \$ ] && printf '[input name="tag_%i" value="%s"]' "$n" "$(HTML "$d")"
printf '\n]'
done
printf ']'