]> git.plutz.net Git - confetti/commitdiff
support for maniupulating vcard categories
authorpaul <paul@plutz.net>
Wed, 11 Oct 2017 16:16:33 +0000 (16:16 +0000)
committerpaul <paul@plutz.net>
Wed, 11 Oct 2017 16:16:33 +0000 (16:16 +0000)
svn path=/trunk/; revision=151

pages/cards.sh
templates/edit_card.sh
templates/view_card.sh

index b9254ff0c2ef7f6c057f51a6d9e797122820937a..b0e7e9413010282e436a05fe2957e01e038d4358 100755 (executable)
@@ -58,6 +58,11 @@ list_hi_companies(){
   | sort -u
 }
 
+list_categories() {
+  catfile="${_DATA}/mappings/categories"
+  sort -u "$catfile"
+}
+
 listcards() {
   case "${_GET[filtertype]}" in
     any)
index b3af045cccebd5770c1cd953f72edbb949221fbd..741a31217e6b2cc58f8c68d600236df020838a94 100755 (executable)
@@ -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
        <select class="item phonetype" name="phonetype">
@@ -141,6 +151,11 @@ if [ "$PROFILE" = circus ]; then
            printf '<label><input type="checkbox" name="attendance" value="%s" %s/>%s</label>' \
              "$(attribsafe "$each")" "$(check_a "$each")" "$(htmlsafe "$cname")"
          done)
+          <h3>$(l10n CATEGORIES)</h3>
+          $(list_categories |while read each; do
+            printf '<label><input type="checkbox" name="CATEGORIES" value="%s" %s/>%s</label>' \
+              "$(attribsafe "$each")" "$(check_c "$each")" "$(htmlsafe "$each")"
+          done)
        </div>
        END_HTML
 elif [ "$PROFILE" = medical ]; then
index 3319e07e188bdf2e0df64fec841c73f6524f8598..9728d8fc4a7ecc99ca20d1fe403567c0517ea875 100755 (executable)
@@ -94,7 +94,10 @@ if [ "$PROFILE" = circus ]; then
     cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")"
     printf '   <li><a class="item attendance" href="?p=courses#%s">%s</a></li>' "$each" "$(htmlsafe $cname)"
   done
-  printf '</ul></div>'
+  printf '</ul>'
+  list_items CATEGORIES
+  printf '</div>'
+
 elif [ "$PROFILE" = medical ]; then
   list_items ADR
   list_items URL