X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=newdate.sh;h=9c5a1e71cb9dd654c55cc2642eb46f5ae8963035;hb=ed5aacc277bd81abe427a10080de96d8d6e987c3;hp=e2902e471256cd1dd42e0fd385de94efc7d6c6e6;hpb=1b9f025da80bb30db913635a60e799a3e523f2e1;p=webpoll diff --git a/newdate.sh b/newdate.sh index e2902e4..9c5a1e7 100755 --- a/newdate.sh +++ b/newdate.sh @@ -127,9 +127,13 @@ if [ "$REQUEST_METHOD" = POST ]; then | sort -u )" - if [ "$(POST cancel)" = cancel ]; then - rm -- "$file" - REDIRECT "$_BASE/" + if [ "$(POST delete)" = delete ]; then + if [ "$(POST delconfirm)" -o ! "$(DBM "$file" get participants)" ]; then + rm -- "$file" + REDIRECT "$_BASE/" + else + REDIRECT "$_BASE$PATH_INFO${month:+?month=}${month}#ERROR_NEEDCONFIRM" + fi elif [ "$(POST post)" = post ]; then REDIRECT "$_BASE${PATH_INFO%/*}" elif [ "$(POST bookmark)" -a ! "$bookmarks" ]; then @@ -161,8 +165,12 @@ else [hidden "month" "$month"] ] $([ "$splittimes" = "yes" ] && fs_splittimes || fs_timeofday ) - [submit "cancel" "cancel" Cancel] - [submit "post" "post" Post Event] + $(if [ "$(DBM "$file" get participants)" ]; then + printf '[checkbox "delconfirm" "confirm" id="delconfirm"][label for=delconfirm Delete Poll] + [submit "delete" "delete" Delete Poll] [submit "post" "post" Poll page]' + else + printf '[submit "delete" "delete" Cancel] [submit "post" "post" Post Event]' + fi) $(if [ "$bookmarks" ]; then printf '[section .bookmark This admin page is accessible via the link [a href="%s" %s]. You must copy this link and keep it safe, so you can modify this poll later! The poll has also been bookmarked and will be listed on the front page.' \ "$(URL "//$(HEADER Host)/${_BASE}/${id}/${admin}")" \