]> git.plutz.net Git - confetti/blob - templates/edit_attendee.sh
removed debug marks
[confetti] / templates / edit_attendee.sh
1 edit_card_item() {
2   case "$key" in
3     BEGIN|VERSION|END|FN);;
4     PHOTO)
5       echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
6       ;;
7     *)
8       echo -n "<span class=\"item\"><span class=\"KEY\">$(l10n "$key")"
9       [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
10       echo ":</span>"
11       ;|
12     N)
13       n_last="$(echo "$value" |sed -r 's:^([^;]*;){0} *([^;]*);.*$:\2:')"
14       n_first="$(echo "$value" |sed -r 's:^([^;]*;){1} *([^;]*);.*$:\2:')"
15       n_middle="$(echo "$value" |sed -r 's:^([^;]*;){2} *([^;]*);.*$:\2:')"
16       n_pre="$(echo "$value" |sed -r 's:^([^;]*;){3} *([^;]*);.*$:\2:')"
17       n_post="$(echo "$value" |sed -r 's:^([^;]*;){4} *([^;]*);*$:\2:')"
18       echo "<input class=\"VALUE\" name=\"3$key\" value=\"$n_pre\" placeholder=\"$(l10n n_pre)\" />"
19       echo "<input class=\"VALUE\" name=\"1$key\" value=\"$n_first\" placeholder=\"$(l10n n_first)\" />"
20       echo "<input class=\"VALUE\" name=\"2$key\" value=\"$n_middle\" placeholder=\"$(l10n n_middle)\" />"
21       echo "<input class=\"VALUE\" name=\"0$key\" value=\"$n_last\" placeholder=\"$(l10n n_last)\" />"
22       echo "<input class=\"VALUE\" name=\"4$key\" value=\"$n_post\" placeholder=\"$(l10n n_post)\" /></span>"
23       echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
24       ;;
25     *)
26       echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></span>"
27       echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
28       ;;
29   esac
30 }
31
32 edit_attendee() {
33   cardfile="vcard/$1"
34   tempfile="temp/$1"
35   [ -f "$tempfile" ] && cardfile="$tempfile"
36   unset key
37   vcf_parse "$cardfile" |while read -r line; do
38     declare -A tag
39     case "$line" in
40       value*) eval "$line";;
41       tag*)   eval "$line";;
42       key*)
43         if [ -z "$key" ]; then
44           eval "$line"
45         else
46           edit_card_item
47           eval "$line"
48           unset value
49           unset tag
50         fi
51       ;;
52     esac
53   done
54 }