]> git.plutz.net Git - confetti/blobdiff - templates/therapy.html.sh
more reliable color selection, bugfix regarding backend color transparency
[confetti] / templates / therapy.html.sh
index 70d9c3fe704139cf2c19388e0a205364a634dacf..6addbed8e60ea1a57e2cd9e108b7ca10b2995764 100755 (executable)
@@ -77,7 +77,7 @@ cat <<EOF
   </label>
   <div class=tab>
     <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
-    $( for n in {1..50}; do t_session_note $session_n $n; done )
+    $( for n in {1..10}; do t_session_note $session_n $n; done )
 
     <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
   </div>
@@ -154,9 +154,13 @@ cat <<EOF
                                       || 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 method="POST" action="?action=update_therapy">
+<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">
@@ -166,6 +170,10 @@ cat <<EOF
     <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><!--
@@ -178,14 +186,14 @@ therapy_sessions
 
 cat <<EOF
   <fieldset class=color>
-    <input class=color type=radio name=color onclick="javascript:setcol('#000')" value="#000" id=c000 $c0><label for=c000></label>
-    <input class=color type=radio name=color onclick="javascript:setcol('#00A')" value="#00A" id=c001 $c1><label for=c001></label>
-    <input class=color type=radio name=color onclick="javascript:setcol('#0A0')" value="#0A0" id=c010 $c2><label for=c010></label>
-    <input class=color type=radio name=color onclick="javascript:setcol('#0AA')" value="#0AA" id=c011 $c3><label for=c011></label>
-    <input class=color type=radio name=color onclick="javascript:setcol('#A00')" value="#A00" id=c100 $c4><label for=c100></label>
-    <input class=color type=radio name=color onclick="javascript:setcol('#A0A')" value="#A0A" id=c101 $c5><label for=c101></label>
-    <input class=color type=radio name=color onclick="javascript:setcol('#AA0')" value="#AA0" id=c110 $c6><label for=c110></label>
-    <input class=color type=radio name=color onclick="javascript:setcol('#FFF')" value="#FFF" id=c111 $c7><label for=c111></label>
+    <input class="color" type="radio" name="color" value="#000" id="c000" $c0><label for="c000"></label>
+    <input class="color" type="radio" name="color" value="#00A" id="c001" $c1><label for="c001"></label>
+    <input class="color" type="radio" name="color" value="#0A0" id="c010" $c2><label for="c010"></label>
+    <input class="color" type="radio" name="color" value="#0AA" id="c011" $c3><label for="c011"></label>
+    <input class="color" type="radio" name="color" value="#A00" id="c100" $c4><label for="c100"></label>
+    <input class="color" type="radio" name="color" value="#A0A" id="c101" $c5><label for="c101"></label>
+    <input class="color" type="radio" name="color" value="#AA0" id="c110" $c6><label for="c110"></label>
+    <input class="color" type="radio" name="color" value="#FFF" id="c111" $c7><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>
@@ -197,102 +205,6 @@ cat <<EOF
 
 <span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
 
-<script><!--
-body = document.body
-dbg = document.getElementById("jsdebug")
-canvas = document.getElementById("canvas")
-data=document.getElementById("image_serialize")
-
-image = canvas.getContext("2d")
-mouse = 0
-image_serialize=""
-
-// start and current coordinates of a draw
-// serves for tracking, whether path ends close to its beginning
-stx=0, sty=0
-cux=0, cuy=0
-
-function setcol(c) {
-  this.c = c
-  image.strokeStyle = c
-  image.fillStyle =  c
-  if ( c == "#FFF" ) image.lineWidth = 32
-  else image.lineWidth = 4
-  data.value += " stroke " + c + " stroke-width " + image.lineWidth
-}
-
-setcol("$tpy[color]")
-
-function relX(x){
-  if ( body.clientWidth >= 800 ){
-    return Math.floor(cscaleW * (x - canvas.offsetLeft))
-  } else { 
-    return Math.floor(cscaleW * (x - canvas.offsetLeft + window.pageXOffset))
-  }
-}
-function relY(y){
-  if ( body.clientWidth >= 800 ){
-    return Math.floor(cscaleH * (y - canvas.offsetTop))
-  } else { 
-    return Math.floor(cscaleH * (y - canvas.offsetTop + window.pageYOffset))
-  }
-}
-
-function draw(x, y) {
-  if ( mouse == 1){
-    cux=relX(x), cuy=relY(y)
-
-    image.lineTo( cux, cuy )
-    image.stroke()
-
-    image_serialize += " " + cux + "," + cuy
-  }
-}
-
-function drawstart(x, y) {
-  mouse = 1
-
-  cscaleW = canvas.width / canvas.clientWidth
-  cscaleH = canvas.height / canvas.clientHeight
-
-  stx=relX(x), sty=relY(y)
-
-  image.beginPath()
-  draw(x, y)  // why must this not use relative Coords ???
-
-  image_serialize = " polyline"
-}
-
-function drawstop() {
-  // if path ends close to beginning ( < 50 px); then close path and fill
-  if ( mouse == 1 && Math.sqrt( Math.pow(stx - cux, 2) + Math.pow(sty - cuy, 2)) <= 50 && c !== "#FFF" ){
-    image.lineTo( stx, sty )
-    image.stroke()
-
-    image.globalAlpha = .5
-    image.fill()
-    image.globalAlpha = 1
-
-    image_serialize += " " + stx + "," + sty
-    data.value += " fill " + c + "8" + image_serialize
-  } else if (mouse == 1)  {
-    data.value += " fill #0000 " + image_serialize
-  }
-  dbg.innerHTML = " stx: " + stx + " cux: " + cux + " sty: " + sty + " cuy: " + cuy
-  image.closePath()
-  image_serialize = ""
-  mouse = 0
-}
-
-window.addEventListener( 'mouseup',   function()   { drawstop() } )
-canvas.addEventListener( 'mousedown', function(e)  { drawstart(e.clientX, e.clientY) } )
-canvas.addEventListener( 'mousemove', function(e)  {      draw(e.clientX, e.clientY) } )
-
-window.addEventListener( 'touchend',   function()  { drawstop() } )
-canvas.addEventListener( 'touchstart', function(e) { drawstart(e.touches[0].clientX, e.touches[0].clientY) } )
-canvas.addEventListener( 'touchmove',  function(e) { e.preventDefault(); draw(e.touches[0].clientX, e.touches[0].clientY) } )
---></script>
+<script type="text/javascript" src="?static=therapy_draw.js"></script>
 EOF
 # vi:set filetype=html: