]> git.plutz.net Git - lobster/commitdiff
different layout of listing
authorPaul Hänsch <paul@plutz.net>
Mon, 9 Dec 2019 23:47:37 +0000 (00:47 +0100)
committerPaul Hänsch <paul@plutz.net>
Mon, 9 Dec 2019 23:47:37 +0000 (00:47 +0100)
cards/index.cgi
cards/list.sh
cards/widgets.sh
index.cgi

index f1306f6aeb0ed05f395a2580fed9fe2f85b62a7e..639bb64f6bcce59ac013a7e039aacf542e511b18 100755 (executable)
@@ -18,7 +18,7 @@ filter="$(GET f)"
 order="$(GET o)"
 edit="$(GET e |PATH)"
 
-[ "$order" ] || order=firstname
+[ "$order" ] || order=lastname
 edit="${edit##*/}"
 
 { w_filter_diag
index f2f4a4be0707bf97798cc094be4d9a31d9aaf572..2735c5426d7218dbc0892098bd5b30ad47d6babd 100755 (executable)
@@ -25,35 +25,16 @@ edit_card(){
            && edit_item "$card" X-ZACK-LEAVEDATE
            card_item "$card" SOUND PHOTO LOGO
          )]
-         [div .section .phone   $(edit_item "$card" TEL)]
-         [div .section .message $(
-           edit_item "$card" EMAIL
-           [ $(pdi_count "$card" IMPP) -gt 0 ] && edit_item "$card" IMPP
-           [ $(pdi_count "$card" URL ) -gt 0 ] && edit_item "$card" URL
-         )]
+         [div .section .phone   $(
+            edit_item "$card" TEL EMAIL
+           [ $(pdi_count "$card" IMPP) -gt 0 ] \
+            && edit_item "$card" IMPP
+           [ $(pdi_count "$card" URL ) -gt 0 ] \
+            && edit_item "$card" URL
+          )]
          [div .section .address $(edit_item "$card" ADR)]
-         [div .section .note    $(edit_item "$card" NOTE)]
-         [div .section .attendance
-           [h3 $(l10n course_attendance) ] $(
-           for course in "$_DATA"/ical/*.ics; do
-             printf '[label [input type="checkbox" name="attendance" value="%s" %s] %s]' \
-                    "${course##*/}" \
-                    "$(grep -qF "${course##*/} ${cardfile##*/}" "$_DATA/mappings/attendance" \
-                       && printf 'checked="checked"'
-                    )" \
-                    "$(pdi_value "$(pdi_load "$course")" SUMMARY |unescape |HTML)"
-           done)
-           [h3 $(l10n CATEGORIES) ] $(
-           grep -xE '[^ ]+' "$_DATA"/mappings/categories |while read -r cat; do
-             printf '[label [input type="checkbox" name="attendance" value="%s" %s] %s]' \
-                    "$(HTML "$cat")" \
-                    "$(seq 1 $(pdi_count "$card" CATEGORIES) |while read c; do
-                      pdi_value "$card" CATEGORIES $c |grep -qxF "$cat" \
-                      && printf 'checked="checked"' && break
-                    done)" \
-                    "$(HTML "$cat")"
-           done)
-         ]
+         [div .section .insurance $(edit_item "$card" X-HEALTH-INSURANCE)]
+         [div .section .note    $(edit_item "$card" NOTE X-CLIENT-REFERRAL)]
          [div .control
            [select .item name="newfield"
              [option value="" disabled="disabled" selected="selected" $(l10n edit_addfieldtext)]
@@ -78,21 +59,13 @@ print_card(){
   local card="$(pdi_load "$cardfile")"
   cat <<-EOF
     [div .card #${cardfile##*/}
-      [div .section .basic &shy;$(
+      [div .section .basic $(
         card_item "$card" FN GENDER NICKNAME BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE SOUND PHOTO LOGO
       )]
-      [div .section .phone   &shy;$(card_item "$card" TEL)]
-      [div .section .message &shy;$(card_item "$card" EMAIL IMPP URL)]
-      [div .section .address &shy;$(card_item "$card" ADR)]
-      [div .section .note    &shy;$(card_item "$card" NOTE)]
-      [div .section .attendance [h3 $(l10n course_attendance) ] [ul &shy;
-        $(grep -F "    ${cardfile##*/}" "$_DATA/mappings/attendance" |while read each discard; do
-          printf '[li [a .item .attendance href="/courses#%s" &shy;%s]]' \
-                 "$each" \
-                 "$(pdi_value "$(pdi_load "$_DATA/ical/$each")" SUMMARY |unescape |HTML)"
-        done)]
-        $(card_item "$card" CATEGORIES)
-      ]
+      [div .section .address   $(card_item "$card" ADR)]
+      [div .section .phone     $(card_item "$card" TEL EMAL IMPP URL)]
+      [div .section .insurance $(card_item "$card" X-HEALTH-INSURANCE)]
+      [div .section .note      $(card_item "$card" NOTE X-CLIENT-REFERRAL)]
       [div .control
         [a .item href="/cards/edit_card.sh?card=${cardfile##*/}" $(l10n edit)]
         [a .item href="/cards/export_card.sh?card=${cardfile##*/}" $(l10n vcf_export)]
index 5fbf125b746b06fdc7c58868a2f0ffc5470abef7..a3836bf17fd016aae72a486c777e687e766e4925 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-list_categories() {
-  grep -vxE '^[        ]*$' "${_DATA}/mappings/categories"
-}
-
 w_filter_item() {
 n=$3
 cat <<EOF
@@ -32,15 +28,6 @@ cat <<EOF
               "$field" "$n" "$(l10n filter_$field)"
     done)
     [input type="text" name="filter_text$n" value="$([ "$1" = CATEGORIES ] || HTML "$2")" placeholder="$(l10n filter_placeholder)"]
-    [fieldset .categories
-      $(list_categories | while read cat; do
-          printf '[label [checkbox "filter_cat%i" "|%s" %s] %s ]' \
-                 "$n" "$(HTML "$cat")" \
-                 "$(printf %s "$cat" |grep -qxEe "$2" && printf checked )" \
-                 "$(HTML "$cat")"
-      done)
-      [a href="/cards/categories.sh" $(l10n edit_categories)]
-    ]
   ]
 EOF
 }
@@ -72,21 +59,6 @@ w_filter_diag(){
 EOF
 }
 
-# listcards |grep ${edit:+-v} "$edit" \
-# | while read card; do
-#   "${_EXEC}"/cgilite/html-sh.sed <<-ENDCARD
-#      [div #${card} .card
-#        $(view_card "$card")[!--
-#        --][div .control
-#          [a "?action=edit_card&card=${card}" .item $(l10n edit)]
-#          [a "?action=export_vcard&card=${card}".item $(l10n vcf_export)]
-#          ${profile_medical:+[a "?action=new_prescription&client=${card}" .item $(l10n new_prescription)]}
-#      ]]
-#      ENDCARD
-# done
-
-#!/bin/sh
-
 card_item(){
   local card="$1"
   local item cnt c
@@ -96,12 +68,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 +101,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 +111,30 @@ 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
         ;;
+      X-HEALTH-INSURANCE)
+        [ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n X-HEALTH-INSURANCE)"
+        seq 1 $cnt |while read c; do
+          IFS=\; read -r hi_name hi_number hi_status <<-EOF
+               $(pdi_value "$card" X-HEALTH-INSURANCE $c)
+               EOF
+          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)"
+        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
         ;;
index 093a5c4a90051bb87e717c6619c7cffd6cde997a..ef9c74778fab4626587dbb15727d35bec0420ec8 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -26,7 +26,7 @@ yield_page() {
   printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'
   { printf '
        [html [head
-          [title Confetti]
+          [title Lobster]
          [meta name="viewport" content="width=device-width"]
          [link rel="stylesheet" type="text/css" href="/style.css"]
     '