4 . "$_EXEC/cgilite/session.sh" nocookie
7 for tn in $(seq 1 $(POST_COUNT tag)); do
8 newtags="$(POST tag $tn)${BR}${newtags}"
10 newtags="$(POST newtagn |tr -d '\r' |tr , '\n')${BR}${newtags}"
12 if [ "$(POST makegroup)" = true ]; then
16 while [ "${newtags#${BR}}" != "${newtags}" ]; do newtags="${newtags#${BR}}"; done
17 while [ "${newtags%${BR}}" != "${newtags}" ]; do newtags="${newtags%${BR}}"; done
19 [ "$(POST op)" = del ] && deltags="$newtags"
21 for select in $(seq 1 $(POST_COUNT select)); do
22 file="$(POST select $select)"
24 read_meta "${file%.*}" || continue
25 tags="$(printf %s\\n "$META_TAGS" |tr , \\n)"
27 if [ ! "$deltags" ]; then
28 extags="$(printf '%s' "${newtags}" |grep -e "^-" |cut -d: -f1 )"
29 [ "$extags" ] && tags="$(printf %s\\n "$tags" |grep -vwFe "$extags")"
30 if printf %s "${newtags}" |grep -e "^-" |grep -qEe "^-[^:]+$"; then
31 tags="$(printf %s\\n "$tags" |grep -vEe '^-[^:]+$')"
33 tags="$(printf '%s\n' "${tags},${newtags}" \
34 | tr , '\n' |sort -u |tr '\n' ,)"
36 detag="${deltags}${BR}"; while [ "$detag" ]; do
37 tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%${BR}*}")"
38 detag="${detag#*${BR}}"
40 tags="$(printf '%s\n' "$tags" |sort -u |tr '\n' ,)"
42 tags="${tags#,}"; tags="${tags%,}"
45 update_meta "$META_NAME" tags="${tags}" group="${group}"
47 update_meta "$META_NAME" tags="${tags}"