]> git.plutz.net Git - confetti/blobdiff - templates/therapy.html.sh
externalize drawing script
[confetti] / templates / therapy.html.sh
index ce97dfb0ea959f6ae1ddef33dd5e2eea34e92b17..4b8717d1f0db79f8acd1f2e2aaaffd23f3b07398 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><!--
@@ -191,69 +199,12 @@ cat <<EOF
   <canvas id="canvas" class="dotmark ov" width="${bg_dim%x*}" height="${bg_dim#*x}"></canvas>
 
   <input type=hidden id=image_serialize name=imagedata value="">
-  <span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
 
   <button type="submit">$(l10n save)</button>
 </form>
 
-<script><!--
-body = document.body
-canvas = document.getElementById("canvas")
-dbg = document.getElementById("jsdebug")
-image = canvas.getContext("2d")
-mouse = 0
-image_serialize=""
-data=document.getElementById("image_serialize")
-
-function setcol(c) {
-  image.strokeStyle = c
-  if ( c == "#FFF" ) image.lineWidth = 32
-  else image.lineWidth = 4
-  image_serialize += " stroke " + c + " stroke-width " + image.lineWidth
-}
-
-setcol("$tpy[color]")
-
-function draw(x, y) {
-  if ( mouse == 1){
-    if ( body.clientWidth >= 800 ){
-      sx=Math.floor(cscaleW * (x - canvas.offsetLeft))
-      sy=Math.floor(cscaleH * (y - canvas.offsetTop))
-    } else { 
-      sx=Math.floor(cscaleW * (x - canvas.offsetLeft + window.pageXOffset))
-      sy=Math.floor(cscaleH * (y - canvas.offsetTop + window.pageYOffset))
-    }
-    image.lineTo( sx, sy )
-    image.stroke()
-
-    image_serialize += " " + sx + "," + sy
-  }
-}
-
-function drawstart(x, y) {
-  mouse = 1
-
-  cscaleW = canvas.width / canvas.clientWidth
-  cscaleH = canvas.height / canvas.clientHeight
-
-  image_serialize += " polyline"
-  image.beginPath()
-  draw(x, y)
-}
-function drawstop() {
- mouse = 0
- image.closePath()
- //dbg.innerHTML = image_serialize
- data.value = image_serialize
-}
-
-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) } )
+<span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
 
-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: