]> git.plutz.net Git - confetti/blobdiff - courses/edit_course.sh
implement course edit and updates
[confetti] / courses / edit_course.sh
index 1841e056b00ffc5038b9c4751bf041dfb4edc1d5..ffe535128154eb4673d50b69f7e26580c004bbfd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/zsh
 
 #!/bin/zsh
 
-# Copyright 2014 Paul Hänsch
+# Copyright 2014, 2019, 2020 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
 #
 # This file is part of Confetti.
 # 
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-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