X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=actions%2Fupdate_therapy.sh;h=6ba06cbd41214d84efe623d7c640020cd049d191;hp=cc95e3965c973da376392d9971fbc1e637dd7445;hb=61666ee9e4ce45e915ead39c575493c075c68845;hpb=015242823eb4a79cf615bef6951b0af6bd0a5b01 diff --git a/actions/update_therapy.sh b/actions/update_therapy.sh index cc95e39..6ba06cb 100755 --- a/actions/update_therapy.sh +++ b/actions/update_therapy.sh @@ -26,7 +26,7 @@ tempfile="$_DATA/temp/$tpy" # serialize POST array into file for key in ${(k)_POST}; do - printf %s:%s\\n "$key" "${_POST[$key]//$BR/\\n}" + [ "$key" != imagedata ] && printf %s:%s\\n "$key" "${_POST[$key]//$BR/\\n}" done >"$tempfile" if [ -n "$_POST[delete_session]" ]; then @@ -43,7 +43,7 @@ if [ -n "$_POST[delete_session]" ]; then elif [ -n "$_POST[new_session]" ]; then sid="$_POST[new_session]" - identify "$_EXEC/templates/therapy_background.png" \ + identify "$_EXEC/static/therapy_background.png" \ | sed -r 's;^.* ([0-9]+x[0-9]+) .*$;\1;' \ | read dim @@ -52,28 +52,17 @@ elif [ -n "$_POST[new_session]" ]; then printf '%s:exists\n' "$sid" >>"$tempfile" printf '%s_open:checked\n' "$sid" >>"$tempfile" -elif [ -n "$_POST[dotmark.x]" -a -n "$_POST[dotmark.y]" ]; then +elif [ -n "$_POST[imagedata]" ]; 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" - + convert "${tpyfile%.tpy}_${sid}.png" \ + -strokewidth 2 -fill '#00000000' \ + -draw "${_POST[imagedata]}" -transparent white \ + "${tpyfile%.tpy}_${sid}.png" + sync fi mv "$tempfile" "$tpyfile"