]> git.plutz.net Git - confetti/blobdiff - courses/export_ical.sh
ical export using cgilite
[confetti] / courses / export_ical.sh
index e595cb68fb9a4d8af629de657f4cf0376bd9ae44..3649ed5e0e21e7229f2c747e246e24216c4b285f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/zsh
 
-# Copyright 2014,2015 Paul Hänsch
+# Copyright 2014,2015,2021 Paul Hänsch
 #
 # 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/>. 
 
-echo -n "Content-Type: text/calendar;charset=utf-8\n\n"
-course="${_GET[course]}"
-cat "$_DATA/ical/$course"
+course="$(GET course |PATH)"
+coursefile="$_DATA/ical/${course##*/}"
+
+. $_EXEC/pdiread.sh
+. $_EXEC/cgilite/file.sh
+
+printf 'Content-Disposition: inline; filename="%s.ics"\r\n' "$(pdi_value "$(pdi_load "$coursefile")" SUMMARY)"
+
+FILE "$coursefile" "text/calendar; charset=utf-8"