From a8531f50fa8e706ae2c8fd29f0ecb2e01efeb9c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 8 Jan 2020 19:43:42 +0100 Subject: [PATCH] Interface adaption, display documentation text --- therapies/page.sh | 216 ++++++++++++++++++++++------------------------ 1 file changed, 103 insertions(+), 113 deletions(-) diff --git a/therapies/page.sh b/therapies/page.sh index c3f3c5c..ece7ad1 100755 --- a/therapies/page.sh +++ b/therapies/page.sh @@ -15,160 +15,147 @@ # 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 -# } +t_session_note(){ + session_n="$1" + note_n="$2" + + color=session${session_n}_note${note_n}_color + + if [ "$note_n" -eq 1 -o "$(TPY "session${session_n}_note${note_n}")" ]; then + printf '[input type="checkbox" .trailbtn checked="checked"]' + else + printf '[input type="checkbox" .trailbtn]' + fi + + check="$(TPY "$color" |grep -xE -m1 '#(888|00A|0A0|0AA|A00|A0A|AA0)' || printf '#FFF')" + cat <<-EOF + [fieldset .note .trailbox + [radio "$color" "#888" .color #${color}_000 $(checked "$check" '#888') ][label for=${color}_000] + [radio "$color" "#00A" .color #${color}_001 $(checked "$check" '#00A') ][label for=${color}_001] + [radio "$color" "#0A0" .color #${color}_010 $(checked "$check" '#0A0') ][label for=${color}_010] + [radio "$color" "#0AA" .color #${color}_011 $(checked "$check" '#0AA') ][label for=${color}_011] + [radio "$color" "#A00" .color #${color}_100 $(checked "$check" '#A00') ][label for=${color}_100] + [radio "$color" "#A0A" .color #${color}_101 $(checked "$check" '#A0A') ][label for=${color}_101] + [radio "$color" "#AA0" .color #${color}_110 $(checked "$check" '#AA0') ][label for=${color}_110] + [radio "$color" "#FFF" .color #${color}_111 $(checked "$check" '#FFF') ][label for=${color}_111] + [textarea name="session${session_n}_note${note_n}" . $(TPY "session${session_n}_note${note_n}" |HTML)] + ] + EOF +} + +therapy_sessions(){ + n=1; while [ "$(TPY session$n)" ]; do + session_n="$n" + sid=session${session_n} + + cat <<-EOF + [hidden "$sid" "exists"] + [checkbox "${sid}_open" "checked" #${sid}_open .tab $(checked "$(TPY "${sid}_open")" checked)] + [label .tab for="${sid}_open" + [span .no ${session_n}.] + [span .date . $(TPY "${sid}_date" |HTML)] + [input .date name="${sid}_date" value="$(TPY "${sid}_date" |HTML)" placeholder="$(l10n date)"] + [span .therapist . $(TPY "${sid}_therapist" |HTML)] + [input .therapist name="${sid}_therapist" value="$(TPY "${sid}_therapist" |HTML)" placeholder="$(l10n therapist)"] + [span .signature [checkbox "${sid}_sigset" "pos" $(checked "$(TPY "${sid}_sigset")" "pos")]] + ] + [div .tab + [img .dotmark .ov src="/therapies/${id}_${sid}.png" alt=""] + $(n=1; while TPY "session${session_n}_note${n}" >/dev/null; do + [ "$(TPY "session${session_n}_note${n}")" ] && x=$n + n=$(($n + 1)) + done + for n in $(seq 1 $((${x:-0} + 3)) ); do + t_session_note $session_n $n + done + ) + [button type="submit" .trailbtn $(l10n trailbtn)] + [button type="submit" name=delete_session value="$session_n" .delete $(l10n delete_session)] + ] + EOF + n=$(($n+1)) + done + + sid=session$n + + cat <<-EOF + [fieldset .tab + [submit "new_session" "$sid" .no . +] + [input .date name="${sid}_date" value="" placeholder=$(l10n date)] + [input .therapist name="${sid}_therapist" value="" placeholder=$(l10n therapist)] + [span .signature] + [hidden "${sid}_note1" ""] + ] + EOF +} cat <