From: Paul Hänsch Date: Wed, 8 Jan 2020 01:03:28 +0000 (+0100) Subject: stub rewrite of therapy section X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=531f71462dfbc0eeebd74c74c84323c14475f51a;p=lobster stub rewrite of therapy section --- diff --git a/therapies/index.cgi b/therapies/index.cgi new file mode 100755 index 0000000..8512410 --- /dev/null +++ b/therapies/index.cgi @@ -0,0 +1,51 @@ +#!/bin/sh + +# Copyright 2016, 2020 Paul Hänsch +# +# This file is part of Lobster. +# +# Lobster is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Lobster is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# 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 + +. $_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ÄÖÜÉ;; ' + +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 + +vcf="$(pdi_load "$vcffile")" +mpx="$(pdi_load "$mpxfile")" +tpy="$(pdi_load "$tpyfile")" + +. $_EXEC/therapies/page.sh |yield_page therapy /therapies/therapy.css diff --git a/therapy/text_therapy.sh b/therapies/l10n.sh similarity index 53% rename from therapy/text_therapy.sh rename to therapies/l10n.sh index a2735b2..bac84e7 100755 --- a/therapy/text_therapy.sh +++ b/therapies/l10n.sh @@ -1,4 +1,4 @@ -# Copyright 2016 Paul Hänsch +# Copyright 2016, 2020 Paul Hänsch # # This file is part of Confetti. # @@ -15,13 +15,21 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -. $_EXEC/templates/text_prescriptions.sh - -item_name[prescriptionlist]="Zur Verordnungsliste" -item_name[delete_session]="Therapiesitzung entfernen" -item_name[therapist]="Therapeut" -item_name[number]="Nr." -item_name[signature]="Un­ter­schrift" -item_name[weekly]="p. Woche" -item_name[notes]="Notizen" -item_name[trailsave]="Speichern für weitere Felder" +#. $_EXEC/templates/text_prescriptions.sh +l10n(){ + local word + [ $# -eq 0 ] && read -r word || word="$1" + case $word in + prescriptionlist) printf "Zur Verordnungsliste";; + delete_session) printf "Therapiesitzung entfernen";; + therapist) printf "Therapeut";; + number) printf "Nr.";; + signature) printf "Un­ter­schrift";; + weekly) printf "p. Woche";; + notes) printf "Notizen";; + trailsave) printf "Speichern für weitere Felder";; + # *) . $_EXEC/templates/text_prescriptions.sh + # l10n "$word" + # ;; + esac +} diff --git a/therapies/page.sh b/therapies/page.sh new file mode 100755 index 0000000..c3f3c5c --- /dev/null +++ b/therapies/page.sh @@ -0,0 +1,227 @@ +# Copyright 2016, 2017, 2020 Paul Hänsch +# +# This file is part of Lobster. +# +# Confetti is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Lobster is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Lobster. If not, see . + +# t_session_note(){ +# session_n="$1" +# note_n="$2" +# +# color=session${session_n}_note${note_n}_color +# unset c0 c1 c2 c3 c4 c5 c6 c7 +# +# if [ "$note_n" -eq 1 -o -n "${tpy[session${session_n}_note${note_n}]}" ]; then +# printf '' +# else +# printf '' +# fi +# +# _checked="$(validate "$tpy[$color]" '#(888|00A|0A0|0AA|A00|A0A|AA0)' '#FFF')" +# cat <<-EOF +#
+# +# +# +# +# +# +# +# +# +#
+# EOF +# } +# +# t_session(){ +# session_n="$1" +# +# sid=session${session_n} +# +# if [ "$tpy[${sid}_sigset]" = pos ]; then +# sigcheck=checked +# else +# unset sigcheck +# fi +# +# cat <<-EOF +# +# +# +#
+# +# $(n=1; +# while [ -n "${tpy[session${session_n}_note${n}]+x}" ]; do +# if [ -n "${tpy[session${session_n}_note${n}]}" ]; then +# x=$n +# fi +# n=$(($n + 1)) +# done +# for n in $(seq 1 $((${x:-0} + 3)) ); do t_session_note $session_n $n; done +# ) +# +# +#
+# EOF +# } +# +# therapy_sessions(){ +# n=1; while [ -n "${tpy[session${n}]}" ]; do +# t_session $n +# n=$(($n+1)) +# done +# +# sid=session$n +# +# cat <<-EOF +#
+# +# +#
+# EOF +# } + +cat <. - -t_session_note(){ - session_n="$1" - note_n="$2" - - color=session${session_n}_note${note_n}_color - unset c0 c1 c2 c3 c4 c5 c6 c7 - - if [ "$note_n" -eq 1 -o -n "${tpy[session${session_n}_note${note_n}]}" ]; then - printf '' - else - printf '' - fi - - _checked="$(validate "$tpy[$color]" '#(888|00A|0A0|0AA|A00|A0A|AA0)' '#FFF')" - cat <<-EOF -
- - - - - - - - - -
- EOF -} - -t_session(){ - session_n="$1" - - sid=session${session_n} - - if [ "$tpy[${sid}_sigset]" = pos ]; then - sigcheck=checked - else - unset sigcheck - fi - - cat <<-EOF - - - -
- - $(n=1; - while [ -n "${tpy[session${session_n}_note${n}]+x}" ]; do - if [ -n "${tpy[session${session_n}_note${n}]}" ]; then - x=$n - fi - n=$(($n + 1)) - done - for n in $(seq 1 $((${x:-0} + 3)) ); do t_session_note $session_n $n; done - ) - - -
- EOF -} - -therapy_sessions(){ - n=1; while [ -n "${tpy[session${n}]}" ]; do - t_session $n - n=$(($n+1)) - done - - sid=session$n - - cat <<-EOF -
- - -
- EOF -} - -cat <$(l10n therapy) - -
-

$client_name

- < $(l10n prescriptionlist) -
- -
-

$(l10n therapy_prescription)

- ${mpx[insurance]} - ${mpx[date]} - - - - ${mpx[prescno]:+$(l10n presc${mpx[prescno]})} - ${mpx[grouptherapy]:+$(l10n grouptherapy)} - ${mpx[housecall]:+$(l10n housecall)} - ${mpx[report]:+$(l10n report)} - -
    $(for n in '' {0..10}; do - [ -n "${mpx[remidy$n]}" ] && \ - printf '
  • %s %s %s
  • ' "${mpx[quantity$n]}" \ - "${mpx[remidy$n]}" \ - "${mpx[quantity_weekly$n]:+($mpx[quantity_weekly$n] $(l10n weekly))}" - done)
- - ${mpx[indicator]:+${mpx[indicator]}} - ${mpx[icd10]:+ ${mpx[icd10]}} - - ${mpx[addcontrib]:+ - - } - - - -
${mpx[indicator_reading]}
-
- -
- - - -
- -

$(l10n notes)

- - -
- - -
- -

$(l10n timesheet)

- - - - $(for n in '' {0..10}; do - printf ' - - - \n' \ - "$mpx[tsgoal${n}]" "$mpx[tsactual${n}]" "$((${mpx[tsgoal${n}]:-0} - ${mpx[tsactual${n}]:-0}))" - done) -
$(l10n time_goal)$(l10n time_actual)$(l10n time_difference)
%s
- -
- - - - -EOF - -therapy_sessions - -_checked="$(validate "$tpy[penwidth]" '(4|12|36)' '4')" -cat < - - - - -EOF - -_checked="$(validate "$tpy[color]" '#(0[0A]{2}|A00|A0A|AA0|FFF)' '#000')" -cat < - - - - - - - - - - WARNING: Background Image not available! - - - - - - - - - - -EOF - -# vi:set filetype=html: diff --git a/therapy/therapy.sh b/therapy/therapy.sh deleted file mode 100755 index 8885515..0000000 --- a/therapy/therapy.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/zsh - -# Copyright 2016 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -declare -A tpy -declare -A mpx - -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%%:*}]="$(htmlsafe "${val//\\n/$BR}")" -done