]> git.plutz.net Git - lobster/blobdiff - therapies/index.cgi
make loading prescrition file optional
[lobster] / therapies / index.cgi
index f142d2180de1a20a6844577bb120e4557d957ada..515f2b0265308042562f291f0a93a61ad7af6d2f 100755 (executable)
@@ -46,12 +46,6 @@ esac
 . $_EXEC/pdiread.sh
 . $_EXEC/therapies/l10n.sh
 
-# unescape() { [ $# = 0 ] && sed -E 's;\\(.);\1;g' || printf %s "$*" |sed -E 's;\\(.);\1;g'; }
-# upcase=' y;abcdefghijklmnopqrstuvwxyzäöüé;ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉ;; '
-
-BR='
-'
-
 id="${_PATH#/therapies/}"
 id="${id%/*}.${id#*/}"
 
@@ -64,12 +58,12 @@ mpxfile="${_DATA}/prescriptions/${id}.mpx"
 tpyfile="${_DATA}/therapies/${id}.tpy"
 
 vcf="$(pdi_load "$vcffile")"
-mpx="$(sed '1s;^;\n;; s/:/;:/' "$mpxfile")"
+mpx="$([ -f "$mpxfile" ] && sed '1s;^;\n;; s/:/;:/' "$mpxfile")"
 tpy="$(sed '1s;^;\n;; s/:/;:/' "$tpyfile")"
 
 VCF(){ pdi_value "$vcf" "$@"; }
 MPX(){ pdi_value "$mpx" "$@"; }
-TPY(){ pdi_value "$tpy" "$@"; }
+TPY(){ pdi_value "$tpy" "$@" >/dev/null && pdi_value "$tpy" "$@" |pdi_unescape; }
 
 . $_EXEC/therapies/page.sh \
 | yield_page therapy /therapies/therapy.css