From: paul Date: Thu, 7 Apr 2016 01:21:46 +0000 (+0000) Subject: dynamic therapy section X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=c8980226006bdd5a9d518e7d3221dc3d527be321;p=lobster dynamic therapy section svn path=/trunk/; revision=89 --- diff --git a/actions/static_file.sh b/actions/static_file.sh new file mode 100755 index 0000000..0b16fc1 --- /dev/null +++ b/actions/static_file.sh @@ -0,0 +1,38 @@ +#!/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 . + +BR=' +' +file="$(invalidate "${_GET[name]}" '\.' 'none')" +file="$_EXEC/templates/$file" + +if [ -f "$file" ]; then + case "${file##*.}" in + png) printf 'Content-Type: image/png';; + html) printf 'Content-Type: text/html';; + txt) printf 'Content-Type: text/plain';; + *) printf 'Content-Type: application/octet-stream';; + esac + printf '\r\n' + printf 'Content-Length: %s\r\n' "$(stat -c %s "$file")" + printf '\r\n' + cat "$file" +else + printf 'HTTP/1.1 404 Not Found\n\n' +fi diff --git a/actions/update_therapy.sh b/actions/update_therapy.sh new file mode 100755 index 0000000..43a2e1f --- /dev/null +++ b/actions/update_therapy.sh @@ -0,0 +1,56 @@ +#!/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 . + +BR=' +' +tpy="${_POST[id]}" + +tpyfile="$_DATA/therapies/$tpy" +tempfile="$_DATA/temp/$tpy" + +# serialize POST array into file +for key in ${(k)_POST}; do + printf %s:%s\\n "$key" "${_POST[$key]//$BR/\\n}" +done >"$tempfile" + +if [ -n "$_POST[delete_session]" ]; then + n="$_POST[delete_session]" + sed -i -r '/^session'$n'[_:]/d' "$tempfile" + rm "${tpyfile%.tpy}_session${n}.png" + + while grep -Eq '^session'$(($n + 1))'_' "$tempfile"; do + sed -i -r 's;^session'$(($n + 1))'(_|:);session'$n'\1;' "$tempfile" + mv "${tpyfile%.tpy}_session$(($n+1)).png" "${tpyfile%.tpy}_session${n}.png" + n=$(($n+1)) + done + +elif [ -n "$_POST[new_session]" ]; then + sid="$_POST[new_session]" + printf '%s:exists\n' "$sid" >>"$tempfile" + + identify "$_EXEC/templates/therapy_background.png" \ + | sed -r 's;^.* ([0-9]+x[0-9]+) .*$;\1;' \ + | read dim + + convert -size "$dim" xc:transparent "${tpyfile%.tpy}_${sid}.png" +fi + +mv "$tempfile" "$tpyfile" + +redirect "?p=therapy&id=${tpy}" diff --git a/pages/therapy.sh b/pages/therapy.sh index 571333e..6127b4d 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,8 +26,26 @@ BR=' id="$_GET[id]" tpyfile="$_DATA/therapies/$id" +mpxfile="$_DATA/prescriptions/${id%.tpy}.mpx" +client="$_DATA/vcard/${id%%.*}.vcf" + +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%%:*}]="${val//\\n/$BR}" +done + +tpy=() cat "$tpyfile" |while read -r line; do val="${line#*:}" tpy[${line%%:*}]="${val//\\n/$BR}" diff --git a/templates/text_therapy.sh b/templates/text_therapy.sh new file mode 100755 index 0000000..d0a3202 --- /dev/null +++ b/templates/text_therapy.sh @@ -0,0 +1,22 @@ +# 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 . + +. $_EXEC/templates/text_prescriptions.sh + +item_name[prescriptionlist]="Zur Verordnungsliste" +item_name[delete_session]="Therapiesitzung entfernen" +item_name[therapist]="Therapeut" diff --git a/templates/therapy.css.sh b/templates/therapy.css.sh index d6221e1..8a87a8e 100755 --- a/templates/therapy.css.sh +++ b/templates/therapy.css.sh @@ -6,6 +6,7 @@ body { position: relative; width: 100%; margin: 0; padding: 0; + padding-top: 2em; } input.tab { display: none; } @@ -31,30 +32,63 @@ input.color[value="c101"] + label { background-color: #F0F;} input.color[value="c110"] + label { background-color: #FF0;} input.color[value="c111"] + label { background-color: #FFF;} -h1, label.tab, div.tab, +h1, label.tab, div.tab, fieldset.tab, div.patient, div.prescription { display: block; width: 96%; margin: 0 2%; } + +div.prescription .insurance{ display: block; margin: .5ex 0 1ex 0; } +div.prescription label.checkbox, +div.prescription label.radio { padding-left: 1.25em; font-size: 1em;} + +div.prescription label.checkbox:before, +div.prescription label.radio:before { + display: inline-block; + color: #000; + background-color: #FFF; + height: 1.375em; width: 1.125em; + padding: .125em 0 0 .375em; + margin: 0 .5em .25em -1.25em; + border: 1px solid #000; + vertical-align: middle; + content: ' '; +} +div.prescription label.radio:before { border-radius: .5em;} +div.prescription label.checkbox.checked:before, +div.prescription label.radio.checked:before { content: "\2713";} + +div.prescription label[for=prescreviewed] { + margin-left: 1ex; + font-weight: bold; + text-decoration: underline; + background-color: #FCC; +} +div.prescription label[for=prescreviewed].checked { + font-weight: normal; + text-decoration: none; + background-color: transparent; +} + fieldset.color { margin: .5em 2% 0 2%; border: none; padding: 0; } -img.dotmark { +.dotmark { max-width: 96%; margin: .125em 2%; padding: 0; text-align: left; border: 1px dotted black; } -img.dotmark.ov { +.dotmark.ov { position: absolute; bottom: 5px; right: 0%; z-index: 1; } @media(min-width: 800px){ - h1, label.tab, div.tab, + h1, label.tab, div.tab, fieldset.tab, div.patient, div.prescription { width: 38%; margin-right: 0; @@ -65,14 +99,14 @@ img.dotmark.ov { right: 0; top: 0em; } - img.dotmark { + .dotmark { position: fixed; max-width: 56%; max-height: 480px; right: 0; top: 2em; } - img.dotmark.ov { + .dotmark.ov { position: fixed; bottom: auto; } @@ -87,12 +121,13 @@ div.prescription { padding: .125em 1.25ex .5em 1.25ex; } div > h2 { margin: 0; border-bottom: 1px solid black; } -div > a:first-of-type { +div:nth-child(n+2) > a:first-of-type { display: block; margin: .125em 0 .5em 0; text-decoration: none; } +fieldset.tab, label.tab { font-size: 1.25em; font-weight: bold; @@ -101,6 +136,7 @@ label.tab { background-color: #333; margin-top: .125em; text-align: right; + border: none; } label.heading { background-color: #FFF; @@ -113,11 +149,13 @@ label.heading > span { text-decoration: underline; } +fieldset.tab > *, +label > input, label > span { display: inline-block; text-align: right; } -label > span.no { +.tab > .no { width: 10%; float: left; border: solid 1px #FFF; background-color: #555; @@ -129,13 +167,14 @@ label.heading > span.no { background-color: inherit; border: none; } -label > span.date { width: 30%; } -label > span.therapist { width: 40%; } -label > span.signature { width: 10%; } -label > span.signature > button { display: inline-block; margin: 0; } +.tab > .date { width: 30%; } +.tab > .therapist { width: 40%; } +.tab > .signature { width: 10%; } +.tab > .signature > button { display: inline-block; margin: 0; } +fieldset.tab > button[type=submit] { width: 5%; text-align: center; margin-left: 5%;} -button[value=pos], button[value=neg] { - display: block; +.signature > button[value=pos], +.signature > button[value=neg] { margin-bottom: .25em; border: 1px solid black; height: 1.5em; width: 1.5em; @@ -144,8 +183,23 @@ button[value=pos], button[value=neg] { color: #000; white-space: nowrap; } -button[value=pos]::before { padding: 0 1ex 0 .25ex; content: "\2713"; } -button[value=neg]::before { padding: 0 1ex 0 .25ex; content: "\00a0 \00a0 \00a0"; } +.signature > input[type=checkbox] {display: none;} +.signature > button[value=neg]::before { padding: 0 1ex 0 .25ex; content: "\2713"; } +.signature > button[value=pos]::before { padding: 0 1ex 0 .25ex; content: "\00a0 \00a0 \00a0"; } + +input.tab + label.tab > input.date, +input.tab + label.tab > input.therapist { + display: none; +} +input.tab:checked + label.tab > input.date, +input.tab:checked + label.tab > input.therapist { + display: inline; +} +input.tab:checked + label.tab > span.date, +input.tab:checked + label.tab > span.therapist { + display: none; +} + div.tab { border: 2px solid #333; @@ -173,6 +227,7 @@ div.tab > fieldset.note > input.color[value="c101"]:checked ~ textarea { backgro div.tab > fieldset.note > input.color[value="c110"]:checked ~ textarea { background-color: #FF8; } div.tab > fieldset.note > input.color[value="c111"]:checked ~ textarea { background-color: #FFF; } +div.tab > button.delete {float: right; display: inline-block;} EOF # vi:set filetype=css: diff --git a/templates/therapy.html.sh b/templates/therapy.html.sh index cb3cf26..f6533f7 100755 --- a/templates/therapy.html.sh +++ b/templates/therapy.html.sh @@ -15,27 +15,147 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. 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 + + case "$tpy[$color]" in + c000) c0=checked;; + c001) c1=checked;; + c010) c2=checked;; + c011) c3=checked;; + c100) c4=checked;; + c101) c5=checked;; + c110) c6=checked;; + *) c7=checked;; + esac + +cat < + + + + + + + + + + +EOF +} + +t_session(){ + session_n="$1" + + sid=session${session_n} + + if [ "$tpy[${sid}_sigset]" = pos ]; then + sig=neg + sigcheck=checked + elif [ "$tpy[${sid}_sigset]" = neg ]; then + sig=pos + unset sigcheck + elif [ "$tpy[${sid}_signature]" = pos ]; then + sig=neg + sigcheck=checked + else + sig=pos + unset sigcheck + fi + +cat < + + +
+ + $(n=1; while [ -n "${tpy[${sid}_note${n}]+x}" ]; do + t_session_note $session_n $n + n=$(($n+1)) + done + printf '' "$sid" "$n" + ) + + + +
+EOF +} + +therapy_sessions(){ + n=1; while [ -n "${tpy[session${n}]}" ]; do + t_session $n + n=$(($n+1)) + done + + sid=session$n + +cat < + … + + + +EOF +} + +unset c0 c1 c2 c3 c4 c5 c6 c7 +case "$tpy[color]" in + c001) c1=checked;; + c010) c2=checked;; + c011) c3=checked;; + c100) c4=checked;; + c101) c5=checked;; + c110) c6=checked;; + c111) c7=checked;; + *) c0=checked;; +esac + cat <

Behandlungen

-

Flrbrlprrf Zoidberg

- < zur Patientenliste - Gemeinsame Betriebskrankenkasse der Gesellschaften der Textilgruppe Hof +

$client_name

+ < $(l10n prescriptionlist)
-

Verordnung

- +

$(l10n therapy_prescription)

+ ${mpx[insurance]} +
    -
  • 6x MT
  • -
  • 6x Fango
  • + ${mpx[remidy]:+
  • ${mpx[quantity]} ${mpx[remidy]}
  • } + ${mpx[remidy1]:+
  • ${mpx[quantity1]} ${mpx[remidy1]}
  • }
- ??? - + + ${mpx[addcontrib]:+ + + }
+
+ + - - -
- - -
- - - - - - - - - -
- -
- - - - - - - - - -
- -
- - - - - - - - - -
- -
- - - - -
- - -
- - - - - - - - - -
- -
+ $(therapy_sessions)
- - - - - - - - + + + + + + + +
- + +
EOF