]> git.plutz.net Git - confetti/blobdiff - cards/widgets.sh
portable sed usage
[confetti] / cards / widgets.sh
index 5fbf125b746b06fdc7c58868a2f0ffc5470abef7..52fca4e25e9b9e52e8fd9df0cb526fd1e5f896e6 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2014 - 2019 Paul Hänsch
+# Copyright 2014 - 2019, 2021 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
@@ -26,8 +26,7 @@ cat <<EOF
     [legend $(l10n filter_item):]
 
     $(for field in any name street zip TEL BDAY CATEGORIES; do
-      printf '[input id="%s%i" type="radio" name="filter_type%i" value="%s" %s]
-              [label for="%s%i" %s ]' \
+      printf '[input id="%s%i" type="radio" 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)
@@ -39,7 +38,7 @@ cat <<EOF
                  "$(printf %s "$cat" |grep -qxEe "$2" && printf checked )" \
                  "$(HTML "$cat")"
       done)
-      [a href="/cards/categories.sh" $(l10n edit_categories)]
+      [a href="/categories/" $(l10n edit_categories)]
     ]
   ]
 EOF
@@ -57,16 +56,16 @@ w_filter_diag(){
         w_filter_item "${fil%%:*}" "${fil#*:}" $n
         n=$((n + 1))
       done
-      w_filter_item any '' $n
+      [ "$n" -eq 0 -o "$(GET newfilter)" ] && w_filter_item any '' $n
     )
-  
+    [button type="submit" name="choice" value="new_filter" $(l10n filter_more)]
     [fieldset class="order"
       [legend $(l10n filter_order):]
       [label [radio "order" "firstname" $( [ "$order" = firstname ] && printf checked )] $(l10n filter_firstname)]
       [label [radio "order" "lastname"  $( [ "$order" = lastname  ] && printf checked )] $(l10n filter_lastname)]
       [label [radio "order" "bdate"     $( [ "$order" = bdate     ] && printf checked )] $(l10n filter_bdate)]
     ]
-    [button type="submit" name="choice" value="new_filter" $(l10n filter_apply)]
+    [button type="submit" name="choice" value="filter" $(l10n filter_apply)]
     [button type="submit" name="choice" value="del_filter" $(l10n filter_cancel)]
   ]
 EOF
@@ -96,12 +95,12 @@ card_item(){
     cnt="$(pdi_count "$card" "$item")"
 
     case $item in
-      FN) printf '[h2 .item .FN &shy;%s]' "$(pdi_value "$card" FN |unescape |HTML)"
+      FN) printf '[h2 .item .FN %s]' "$(pdi_value "$card" FN |unescape |HTML)"
         ;;
-      GENDER) printf '[span .item .GENDER &shy;%s]' "$(pdi_value "$card" GENDER |l10n)"
+      GENDER) printf '[span .item .GENDER %s]' "$(pdi_value "$card" GENDER |l10n)"
         ;;
       NICKNAME) seq 1 $cnt |while read c; do
-          printf '[span .item .NICKNAME &shy;aka. "%s"]' \
+          printf '[span .item .NICKNAME aka. "%s"]' \
                  "$(pdi_value "$card" NICKNAME $c |unescape |HTML)"
         done
         ;;
@@ -129,7 +128,7 @@ card_item(){
       EMAIL) 
         [ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n EMAIL)"
         seq 1 $cnt |while read c; do
-          printf '[a .item .EMAIL href="mailto:%s" &shy;%s]' \
+          printf '[a .item .EMAIL href="mailto:%s" %s]' \
                  "$(pdi_value "$card" EMAIL $c |unescape |HTML)" \
                  "$(pdi_value "$card" EMAIL $c |unescape |HTML)"
         done
@@ -139,16 +138,16 @@ card_item(){
         seq 1 $cnt |while read c; do
           teltype="$(pdi_attrib "$card" TEL $c TYPE)"
           [ "$teltype" ] \
-          && printf '[span .item .TEL [span .type &shy;%s:] %s]' \
+          && printf '[span .item .TEL [span .type %s:] %s]' \
                     "$(l10n "TYPE=$teltype" |HTML)" \
                     "$(pdi_value "$card" TEL $c |unescape |HTML)" \
-          || printf '[span .item .TEL &shy;%s]' \
+          || printf '[span .item .TEL %s]' \
                     "$(pdi_value "$card" TEL $c |unescape |HTML)"
         done
         ;;
       *)[ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n "$item")"
         seq 1 $cnt |while read c; do
-          printf '[span .item .%s &shy;%s]' "$item" \
+          printf '[span .item .%s %s]' "$item" \
                  "$(pdi_value "$card" "$item" $c |unescape |HTML)"
         done
         ;;