]> git.plutz.net Git - lobster/commitdiff
function and ui for adding new therapy
authorPaul Hänsch <paul@plutz.net>
Thu, 9 Jan 2020 03:06:14 +0000 (04:06 +0100)
committerPaul Hänsch <paul@plutz.net>
Thu, 9 Jan 2020 03:06:14 +0000 (04:06 +0100)
therapies/index.cgi
therapies/page.sh
therapies/therapy.css

index 62b621d45e5eaf7d8a1393476d5d06a8012e851e..f142d2180de1a20a6844577bb120e4557d957ada 100755 (executable)
@@ -30,12 +30,21 @@ case "$_PATH" in
     fi
     return 0
     ;;
+  /therapies/*/new)
+    card="${_PATH#/therapies/}"
+    card="${card%/new}"
+    uid="$(timeid)$(randomid)"
+    if [ -f "${_DATA}/vcard/${card}.vcf" ]; then
+      touch "${_DATA}/therapies/${card}.${uid}.tpy"
+      rm -f "${_DATA}/cache/${card}.vcf.cache"
+      REDIRECT "/therapies/${card}/${uid}"
+    fi
+    return 0
+    ;;
 esac
 
 . $_EXEC/pdiread.sh
 . $_EXEC/therapies/l10n.sh
-# . $_EXEC/cards/widgets.sh
-# . $_EXEC/cards/list.sh
 
 # unescape() { [ $# = 0 ] && sed -E 's;\\(.);\1;g' || printf %s "$*" |sed -E 's;\\(.);\1;g'; }
 # upcase=' y;abcdefghijklmnopqrstuvwxyzäöüé;ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉ;; '
index 4c236c4c161f54f71c76eafeee201cb251bdb9eb..2f0136ba25f9cfa8f8641fbe7a009965e5d2a049 100755 (executable)
@@ -93,7 +93,7 @@ cat <<EOF
 [h1 $(l10n therapy)]
 
 [div .patient
-  [h2 . [a "/cards/#{id%.*}.vcf" &#x2b05; $(VCF FN |HTML)]]
+  [h2 . [a "/cards/#${id%.*}.vcf" &#x2b05; $(VCF FN |HTML)]]
 ]
 
 [div .therapies
@@ -108,14 +108,15 @@ cat <<EOF
                 | sed -E ':X;N;$!bX; s;^[\n ]+;;; s;[\n ]+$;;; s;(\n.*\n|\n); - ;;'
                )"
     if [ "${tpy%.*}.${tpy#*.}" = "${id}" ]; then
-      printf '[a .item .therapy .current href="/therapies/%s" . %s]' \
+      printf '[a .item .therapy .current href="/therapies/%s" . %s] ' \
              "${tpy%.*}/${tpy#*.}" "$(HTML "${tpydates:--}")"
     else
-      printf '[a .item .therapy href="/therapies/%s" . %s]' \
+      printf '[a .item .therapy href="/therapies/%s" . %s] ' \
              "${tpy%.*}/${tpy#*.}" "$(HTML "${tpydates:--}")"
     fi
-  done |sort -r
+  done |sort -n
   )
+  [a .item .therapy href="/therapies/${id%%.*}/new" . +]
 ]
 EOF
 
index 2b62c176ffe7e2b88790ba17f8a963203a8b7564..68aa33496bab0c33bae8ea8e9e9c4f8ac16d986e 100644 (file)
@@ -72,13 +72,14 @@ div.patient a {
 
 div.therapies > a {
   display: inline-block;
+  text-decoration: none;
   border: 1px solid black;
-  margin: .5em .5em 0 0; padding: .25em .5em;
+  margin-top: .5em; padding: .25em .5em;
   background-color: #DDF;
   color: #000;
 }
 div.therapies > a.current {
-  background-color: #CCF;
+  background-color: #AAF;
 }
 
 div.prescription {