X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=templates%2Fedit_attendee.sh;h=820bce8334e54fae795bb50304092e476c15b3ff;hp=fe33c18e33ee2d26f414600a24bf9021f4880e2a;hb=5736fc8f634020a8a32635e955c3a0d823499f42;hpb=9917259ba7ae33000a3aeb892f392ed71ad0377d;ds=sidebyside
diff --git a/templates/edit_attendee.sh b/templates/edit_attendee.sh
index fe33c18..820bce8 100755
--- a/templates/edit_attendee.sh
+++ b/templates/edit_attendee.sh
@@ -1,41 +1,184 @@
-edit_card_item() {
- case "$key" in
- BEGIN|VERSION|END);;
- PHOTO)
- echo ""
- ;;
- *)
- echo -n "$(l10n "$key")"
- [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
- echo ":"
- ;|
- *)
- echo ""
- echo ""
- ;;
- esac
+# Copyright 2014 - 2016 Paul Hänsch
+#
+# This file is part of Confetti.
+#
+# Confetti is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Confetti is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Confetti. If not, see .
+
+setchecked() {
+ printf 'checked="checked"'
+}
+setselected() {
+ printf 'selected="selected"'
+}
+check_gen() {
+ [ "$values[GENDER]" = "$1" ] && setselected
+}
+check_a() {
+ egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && setchecked
+}
+teltype() {
+ cat <<-EOF
+
+ EOF
}
-edit_attendee() {
- cardfile="$1"
- tempfile="temp/$_GET[\"edit\"].vcf"
- [ -x "$tempfile" ] && cardfile="$tempfile"
- unset key
- vcf_parse "$cardfile" |while read -r line; do
- declare -A tag
- case "$line" in
- value*) eval "$line";;
- tag*) eval "$line";;
- key*)
- if [ -z "$key" ]; then
- eval "$line"
- else
- edit_card_item
- eval "$line"
- unset value
- unset tag
- fi
- ;;
- esac
+list_items(){
+ item="$1"
+ placeholder="$2"
+ [ -n "${values[$item]+x}" ] && printf '
%s
\n' "$(l10n $item)"
+ for n in "$item" "$item"{0..100}; do
+ if [ -n "${values[$n]+x}" ]; then
+ case "$item" in
+ (ADR|NOTE)
+ printf '\n' \
+ "$item" "$item" "$(htmlsafe ${values[$n]})"
+ ;;
+ (TEL)
+ teltype "${values[${n}_TYPE]}"
+ printf '\n' \
+ "$item" "$item" "$(attribsafe ${values[$n]})"
+ ;;
+ (*)
+ printf '\n' \
+ "$item" "$item" "$(attribsafe ${values[$n]})" "$placeholder"
+ ;;
+ esac
+ else
+ break
+ fi
done
}
+
+list_section(){
+ printf '
' "$1"
+ shift 1
+ for each in $@; do
+ list_items "$each"
+ done
+ printf '