X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=courses%2Fnew_course.sh;fp=templates%2Fprescriptions.html.sh;h=362752dbb2a70cdd8deb1ec87cac38c1524374fd;hp=c4ef19addc060da015f8db7c6954aaebd23a38f1;hb=76c1e7bff1a8604ef2ef7da5d274d0db0e639139;hpb=90288ab07bb1ec83a91581fadc674a87a250a853 diff --git a/templates/prescriptions.html.sh b/courses/new_course.sh similarity index 51% rename from templates/prescriptions.html.sh rename to courses/new_course.sh index c4ef19a..362752d 100755 --- a/templates/prescriptions.html.sh +++ b/courses/new_course.sh @@ -1,4 +1,6 @@ -# Copyright 2016 Paul Hänsch +#!/bin/sh + +# Copyright 2014, 2021 Paul Hänsch # # This file is part of Confetti. # @@ -15,33 +17,35 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -client="${_GET[client]}" -edit="${_GET[edit]}" -[ -n "$edit" ] && client="${edit%.*.mpx}.vcf" - -cat <$(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