From: Paul Hänsch Date: Wed, 8 Jan 2020 18:45:55 +0000 (+0100) Subject: functions for easyer tpy/mpx file parsing, deliver png overlays X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=993c5a9ed5aead587f52ba129e7978d10dafe2c4;p=lobster functions for easyer tpy/mpx file parsing, deliver png overlays --- diff --git a/therapies/index.cgi b/therapies/index.cgi index 8512410..62b621d 100755 --- a/therapies/index.cgi +++ b/therapies/index.cgi @@ -17,11 +17,20 @@ # You should have received a copy of the GNU Affero General Public License # along with Lobster. If not, see . -if [ "$_PATH" = "/therapies/therapy.css" ]; then - . $_EXEC/cgilite/file.sh - FILE $_EXEC/therapies/therapy.css - return 0 -fi +case "$_PATH" in + /therapies/therapy.css) + . $_EXEC/cgilite/file.sh + FILE $_EXEC/therapies/therapy.css + return 0 + ;; + /therapies/*.*_session*.png) + if [ -r "$_DATA/$_PATH" ]; then + . $_EXEC/cgilite/file.sh + FILE "$_DATA/$_PATH" + fi + return 0 + ;; +esac . $_EXEC/pdiread.sh . $_EXEC/therapies/l10n.sh @@ -36,16 +45,22 @@ BR=' id="${_PATH#/therapies/}" id="${id%/*}.${id#*/}" -vcffile="${_DATA}/vcard/${id%.*}.vcf" -mpxfile="${_DATA}/prescriptions/${id}.mpx" -tpyfile="${_DATA}/therapies/${id}.tpy" read junkx junky bg_dim junkz <<-E_READ $(identify "$_EXEC/therapies/therapy_background.png") E_READ +vcffile="${_DATA}/vcard/${id%.*}.vcf" +mpxfile="${_DATA}/prescriptions/${id}.mpx" +tpyfile="${_DATA}/therapies/${id}.tpy" + vcf="$(pdi_load "$vcffile")" -mpx="$(pdi_load "$mpxfile")" -tpy="$(pdi_load "$tpyfile")" +mpx="$(sed '1s;^;\n;; s/:/;:/' "$mpxfile")" +tpy="$(sed '1s;^;\n;; s/:/;:/' "$tpyfile")" + +VCF(){ pdi_value "$vcf" "$@"; } +MPX(){ pdi_value "$mpx" "$@"; } +TPY(){ pdi_value "$tpy" "$@"; } -. $_EXEC/therapies/page.sh |yield_page therapy /therapies/therapy.css +. $_EXEC/therapies/page.sh \ +| yield_page therapy /therapies/therapy.css