]> git.plutz.net Git - confetti/blobdiff - courses/export_pdf.sh
styling for iban assignment
[confetti] / courses / export_pdf.sh
index 3985b2c878babd32673a00883cc944f999716cdf..92e10c5f900626b0805da4224f3b5599bcbec039 100755 (executable)
@@ -7,16 +7,16 @@ coursefile="${_DATA}/ical/$(GET course)"
 
 if [ ! -r "$coursefile" ]; then
   SET_COOKIE 0 message="Cannot read course file"
-  REDIRECT /courses/
+  REDIRECT "${_BASE}/courses/"
   return 0
 elif ! mkdir -p "$_DATA/export"; then
   SET_COOKIE 0 message="Cannot create export directory"
-  REDIRECT /courses/
+  REDIRECT "${_BASE}/courses/"
   return 0
 fi
 
 ics="$(pdi_load "$coursefile")"
-htmlfile="${_DATA}/export/$(pdi_value "$ics" SUMMARY |URL |tr / _).html"
+htmlfile="${_DATA}/export/$(pdi_value "$ics" SUMMARY |unescape |tr \\n/ __).html"
 pdffile=${htmlfile%.html}.pdf
 
 pdi_date() {
@@ -123,5 +123,10 @@ style_td='style="border: 1pt solid; padding: 1mm 2mm; vertical-align: top;"'
 ]]
 EOF
 
-lowriter --convert-to pdf --outdir "$_DATA/export/" "$htmlfile"
-REDIRECT "/export/${pdffile##*/}"
+export            HOME="$_DATA/"
+export XDG_CONFIG_HOME="$_DATA/xdg_config"
+export  XDG_CACHE_HOME="$_DATA/xdg_cache"
+export   XDG_DATA_HOME="$_DATA/xdg_local"
+
+lowriter --convert-to pdf --outdir "$_DATA/export/" "$htmlfile" >/dev/null
+REDIRECT "$(URL "${_BASE}/export/${pdffile##*/}")"