From: paul Date: Thu, 7 Apr 2016 20:25:56 +0000 (+0000) Subject: drawable overlays X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=a9d6bfdfa84de24b8800b6d34b24c28cbdb2feb4;p=confetti drawable overlays svn path=/trunk/; revision=92 --- diff --git a/actions/update_therapy.sh b/actions/update_therapy.sh index cc95e39..52daa11 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 @@ -61,19 +61,16 @@ elif [ -n "$_POST[dotmark.x]" -a -n "$_POST[dotmark.y]" ]; then 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" -draw "fill $_POST[color] circle $x,$y $(($x+5)),$y" "${tpyfile%.tpy}_${sid}.png" - convert "${tpyfile%.tpy}_${sid}.png" -fill "$c" -stroke "$c" -draw "circle $x,$y $(($x+5)),$y" "${tpyfile%.tpy}_${sid}.png" +elif [ -n "$_POST[imagedata]" ]; then + sed -rn 's;^(session[0-9]+)_open:checked$;\1;p' "$tempfile" \ + | sort -n \ + | tail -n1 \ + | read sid + convert "${tpyfile%.tpy}_${sid}.png" -draw "${_POST[imagedata]}" -transparent white "${tpyfile%.tpy}_${sid}.png" + sync fi mv "$tempfile" "$tpyfile" diff --git a/pages/therapy.sh b/pages/therapy.sh index 6127b4d..ee9804b 100755 --- a/pages/therapy.sh +++ b/pages/therapy.sh @@ -29,6 +29,10 @@ tpyfile="$_DATA/therapies/$id" mpxfile="$_DATA/prescriptions/${id%.tpy}.mpx" client="$_DATA/vcard/${id%%.*}.vcf" +identify "$_EXEC/templates/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")" diff --git a/templates/therapy.css.sh b/templates/therapy.css.sh index 807d47f..10acf33 100755 --- a/templates/therapy.css.sh +++ b/templates/therapy.css.sh @@ -23,14 +23,15 @@ input.color + label{ border: 1px solid black; } input.color:checked + label{ border-width: 3px;} -input.color[value="c000"] + label { background-color: #888;} -input.color[value="c001"] + label { background-color: #00F;} -input.color[value="c010"] + label { background-color: #0F0;} -input.color[value="c011"] + label { background-color: #0FF;} -input.color[value="c100"] + label { background-color: #F00;} -input.color[value="c101"] + label { background-color: #F0F;} -input.color[value="c110"] + label { background-color: #FF0;} -input.color[value="c111"] + label { background-color: #FFF;} +input.color[value="#000"] + label, +input.color[value="#888"] + label { background-color: #888;} +input.color[value="#00A"] + label { background-color: #00F;} +input.color[value="#0A0"] + label { background-color: #0F0;} +input.color[value="#0AA"] + label { background-color: #0FF;} +input.color[value="#A00"] + label { background-color: #F00;} +input.color[value="#A0A"] + label { background-color: #F0F;} +input.color[value="#AA0"] + label { background-color: #FF0;} +input.color[value="#FFF"] + label { background-color: #FFF;} h1, label.tab, div.tab, fieldset.tab, div.patient, div.prescription { @@ -218,14 +219,14 @@ div.tab > fieldset.note > textarea { font: normal 1em sans-serif; } div.tab > fieldset.note > input.color + label { margin: 0; display: block; } -div.tab > fieldset.note > input.color[value="c000"]:checked ~ textarea { background-color: #AAA; } -div.tab > fieldset.note > input.color[value="c001"]:checked ~ textarea { background-color: #88F; } -div.tab > fieldset.note > input.color[value="c010"]:checked ~ textarea { background-color: #8F8; } -div.tab > fieldset.note > input.color[value="c011"]:checked ~ textarea { background-color: #8FF; } -div.tab > fieldset.note > input.color[value="c100"]:checked ~ textarea { background-color: #F88; } -div.tab > fieldset.note > input.color[value="c101"]:checked ~ textarea { background-color: #F8F; } -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 > fieldset.note > input.color[value="#888"]:checked ~ textarea { background-color: #AAA; } +div.tab > fieldset.note > input.color[value="#00A"]:checked ~ textarea { background-color: #88F; } +div.tab > fieldset.note > input.color[value="#0A0"]:checked ~ textarea { background-color: #8F8; } +div.tab > fieldset.note > input.color[value="#0AA"]:checked ~ textarea { background-color: #8FF; } +div.tab > fieldset.note > input.color[value="#A00"]:checked ~ textarea { background-color: #F88; } +div.tab > fieldset.note > input.color[value="#A0A"]:checked ~ textarea { background-color: #F8F; } +div.tab > fieldset.note > input.color[value="#AA0"]:checked ~ textarea { background-color: #FF8; } +div.tab > fieldset.note > input.color[value="#FFF"]:checked ~ textarea { background-color: #FFF; } div.tab > button.delete {float: right; display: inline-block;} EOF diff --git a/templates/therapy.html.sh b/templates/therapy.html.sh index 9d37db8..e9781e9 100755 --- a/templates/therapy.html.sh +++ b/templates/therapy.html.sh @@ -23,26 +23,26 @@ t_session_note(){ 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;; + \#888) c0=checked;; + \#00A) c1=checked;; + \#0A0) c2=checked;; + \#0AA) c3=checked;; + \#A00) c4=checked;; + \#A0A) c5=checked;; + \#AA0) c6=checked;; *) c7=checked;; esac cat < - - - - - - - - + + + + + + + + EOF @@ -114,14 +114,14 @@ 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;; + \#00A) c1="checked";; + \#0A0) c2="checked";; + \#0AA) c3="checked";; + \#A00) c4="checked";; + \#A0A) c5="checked";; + \#AA0) c6="checked";; + \#FFF) c7="checked";; + *) c0="checked";; esac cat < - - - - - - - - + + + + + + + + - + + + + + + EOF