From 6b021a244e91f2eab215aa195ac19156b182c688 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 11 Oct 2017 16:16:33 +0000 Subject: [PATCH] support for maniupulating vcard categories svn path=/trunk/; revision=151 --- pages/cards.sh | 5 +++++ templates/edit_card.sh | 15 +++++++++++++++ templates/view_card.sh | 5 ++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/pages/cards.sh b/pages/cards.sh index b9254ff..b0e7e94 100755 --- a/pages/cards.sh +++ b/pages/cards.sh @@ -58,6 +58,11 @@ list_hi_companies(){ | sort -u } +list_categories() { + catfile="${_DATA}/mappings/categories" + sort -u "$catfile" +} + listcards() { case "${_GET[filtertype]}" in any) diff --git a/templates/edit_card.sh b/templates/edit_card.sh index b3af045..741a312 100755 --- a/templates/edit_card.sh +++ b/templates/edit_card.sh @@ -27,6 +27,16 @@ check_gen() { check_a() { egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && setchecked } +check_c() { + for n in CATEGORIES CATEGORIES{0..100}; do + if [ -n "${values[$n]+x}" ]; then + [ "${values[$n]}" = "$1" ] && setchecked && break + else + break + fi + done +} + teltype() { cat <<-EOF %s' \ "$(attribsafe "$each")" "$(check_a "$each")" "$(htmlsafe "$cname")" done) +

$(l10n CATEGORIES)

+ $(list_categories |while read each; do + printf '' \ + "$(attribsafe "$each")" "$(check_c "$each")" "$(htmlsafe "$each")" + done) END_HTML elif [ "$PROFILE" = medical ]; then diff --git a/templates/view_card.sh b/templates/view_card.sh index 3319e07..9728d8f 100755 --- a/templates/view_card.sh +++ b/templates/view_card.sh @@ -94,7 +94,10 @@ if [ "$PROFILE" = circus ]; then cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")" printf '
  • %s
  • ' "$each" "$(htmlsafe $cname)" done - printf '' + printf '' + list_items CATEGORIES + printf '' + elif [ "$PROFILE" = medical ]; then list_items ADR list_items URL -- 2.39.2