X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=cards%2Flist.sh;h=616d6abb1b966f90531937d1aa5a6938e5c5da5f;hb=b67065bfb57b072dd1c344eedabfbb545eae6629;hp=ab67fbd4edefcef625c3980dd003a64e385eb5cc;hpb=a6e3da877a73be739ac96b12d9cde2190b24a423;p=lobster diff --git a/cards/list.sh b/cards/list.sh index ab67fbd..616d6ab 100755 --- a/cards/list.sh +++ b/cards/list.sh @@ -13,47 +13,26 @@ edit_card(){ else card="$(pdi_load "$tempfile")" cat <<-EOF - [form .card #${cardfile##*/} action="/cards/update_card.sh" method="POST" + [span .card-anchor #${cardfile##*/}] + [form .card action="/cards/update_card.sh" method="POST" [input type="hidden" name="tid" value="$(transid ${tempfile})"] [div .section .basic $( edit_item "$card" N GENDER [ "$(pdi_count "$card" NICKNAME)" -gt 0 ] \ && edit_item "$card" NICKNAME edit_item "$card" BDAY - edit_item "$card" X-ZACK-JOINDATE - [ "$(pdi_count "$card" X-ZACK-LEAVEDATE)" -gt 0 ] \ - && 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 || l10n "(unnamed course)" |unescape |HTML)" - done) - [h3 $(l10n CATEGORIES) ] $( - grep -xE '[^ ]+' "$_DATA"/mappings/categories |while read -r cat; do - printf '[label [input type="checkbox" name="CATEGORIES" 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 [div .item .delete label="$(l10n edit_delete)" [input type="checkbox" #delete] @@ -81,26 +60,27 @@ edit_card(){ print_card(){ local cardfile="$1" local card="$(pdi_load "$cardfile")" + local N1 N2 N3 N4 N5 + IFS=\; read N1 N2 N3 N4 N5 <<-EOF + $(pdi_value "$card" N |pdi_unescape |HTML) + EOF + cat <<-EOF [div .card #${cardfile##*/} - [div .section .basic . $( - card_item "$card" FN GENDER NICKNAME BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE SOUND PHOTO LOGO + [div .section .basic + [h2 .item .FN . $N4 $N1 $N5] + [span .item .firstname . $N2 $N3] + $( + card_item "$card" GENDER NICKNAME BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE SOUND PHOTO LOGO )] - [div .section .phone . $(card_item "$card" TEL)] - [div .section .message . $(card_item "$card" EMAIL IMPP URL)] - [div .section .address . $(card_item "$card" ADR)] - [div .section .note . $(card_item "$card" NOTE)] - [div .section .attendance [h3 $(l10n course_attendance) ] [ul - $(grep -F " ${cardfile##*/}" "$_DATA/mappings/attendance" |while read each discard; do - printf '[li [a .item .attendance href="/courses#%s" . %s]]' \ - "$each" \ - "$(pdi_value "$(pdi_load "$_DATA/ical/$each")" SUMMARY || l10n "(unnamed course)" |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 .section .therapies $(card_item "$card" therapies)] [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)] + [a .item .button href="/cards/edit_card.sh?card=${cardfile##*/}" $(l10n edit)] + [a .item .button href="/cards/export_card.sh?card=${cardfile##*/}" $(l10n vcf_export)] ] ] EOF @@ -111,8 +91,6 @@ print_cards(){ while read cardfile; do cachefile="${_DATA}/cache/${cardfile##*/}.cache" - # if [ -s "$cachefile" -a "$cachefile" -nt "$cardfile" \ - # -a "$cachefile" -nt "${_EXEC}/cards" ]; then if [ -s "$cachefile" -a "$cachefile" -nt "$cardfile" ]; then cat "$cachefile" else @@ -125,12 +103,13 @@ filter_cards(){ local filter f fex='x;p;' filter="$(printf %s "${filter}" \ - | sed -E 's;[]\/\(\)\\\$\?\.\+\*\;\[\{\}];\\\\&;g; + | sed -E 's;[]\/\(\)\\\$\?\.\+\*\;\[\{\}];\\&;g; '"$upcase" )^" while [ "$filter" ]; do f="${filter%%^*}" filter="${filter#*^}" + debug "Filter: $f" case $f in '') break ;; @@ -146,10 +125,9 @@ filter_cards(){ done for cardfile in "${_DATA}"/vcard/*.vcf; do - printf '%s\n' "$cardfile" - cat "$cardfile" + printf '%s\n' "$cardfile" "$(grep -vxE " *${CR}?" "$cardfile")" done \ - | sed -nE ':X; /\nEND:VCARD\r?$/!{ N; bX; }; h; s;\n.*$;;; x; s;^[^\n]+\n;;; + | sed -En ':X; /\nEND;?:VCARD\r?$/!{ N; bX; }; h; s;\n.*$;;; x; s;^[^\n]+\n;;; '"$upcase""$fex" }