]> git.plutz.net Git - confetti/blob - templates/edit_attendee.sh
fe33c18e33ee2d26f414600a24bf9021f4880e2a
[confetti] / templates / edit_attendee.sh
1 edit_card_item() {
2   case "$key" in
3     BEGIN|VERSION|END);;
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     *)
13       echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></item>"
14       echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
15       ;;
16   esac
17 }
18
19 edit_attendee() {
20   cardfile="$1"
21   tempfile="temp/$_GET[\"edit\"].vcf"
22   [ -x "$tempfile" ] && cardfile="$tempfile"
23   unset key
24   vcf_parse "$cardfile" |while read -r line; do
25     declare -A tag
26     case "$line" in
27       value*) eval "$line";;
28       tag*)   eval "$line";;
29       key*)
30         if [ -z "$key" ]; then
31           eval "$line"
32         else
33           edit_card_item
34           eval "$line"
35           unset value
36           unset tag
37         fi
38       ;;
39     esac
40   done
41 }