]> git.plutz.net Git - confetti/blob - templates/edit_attendee.sh
options for card editor, framework for editing actions
[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   unset key
22   vcf_parse "$cardfile" |while read -r line; do
23     declare -A tag
24     case "$line" in
25       value*) eval "$line";;
26       tag*)   eval "$line";;
27       key*)
28         if [ -z "$key" ]; then
29           eval "$line"
30         else
31           edit_card_item
32           eval "$line"
33           unset value
34           unset tag
35         fi
36       ;;
37     esac
38   done
39 }