$(view_card "$client")
-
-
-
-
-
-
-EOF
-
-list_prescriptions "$client" |grep -q "$edit" || edit_prescription "$edit"
-
-list_prescriptions "$client" \
-|while read pre; do
- [ "$pre" = "$edit" ] \
- && edit_prescription "$pre" \
- || view_prescription "$pre"
-done
-
-#
-
-# vi:set filetype=html:
+locktimeout=900
+. "$_EXEC"/session_lock.sh
+
+uid="$(timeid)$(randomid)" # 32 Octets UID, starting with timestamp
+course="${uid}.ics"
+
+tzid="$(cat /etc/timezone)"
+tstamp="$(TZ="$tzid" date +%Y%m%dT%H%M%S)"
+
+coursefile="$_DATA/ical/$course"
+
+if tempfile="$(SLOCK "$coursefile")"; then
+ cat >"$tempfile" <<-EOF
+ BEGIN:VCALENDAR
+ VERSION:2.0
+ PRODID:Berlin RAW Confetti
+ BEGIN:VEVENT
+ UID:$uid
+ DTSTAMP:TZID=${tzid}:${tstamp}
+ DTSTART:TZID=${tzid}:${tstamp}
+ DURATION:
+ RRULE:
+ SUMMARY:
+ COMMENT:
+ END:VEVENT
+ END:VCARD
+ EOF
+ REDIRECT "/courses/?e=${course}"
+else
+ SET_COOKIE session message="EDITLOCK"
+ REDIRECT "/courses/"
+fi