]> git.plutz.net Git - lobster/commitdiff
stub rewrite of therapy section
authorPaul Hänsch <paul@plutz.net>
Wed, 8 Jan 2020 01:03:28 +0000 (02:03 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 8 Jan 2020 01:03:28 +0000 (02:03 +0100)
therapies/index.cgi [new file with mode: 0755]
therapies/l10n.sh [moved from therapy/text_therapy.sh with 53% similarity]
therapies/page.sh [new file with mode: 0755]
therapies/therapy.css [moved from therapy/therapy.css with 100% similarity]
therapies/therapy_background.png [moved from therapy/therapy_background.png with 100% similarity]
therapies/therapy_background.xcf [moved from therapy/therapy_background.xcf with 100% similarity]
therapies/therapy_draw.js [moved from therapy/therapy_draw.js with 100% similarity]
therapies/update_therapy.sh [moved from therapy/update_therapy.sh with 100% similarity]
therapy/therapy.html.sh [deleted file]
therapy/therapy.sh [deleted file]

diff --git a/therapies/index.cgi b/therapies/index.cgi
new file mode 100755 (executable)
index 0000000..8512410
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>. 
+
+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
similarity index 53%
rename from therapy/text_therapy.sh
rename to therapies/l10n.sh
index a2735b2a4745b1f5a5b2196be76dd1ef7d314c4d..bac84e7e437703c502a4e83d96f7e16d32d47081 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2016 Paul Hänsch
+# Copyright 2016, 2020 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-. $_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&shy;ter&shy;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&shy;ter&shy;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 (executable)
index 0000000..c3f3c5c
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>. 
+
+# 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 '<input class="trailbtn" type="checkbox" checked="checked">'
+#   else
+#     printf '<input class="trailbtn" type="checkbox">'
+#   fi
+# 
+#   _checked="$(validate "$tpy[$color]" '#(888|00A|0A0|0AA|A00|A0A|AA0)' '#FFF')"
+#      cat <<-EOF
+#        <fieldset class="note trailbox">
+#          <input class=color type=radio name="$color" value="#888" id=${color}_000 $(checked \#888)><label for=${color}_000></label>
+#          <input class=color type=radio name="$color" value="#00A" id=${color}_001 $(checked \#00A)><label for=${color}_001></label>
+#          <input class=color type=radio name="$color" value="#0A0" id=${color}_010 $(checked \#0A0)><label for=${color}_010></label>
+#          <input class=color type=radio name="$color" value="#0AA" id=${color}_011 $(checked \#0AA)><label for=${color}_011></label>
+#          <input class=color type=radio name="$color" value="#A00" id=${color}_100 $(checked \#A00)><label for=${color}_100></label>
+#          <input class=color type=radio name="$color" value="#A0A" id=${color}_101 $(checked \#A0A)><label for=${color}_101></label>
+#          <input class=color type=radio name="$color" value="#AA0" id=${color}_110 $(checked \#AA0)><label for=${color}_110></label>
+#          <input class=color type=radio name="$color" value="#FFF" id=${color}_111 $(checked \#FFF)><label for=${color}_111></label>
+#          <textarea name="session${session_n}_note${note_n}">${tpy[session${session_n}_note${note_n}]}</textarea>
+#        </fieldset>
+#      EOF
+# }
+# 
+# t_session(){
+#   session_n="$1"
+# 
+#   sid=session${session_n}
+# 
+#   if [ "$tpy[${sid}_sigset]" = pos ]; then
+#     sigcheck=checked
+#   else
+#     unset sigcheck
+#   fi
+# 
+#      cat <<-EOF
+#        <input type=hidden name=$sid value=exists>
+#        <input class="tab" type="checkbox" id=${sid}_open name="${sid}_open" value="checked" ${tpy[${sid}_open]}>
+#        <label class="tab" for="${sid}_open">
+#          <span class=no>${session_n}.</span><!--
+#       --><span class=date>${tpy[${sid}_date]}</span><!--
+#       --><input class="date" name="${sid}_date" value="${tpy[${sid}_date]}" placeholder="$(l10n date)"><!--
+#       --><span class=therapist>${tpy[${sid}_therapist]}</span><!--
+#       --><input class="therapist" name="${sid}_therapist" value="${tpy[${sid}_therapist]}" placeholder="$(l10n therapist)"><!--
+#       --><span class=signature><input type="checkbox" name="${sid}_sigset" value="pos" $sigcheck></span>
+#        </label>
+#        <div class=tab>
+#          <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
+#          $(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
+#              )
+#          <button class="trailbtn" type="submit">$(l10n trailsave)</button>
+#          <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
+#        </div>
+#      EOF
+# }
+# 
+# therapy_sessions(){
+#   n=1; while [ -n "${tpy[session${n}]}" ]; do
+#     t_session $n
+#     n=$(($n+1))
+#   done
+# 
+#   sid=session$n
+# 
+#      cat <<-EOF
+#        <fieldset class="tab">
+#          <button class=no type=submit name=new_session value=$sid>+</button><!--
+#       --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
+#       --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
+#       --><span class=signature><span></span>
+#          <input type=hidden name="${sid}_note1" value="">
+#        </fieldset>
+#      EOF
+# }
+
+cat <<EOF
+[h1 $(l10n therapy)]
+
+[div .patient
+  [h2 . $(pdi_value "$vcf" FN)]
+  [a href="/cards/#${id%.*}.vcf" \< $(l10n client)]
+]
+
+[div .prescription
+  [h2 $(l10n therapy_prescription)]
+  [span .insurance . $(pdi_value "$mpx" INSURANCE)]
+  [span .date [label $(l10n date):] $(pdi_value "$mpx" DATE)]
+EOF
+
+  if [ "$(pdi_value "$mpx" PRESCREVIEWED)" ]; then
+    printf '[label .checkbox .checked for=prescreviewed . %s]' "$(l10n prescreviewed)"
+  else
+    printf '[label .checkbox for=prescreviewed . %s]' "$(l10n prescreview)"
+  fi
+
+  field="$(pdi_value "$mpx" PRESCNO)"
+  [ "$field" ] && printf '[span .prescno . %s]' "$(l10n "presc$field")"
+  for field in grouptherapy housecall report; do
+    [ "$(pdi_value "$mpx" "$field")" ] && printf '[span .catalogue . %s]' "$(l10n "$field")"
+  done
+
+  printf '[ul'
+  for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
+    remidy="$(pdi_value "$mpx" REMIDY$n)"
+    quantity="$(pdi_value "$mpx" QUANTITY$n)"
+    quantity_weekly="$(pdi_value "$mpx" QUANTITY_WEEKLY$n)"
+
+    if [ "$remidy" -a "$quantity_weekly" ]; then
+      printf '[li %s %s %s]' "$quantity" "$remidy" "$quantity_weekly $(l10n weekly)"
+    elif [ "$remidy" ]; then
+      printf '[li %s %s]' "$quantity" "$remidy"
+    fi
+  done
+  printf ']'
+
+  for field in indicator icd10; do
+    val="$(pdi_value "$mpx" "$field")"
+    [ "$val" ] && printf '[span .%s [label . %s:]%s]' "$field" "$(l10n "$field")" "$val"
+  done
+
+  addcontrib="$(pdi_value "$mpx" ADDCONTRIB)"
+  contribconfirm="$(pdi_value "$mpx" CONTRIBCONFIRM)"
+
+  if [ "$addcontrib" -a "$contribconfirm" ]; then
+    printf '[label .checkbox .checked for=addcontrib . %s %s]' "$(l10n contribconfirm)" "$contribconfirm"
+  elif [ "$addcontrib" ]; then
+    printf '[label .checkbox for=addcontrib . %s]' "$(l10n addcontrib)"
+  fi
+
+cat <<EOF
+  [input .tab type="checkbox" #indicator_reading][label .tab for=indicator_reading $(l10n indicator_reading)]
+  [div .tab . $(pdi_value "$mpx" INDICATOR_READING)]
+]
+
+[form #report method=POST action="/therapies/update_therapy.sh"
+  [input type=hidden name=id value="$id"]
+
+  [input .stickynote type=checkbox name=c_stickynote #show_stickynote]
+  [fieldset .stickynote
+    [label for="show_stickynote" $(l10n notes)]
+    [h2 $(l10n notes)]
+    [textarea name=stickynote . $(pdi_value "$tpy" STICKYNOTE)]
+    [button type=submit $(l10n save)]
+  ]
+
+  [input .stickynote type=checkbox name=c_timesheet #show_timesheet]
+  [fieldset .stickynote
+    [label for="show_timesheet" $(l10n timesheet)]
+    [h2 $(l10n timesheet)]
+    [table [thead [tr
+      [th $(l10n time_goal)][th $(l10n time_actual)][th $(l10n time_difference)]
+    ]][tbody
+      $(for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
+        tsgoal="$(pdi_value "$tpy" TSGOAL$n)"
+        tsactual="$(pdi_value "$tpy" TSACTUAL$n)"
+        printf '[tr [td [input type=number name=tsgoal value="%s"]][td [input type=number name=tsactual value="%s"]][td %s]]' \
+               "$tsgoal" "$tsactual" "$(( ${tsgoal:-0} - ${tsactual:-0} ))"
+      done)
+    ]]
+    [button type=submit $(l10n save)]
+  ]
+
+  [label .tab .heading
+    [span .no $(l10n number)][span .date $(l10n date)][span .therapist $(l10n therapist)][span .signature $(l10n signature)]
+  ]
+EOF
+
+# therapy_sessions
+
+penwith="$(pdi_value "$tpy" PENWITH |grep -xE -m1 '(4|12|36)' || printf '4')"
+color="$(pdi_value "$tpy" COLOR |grep -xE -m1 '#(000|00A|0A0|0AA|A00|A0A|AA0|FFF)' || printf '#000')"
+cat <<EOF
+  [fieldset .penwidth
+    [radio "penwidth" "4"  #pw1 $(checked $penwidth 4) ][label for="pw2"]
+    [radio "penwidth" "12" #pw2 $(checked $penwidth 12)][label for="pw3"]
+    [radio "penwidth" "36" #pw3 $(checked $penwidth 36)][label for="pw1"]
+  ]
+  [fieldset .color
+    [radio "color" "#000" .color #c000 $(checked $color '#000') ][label for=c000 ]
+    [radio "color" "#00A" .color #c001 $(checked $color '#00A') ][label for=c001 ]
+    [radio "color" "#0A0" .color #c010 $(checked $color '#0A0') ][label for=c010 ]
+    [radio "color" "#0AA" .color #c011 $(checked $color '#0AA') ][label for=c011 ]
+    [radio "color" "#A00" .color #c100 $(checked $color '#A00') ][label for=c100 ]
+    [radio "color" "#A0A" .color #c101 $(checked $color '#A0A') ][label for=c101 ]
+    [radio "color" "#AA0" .color #c110 $(checked $color '#AA0') ][label for=c110 ]
+    [radio "color" "#FFF" .color #c111 $(checked $color '#FFF') ][label for=c111 ]
+  ]
+  [img .dotmark .bg src="/therapies/therapy_background.png" alt="WARNING: Missing background image!"]
+  [canvas #canvas .dotmark .ov width="${bg_dim%x*}" height="${bg_dim#*x}" ]
+  [input type=hidden #image_serialize name=imagedata value=""]
+
+  [button type=submit $(l10n save)]
+]
+
+[span #jsdebug style="display: none; position: fixed; right:0; bottom:0" Debug]
+
+[script type="text/javascript" src="/therapies/therapy_draw.js"]
+EOF
similarity index 100%
rename from therapy/therapy.css
rename to therapies/therapy.css
diff --git a/therapy/therapy.html.sh b/therapy/therapy.html.sh
deleted file mode 100755 (executable)
index 1821c24..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-# Copyright 2016, 2017 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 <http://www.gnu.org/licenses/>. 
-
-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 '<input class="trailbtn" type="checkbox" checked="checked">'
-  else
-    printf '<input class="trailbtn" type="checkbox">'
-  fi
-
-  _checked="$(validate "$tpy[$color]" '#(888|00A|0A0|0AA|A00|A0A|AA0)' '#FFF')"
-       cat <<-EOF
-         <fieldset class="note trailbox">
-           <input class=color type=radio name="$color" value="#888" id=${color}_000 $(checked \#888)><label for=${color}_000></label>
-           <input class=color type=radio name="$color" value="#00A" id=${color}_001 $(checked \#00A)><label for=${color}_001></label>
-           <input class=color type=radio name="$color" value="#0A0" id=${color}_010 $(checked \#0A0)><label for=${color}_010></label>
-           <input class=color type=radio name="$color" value="#0AA" id=${color}_011 $(checked \#0AA)><label for=${color}_011></label>
-           <input class=color type=radio name="$color" value="#A00" id=${color}_100 $(checked \#A00)><label for=${color}_100></label>
-           <input class=color type=radio name="$color" value="#A0A" id=${color}_101 $(checked \#A0A)><label for=${color}_101></label>
-           <input class=color type=radio name="$color" value="#AA0" id=${color}_110 $(checked \#AA0)><label for=${color}_110></label>
-           <input class=color type=radio name="$color" value="#FFF" id=${color}_111 $(checked \#FFF)><label for=${color}_111></label>
-           <textarea name="session${session_n}_note${note_n}">${tpy[session${session_n}_note${note_n}]}</textarea>
-         </fieldset>
-       EOF
-}
-
-t_session(){
-  session_n="$1"
-
-  sid=session${session_n}
-
-  if [ "$tpy[${sid}_sigset]" = pos ]; then
-    sigcheck=checked
-  else
-    unset sigcheck
-  fi
-
-       cat <<-EOF
-         <input type=hidden name=$sid value=exists>
-         <input class="tab" type="checkbox" id=${sid}_open name="${sid}_open" value="checked" ${tpy[${sid}_open]}>
-         <label class="tab" for="${sid}_open">
-           <span class=no>${session_n}.</span><!--
-        --><span class=date>${tpy[${sid}_date]}</span><!--
-        --><input class="date" name="${sid}_date" value="${tpy[${sid}_date]}" placeholder="$(l10n date)"><!--
-        --><span class=therapist>${tpy[${sid}_therapist]}</span><!--
-        --><input class="therapist" name="${sid}_therapist" value="${tpy[${sid}_therapist]}" placeholder="$(l10n therapist)"><!--
-        --><span class=signature><input type="checkbox" name="${sid}_sigset" value="pos" $sigcheck></span>
-         </label>
-         <div class=tab>
-           <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
-           $(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
-             )
-           <button class="trailbtn" type="submit">$(l10n trailsave)</button>
-           <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
-         </div>
-       EOF
-}
-
-therapy_sessions(){
-  n=1; while [ -n "${tpy[session${n}]}" ]; do
-    t_session $n
-    n=$(($n+1))
-  done
-
-  sid=session$n
-
-       cat <<-EOF
-         <fieldset class="tab">
-           <button class=no type=submit name=new_session value=$sid>+</button><!--
-        --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
-        --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
-        --><span class=signature><span></span>
-           <input type=hidden name="${sid}_note1" value="">
-         </fieldset>
-       EOF
-}
-
-cat <<EOF
-<h1>$(l10n therapy)</h1>
-
-<div class="patient">
-  <h2>$client_name</h2>
-  <a href="?p=prescriptions&amp;client=${id%%.*}.vcf">&lt; $(l10n prescriptionlist)</a>
-</div>
-
-<div class="prescription">
-  <h2>$(l10n therapy_prescription)</h2>
-  <span class="insurance">${mpx[insurance]}</span>
-  <span class="date"><label>$(l10n date):</label>${mpx[date]}</span>
-
-  <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
-    $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
-                                     || printf %s "$(l10n prescreview)" )
-  </label>
-
-       ${mpx[prescno]:+<span class="prescno">$(l10n presc${mpx[prescno]})</span>}
-  ${mpx[grouptherapy]:+<span class="catalogue">$(l10n grouptherapy)</span>}
-     ${mpx[housecall]:+<span class="catalogue">$(l10n housecall)</span>}
-        ${mpx[report]:+<span class="catalogue">$(l10n report)</span>}
-
-  <ul>$(for n in '' {0..10}; do
-    [ -n "${mpx[remidy$n]}" ] && \
-    printf '<li>%s %s %s</li>' "${mpx[quantity$n]}" \
-                               "${mpx[remidy$n]}" \
-                               "${mpx[quantity_weekly$n]:+($mpx[quantity_weekly$n] $(l10n weekly))}"
-  done)</ul>
-
-  ${mpx[indicator]:+<span class="indicator"><label>$(l10n indicator):</label>${mpx[indicator]}</span>}
-      ${mpx[icd10]:+<span class="icd10">    <label>$(l10n icd10):</label>${mpx[icd10]}</span>}
-
-  ${mpx[addcontrib]:+
-  <label class='checkbox ${mpx[contribconfirm]:+checked}' for="addcontrib">
-    $([ -n "${mpx[contribconfirm]}" ] && printf %s "$(l10n contribconfirm)" ${mpx[contribconfirm]} \
-                                      || printf %s "$(l10n addcontrib)" )
-  </label>
-  }
-
-  <input class="tab" type="checkbox" id="indicator_reading">
-  <label class="tab" for="indicator_reading">$(l10n indicator_reading)</label>
-  <div class="tab">${mpx[indicator_reading]}</div>
-</div>
-
-<form id="report" method="POST" action="?action=update_therapy">
-  <input type="hidden" name="id" value="${id}">
-
-  <input class="stickynote" type="checkbox" name="c_stickynote" id="show_stickynote">
-  <fieldset class="stickynote">
-    <label for="show_stickynote">$(l10n notes)</label>
-    <h2>$(l10n notes)</h2>
-    <textarea name="stickynote">${tpy[stickynote]}</textarea>
-    <button type="submit">$(l10n save)</button>
-  </fieldset>
-
-  <input class="stickynote" type="checkbox" name="c_timesheet" id="show_timesheet">
-  <fieldset class="stickynote">
-    <label for="show_timesheet">$(l10n timesheet)</label>
-    <h2>$(l10n timesheet)</h2>
-    <table><thead>
-      <tr><th>$(l10n time_goal)</th><th>$(l10n time_actual)</th><th>$(l10n time_difference)</th></tr>
-    </thead><tbody>
-      $(for n in '' {0..10}; do
-        printf '<tr><td><input type="number" name="tsgoal" value="%s"/></td>
-                    <td><input type="number" name="tsactual" value="%s"/></td>
-                    <td>%s</td>
-                </tr>\n' \
-                "$mpx[tsgoal${n}]" "$mpx[tsactual${n}]" "$((${mpx[tsgoal${n}]:-0} - ${mpx[tsactual${n}]:-0}))"
-      done)
-    </tbody></table>
-    <button type="submit">$(l10n save)</button>
-  </fieldset>
-
-  <!--input class="tab" type="checkbox" id="lookout">
-  <label class="tab" for="lookout">$(l10n indicator_reading)</label>
-  <div class="tab"><textarea name="lookout">${mpx[lookout]}</textarea -->
-
-  <label class="tab heading">
-    <span class=no>$(l10n number)</span><!--
- --><span class=date>$(l10n date)</span><!--
- --><span class=therapist>$(l10n therapist)</span><!--
- --><span class=signature>$(l10n signature)</span>
-  </label>
-EOF
-
-therapy_sessions
-
-_checked="$(validate "$tpy[penwidth]" '(4|12|36)' '4')"
-cat <<EOF
-  <fieldset class="penwidth">
-    <input type="radio" name="penwidth" value="4"  id="pw1" $(checked  4)><label for="pw2"></label>
-    <input type="radio" name="penwidth" value="12" id="pw2" $(checked 12)><label for="pw3"></label>
-    <input type="radio" name="penwidth" value="36" id="pw3" $(checked 36)><label for="pw1"></label>
-  </fieldset>
-EOF
-
-_checked="$(validate "$tpy[color]" '#(0[0A]{2}|A00|A0A|AA0|FFF)' '#000')"
-cat <<EOF
-  <fieldset class="color">
-    <input class="color" type="radio" name="color" value="#000" id="c000" $(checked \#000)><label for="c000"></label>
-    <input class="color" type="radio" name="color" value="#00A" id="c001" $(checked \#00A)><label for="c001"></label>
-    <input class="color" type="radio" name="color" value="#0A0" id="c010" $(checked \#0A0)><label for="c010"></label>
-    <input class="color" type="radio" name="color" value="#0AA" id="c011" $(checked \#0AA)><label for="c011"></label>
-    <input class="color" type="radio" name="color" value="#A00" id="c100" $(checked \#A00)><label for="c100"></label>
-    <input class="color" type="radio" name="color" value="#A0A" id="c101" $(checked \#A0A)><label for="c101"></label>
-    <input class="color" type="radio" name="color" value="#AA0" id="c110" $(checked \#AA0)><label for="c110"></label>
-    <input class="color" type="radio" name="color" value="#FFF" id="c111" $(checked \#FFF)><label for="c111"></label>
-  </fieldset>
-  <img class="dotmark bg" src="?static=therapy_background.png" alt="WARNING: Background Image not available!">
-  <canvas id="canvas" class="dotmark ov" width="${bg_dim%x*}" height="${bg_dim#*x}"></canvas>
-
-  <input type=hidden id=image_serialize name=imagedata value="">
-
-  <button type="submit">$(l10n save)</button>
-</form>
-
-<span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
-
-<script type="text/javascript" src="?static=therapy_draw.js"></script>
-EOF
-
-# vi:set filetype=html:
diff --git a/therapy/therapy.sh b/therapy/therapy.sh
deleted file mode 100755 (executable)
index 8885515..0000000
+++ /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 <http://www.gnu.org/licenses/>. 
-
-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