X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=courses%2Fedit_course.sh;h=ffe535128154eb4673d50b69f7e26580c004bbfd;hp=1841e056b00ffc5038b9c4751bf041dfb4edc1d5;hb=c0302919c54331fc9fe3785f7d2a44e639e1bba0;hpb=43e7c60df0632fd383306a2d3c6dc8c4213d4b9d;ds=inline diff --git a/courses/edit_course.sh b/courses/edit_course.sh index 1841e05..ffe5351 100755 --- a/courses/edit_course.sh +++ b/courses/edit_course.sh @@ -1,6 +1,6 @@ #!/bin/zsh -# Copyright 2014 Paul Hänsch +# Copyright 2014, 2019, 2020 Paul Hänsch # # This file is part of Confetti. # @@ -17,6 +17,18 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -course="${_GET[course]}" +locktimeout=900 +. "$_EXEC"/session_lock.sh -echo -n "Location: ?p=courses&edit=$course\n\n" +course="$(GET course |PATH)" +coursefile="$_DATA/ical/${course##*/}" + +if tempfile="$(SLOCK "$coursefile" "$locktimeout")"; then + REDIRECT "/courses/?e=${course}" +elif [ -f "$tempfile" ]; then + SET_COOKIE session message="SESSLOCK" + REDIRECT "/courses/#${course}" +else + SET_COOKIE session message="EDITLOCK" + REDIRECT "/courses/#${course}" +fi