splittimes="$(POST splittimes |grep -m 1 -xE 'yes|no')"
addtime="$(POST addtime)"
- [ "$splittimes" ] && DBM "$file" set splittimes "$splittimes" || splittimes="$(DBM "$file" get splittimes || printf no)"
+ if [ "$splittimes" = yes ]; then
+ DBM "$file" set splittimes "$splittimes"
+ splittimes="no" # receive remainder of todall form
+ elif [ "$splittimes" = no ]; then
+ DBM "$file" set splittimes "$splittimes"
+ splittimes="yes" # receive remainder of splittimes form
+ else
+ splittimes="$(DBM "$file" get splittimes || printf no)"
+ fi
DBM "$file" set title "$(POST title)"
DBM "$file" set description "$(POST description)"
- DBM "$file" set dates "$(
- for date in $(seq 0 $(POST_COUNT date)); do
- [ "$date" -eq 0 ] \
- && POST date_add \
- || POST date "$date"
- printf \\n
- done \
- | grep -vxF "$(POST date_remove)" \
- | grep -xE '^[0-9]{4}-((01|03|05|07|08|10|12)-([012][0-9]|3[01])|(04|06|09|11)-([012][0-9]|30)|02-[012][0-9])$' \
- | sort -u
- )"
-
# Store common time options "todall"
[ "$splittimes" = no ] && DBM "$file" set todall "$(
for todcount in $(seq 1 $(POST_COUNT todstart)); do
[ "$addtime" = "$date" ] && DBM "$file" append "tod_${date}" "${BR}-"
done
+ DBM "$file" set dates "$(
+ for date in $(seq 0 $(POST_COUNT date)); do
+ [ "$date" -eq 0 ] \
+ && POST date_add \
+ || POST date "$date"
+ printf \\n
+ done \
+ | grep -vxF "$(POST date_remove)" \
+ | grep -xE '^[0-9]{4}-((01|03|05|07|08|10|12)-([012][0-9]|3[01])|(04|06|09|11)-([012][0-9]|30)|02-[012][0-9])$' \
+ | sort -u
+ )"
+
if [ "$(POST cancel)" = cancel ]; then
rm -- "$file"
REDIRECT "$_BASE/"