X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=pages%2Ftherapy.sh;h=88855151a8fa27ea9b9f03c66694478fba47f043;hp=571333ec7008d98720597bb42ea5f9c6020033ef;hb=61666ee9e4ce45e915ead39c575493c075c68845;hpb=824bab9c4c5b5ae745a78b43a338d4b068e99cfa diff --git a/pages/therapy.sh b/pages/therapy.sh index 571333e..8885515 100755 --- a/pages/therapy.sh +++ b/pages/therapy.sh @@ -18,6 +18,7 @@ # along with Confetti. If not, see . declare -A tpy +declare -A mpx BR=' ' @@ -25,9 +26,31 @@ BR=' id="$_GET[id]" tpyfile="$_DATA/therapies/$id" +mpxfile="$_DATA/prescriptions/${id%.tpy}.mpx" +client="$_DATA/vcard/${id%%.*}.vcf" + +identify "$_EXEC/static/therapy_background.png" \ +| sed -r 's;^.* ([0-9]+x[0-9]+) .*$;\1;' \ +| read bg_dim + +card_N="$(sed -nr 's:^(N)(;[^"\:]+|;"[^"]+")*\:(.*)$:\3:gp' "$client")" +card_FN="$(sed -nr 's:^(FN)(;[^"\:]+|;"[^"]+")*\:(.*)$:\3:gp' "$client")" +card_NICK="$(sed -nr 's:^(NICKNAME)(;[^"\:]+|;"[^"]+")*\:(.*)$:\3:gp' "$client")" + +n=$(printf %s "$card_N" \ + | sed -rn 's:^([^;]*)(\;[^;]*)(\;[^;]*)?(\;[^;]*)?(\;[^;]*)?$:\4 \2 \3 \1 \5:gp' \ + | sed -r 's:,: :;s:\;: :g;s: +: :g;s:^ $::;' + ) +client_name="${n:-${card_FN:-${card_NICK}}}" mpx=() +cat "$mpxfile" |while read -r line; do + val="${line#*:}" + mpx[${line%%:*}]="$(htmlsafe "${val//\\n/$BR}")" +done + +tpy=() cat "$tpyfile" |while read -r line; do val="${line#*:}" - tpy[${line%%:*}]="${val//\\n/$BR}" + tpy[${line%%:*}]="$(htmlsafe "${val//\\n/$BR}")" done