]> git.plutz.net Git - lobster/blobdiff - cards/widgets.sh
updated escape vcf functions
[lobster] / cards / widgets.sh
index 9a71f198c4a9322ef6f465dba321290b5d6cc0f1..ab317fb8afd586b4a2cd5e31947ebeee57b676ef 100755 (executable)
@@ -22,12 +22,12 @@ cat <<EOF
     [legend $(l10n filter_item):]
 
     $(for field in any name street zip TEL BDAY; do
-      printf '[input id="%s%i" type="radio" name="filter_type%i" value="%s" %s]
+      printf '[input id="%s%i" type="radio" .tab name="filter_type%i" value="%s" %s]
               [label for="%s%i" %s ]' \
               "$field" "$n" "$n" "$field" "$([ "$1" = "$field" ] && printf checked )" \
               "$field" "$n" "$(l10n filter_$field)"
     done)
-    [input type="text" name="filter_text$n" value="$([ "$1" = CATEGORIES ] || HTML "$2")" placeholder="$(l10n filter_placeholder)"]
+    [input type="text" .tab name="filter_text$n" value="$([ "$1" = CATEGORIES ] || HTML "$2")" placeholder="$(l10n filter_placeholder)"]
   ]
 EOF
 }
@@ -69,13 +69,13 @@ card_item(){
     cnt="$(pdi_count "$card" "$item")"
 
     case $item in
-      FN) printf '[h2 .item .FN . %s]' "$(pdi_value "$card" FN |unescape |HTML)"
+      FN) printf '[h2 .item .FN . %s]' "$(pdi_value "$card" FN |pdi_unescape |HTML)"
         ;;
       GENDER) printf '[span .item .GENDER . %s]' "$(pdi_value "$card" GENDER |l10n)"
         ;;
       NICKNAME) seq 1 $cnt |while read c; do
           printf '[span .item .NICKNAME . aka. "%s"]' \
-                 "$(pdi_value "$card" NICKNAME $c |unescape |HTML)"
+                 "$(pdi_value "$card" NICKNAME $c |pdi_unescape |HTML)"
         done
         ;;
       X-ZACK-JOINDATE|X-ZACK-LEAVEDATE) if [ $cnt -gt 0 ]; then
@@ -103,8 +103,8 @@ card_item(){
         [ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n EMAIL)"
         seq 1 $cnt |while read c; do
           printf '[a .item .EMAIL href="mailto:%s" . %s]' \
-                 "$(pdi_value "$card" EMAIL $c |unescape |HTML)" \
-                 "$(pdi_value "$card" EMAIL $c |unescape |HTML)"
+                 "$(pdi_value "$card" EMAIL $c |pdi_unescape |HTML)" \
+                 "$(pdi_value "$card" EMAIL $c |pdi_unescape |HTML)"
         done
         ;;
       TEL)
@@ -114,9 +114,9 @@ card_item(){
           [ "$teltype" ] \
           && printf '[span .item .TEL [span .type . %s:] %s]' \
                     "$(l10n "TYPE=$teltype" |HTML)" \
-                    "$(pdi_value "$card" TEL $c |unescape |HTML)" \
+                    "$(pdi_value "$card" TEL $c |pdi_unescape |HTML)" \
           || printf '[span .item .TEL . %s]' \
-                    "$(pdi_value "$card" TEL $c |unescape |HTML)"
+                    "$(pdi_value "$card" TEL $c |pdi_unescape |HTML)"
         done
         ;;
       X-HEALTH-INSURANCE)
@@ -128,9 +128,9 @@ card_item(){
           printf '[span .item .hi_company . %s]
                   [span .item .hi_number [label %s:] %s]
                   [span .item .hi_status [label %s:] %s]
-                 ' "$(unescape "$hi_name" |HTML)" \
-                   "$(l10n hi_number)" "$(unescape "$hi_number" |HTML)" \
-                   "$(l10n hi_status)" "$(unescape "$hi_status" |HTML)"
+                 ' "$(pdi_unescape "$hi_name" |HTML)" \
+                   "$(l10n hi_number)" "$(pdi_unescape "$hi_number" |HTML)" \
+                   "$(l10n hi_status)" "$(pdi_unescape "$hi_status" |HTML)"
         done
         ;;
       therapies)
@@ -139,7 +139,7 @@ card_item(){
         (cd "$_DATA/therapies/"; printf '%s\n' "${client}".*.tpy) \
         | while read tpyfile; do
           [ "$tpyfile" = "${client}.*.tpy" ] \
-          && printf '[a .item .therapy href="/therapies/%s/new" . +]' "${client}" \
+          && printf '[a .button .therapy href="/therapies/%s/new" . +]' "${client}" \
           && break
           tpy="${tpyfile%.tpy}";
           tpydates="$(sed -En 's;^session[0-9]+_date:;;p;' "$_DATA/therapies/$tpyfile" \
@@ -154,7 +154,7 @@ card_item(){
         shy="$(printf '\302\255')"
         seq 1 $cnt |while read c; do
           printf '[span .item .%s . %s]' "$item" \
-                 "$(pdi_value "$card" "$item" $c |sed -r "s;(straße|weg|damm|allee|ufer);${shy}\1;g" |unescape |HTML)"
+                 "$(pdi_value "$card" "$item" $c |sed -r "s;(straße|weg|damm|allee|ufer);${shy}\1;g" |pdi_unescape |HTML)"
         done
         ;;
     esac
@@ -177,7 +177,7 @@ edit_item(){
                $N
                EOF
         else
-         N="$(pdi_value "$card" FN |unescape)"
+         N="$(pdi_value "$card" FN |pdi_unescape)"
           n1="${N##* }"
           n2="${N%$n1}"
         fi
@@ -256,11 +256,9 @@ edit_item(){
                $(pdi_value "$card" X-HEALTH-INSURANCE $c)
                EOF
           cat <<-EOF
-               [input type="radio" name="$item" value="list" #hi_select_list checked]<!--
-               -->[label for="hi_select_list" $(l10n hi_from_list)]<!--
-               -->[input type="radio" name="$item" value="other" #hi_other checked]<!--
-               -->[label for="hi_other" $(l10n hi_other)]<!--
-               -->[select class="item" name="hi_company"
+               [radio "$item" "list" .tab #hi_select_list checked][label for="hi_select_list" $(l10n hi_from_list)]
+               [radio "$item" "other" .tab #hi_other][label for="hi_other" $(l10n hi_other)]
+               [select .tab .item name="hi_company"
                  [option value="" disabled="disabled" $(selected "${hi_name}" "") . $(l10n hi_company)]
                  $(list_hi_companies |while read f; do
                    printf '[option value="%s" %s . %s]' "$(pdi_unescape "$f" |HTML)" \
@@ -268,9 +266,9 @@ edit_item(){
                                                         "$(pdi_unescape "$f" |HTML)"
                  done)
                ]
-               [input type="text" name="hi_other" value="$hi_name" placeholder="$(l10n hi_company)"]
-               [input name="hi_number" value="$(pdi_unescape "$hi_number" |HTML)" placeholder="$(l10n hi_number)"]
-               [input name="hi_status" value="$(pdi_unescape "$hi_status" |HTML)" placeholder="$(l10n hi_status)"]
+               [input type="text" .tab name="hi_other" value="$hi_name" placeholder="$(l10n hi_company)"]
+               [input type="text" name="hi_number" value="$(pdi_unescape "$hi_number" |HTML)" placeholder="$(l10n hi_number)"]
+               [input type="text" name="hi_status" value="$(pdi_unescape "$hi_status" |HTML)" placeholder="$(l10n hi_status)"]
                EOF
         done
         ;;