X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=therapies%2Findex.cgi;h=f142d2180de1a20a6844577bb120e4557d957ada;hb=7aab9839b794a48adaf4b3049fc0b8a999d925f8;hp=8512410fbeabf84f2cc96ef0256e7700b5f03e13;hpb=531f71462dfbc0eeebd74c74c84323c14475f51a;p=lobster diff --git a/therapies/index.cgi b/therapies/index.cgi index 8512410..f142d21 100755 --- a/therapies/index.cgi +++ b/therapies/index.cgi @@ -17,16 +17,34 @@ # 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 + ;; + /therapies/*/new) + card="${_PATH#/therapies/}" + card="${card%/new}" + uid="$(timeid)$(randomid)" + if [ -f "${_DATA}/vcard/${card}.vcf" ]; then + touch "${_DATA}/therapies/${card}.${uid}.tpy" + rm -f "${_DATA}/cache/${card}.vcf.cache" + REDIRECT "/therapies/${card}/${uid}" + fi + return 0 + ;; +esac . $_EXEC/pdiread.sh . $_EXEC/therapies/l10n.sh -# . $_EXEC/cards/widgets.sh -# . $_EXEC/cards/list.sh # unescape() { [ $# = 0 ] && sed -E 's;\\(.);\1;g' || printf %s "$*" |sed -E 's;\\(.);\1;g'; } # upcase=' y;abcdefghijklmnopqrstuvwxyzäöüé;ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉ;; ' @@ -36,16 +54,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