]> git.plutz.net Git - confetti/blobdiff - actions/new_course.sh
implemented course section
[confetti] / actions / new_course.sh
diff --git a/actions/new_course.sh b/actions/new_course.sh
new file mode 100644 (file)
index 0000000..7be0f26
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/zsh
+
+cgi_post
+
+uid=$(dbus-uuidgen)
+course="${uid}.ics"
+
+tzid=$(cat /etc/timezone)
+tstamp=$(TZ="$tzid" date +%Y%m%dT%H%M%S)
+
+tempfile="$_DATA/temp/$course"
+
+cat >"$tempfile" <<EOF
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:Berlin RAW Confetti
+BEGIN:VEVENT
+UID:$uid
+DTSTAMP:TZID=${tzid}:${tstamp}
+DTSTART:
+DURATION:
+RRULE:
+SUMMARY:
+COMMENT:
+END:VEVENT
+END:VCARD
+EOF
+
+echo -n "Location: http://$HTTP_HOST/?page=courses&edit=$course\n\n"