X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=actions%2Fupdate_therapy.sh;fp=actions%2Fupdate_therapy.sh;h=cc95e3965c973da376392d9971fbc1e637dd7445;hp=43a2e1fdff49cd1421765bf34f0c46e2c1a63e3a;hb=015242823eb4a79cf615bef6951b0af6bd0a5b01;hpb=c8980226006bdd5a9d518e7d3221dc3d527be321 diff --git a/actions/update_therapy.sh b/actions/update_therapy.sh index 43a2e1f..cc95e39 100755 --- a/actions/update_therapy.sh +++ b/actions/update_therapy.sh @@ -42,13 +42,38 @@ if [ -n "$_POST[delete_session]" ]; then 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" + + printf '%s:exists\n' "$sid" >>"$tempfile" + printf '%s_open:checked\n' "$sid" >>"$tempfile" + +elif [ -n "$_POST[dotmark.x]" -a -n "$_POST[dotmark.y]" ]; then + sed -rn 's;^(session[0-9]+)_open:checked$;\1;p' "$tempfile" \ + | sort -n \ + | tail -n1 \ + | read sid + + x="$_POST[dotmark.x]" + y="$_POST[dotmark.y]" + + case "$_POST[color]" in + c000) c="#000000";; + c001) c="#000088";; + c010) c="#008800";; + c011) c="#008888";; + c100) c="#880000";; + c101) c="#880088";; + c110) c="#888800";; + c111) c="#888888";; + esac + + convert "${tpyfile%.tpy}_${sid}.png" -fill "$c" -stroke "$c" -draw "circle $x,$y $(($x+5)),$y" "${tpyfile%.tpy}_${sid}.png" + fi mv "$tempfile" "$tpyfile"