]> git.plutz.net Git - serve0/blobdiff - multitag.sh
allow manual grouping
[serve0] / multitag.sh
index bbbf946425d28419fb90c7d83099acde73b0825c..674983ad626431746700d091655fa305ce7dfc68 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 . "$_EXEC/db_meta.sh"
+. "$_EXEC/cgilite/session.sh" nocookie
 
 newtags=''
 for tn in $(seq 1 $(POST_COUNT tag)); do
@@ -8,6 +9,10 @@ for tn in $(seq 1 $(POST_COUNT tag)); do
 done
 newtags="$(POST newtagn |tr -d '\r' |tr , '\n')${BR}${newtags}"
 
+if [ "$(POST makegroup)" = true ]; then
+  group="$(timeid)"
+fi
+
 while [ "${newtags#${BR}}" != "${newtags}" ]; do newtags="${newtags#${BR}}"; done
 while [ "${newtags%${BR}}" != "${newtags}" ]; do newtags="${newtags%${BR}}"; done
 
@@ -36,5 +41,9 @@ for select in $(seq 1 $(POST_COUNT select)); do
   fi
   tags="${tags#,}"; tags="${tags%,}"
 
-  update_meta "$META_NAME" tags="${tags}"
+  if [ "$group" ]; then
+    update_meta "$META_NAME" tags="${tags}" group="${group}"
+  else
+    update_meta "$META_NAME" tags="${tags}"
+  fi
 done