optical preparation for vcard display
[confetti] / templates / view_attendee.sh
1 declare -A item_name
2
3 item_name[PHOTO]="Foto"
4 item_name[LOGO]="Logo"
5 item_name[FN]="Voller Name"
6 item_name[SOUND]="Aussprache"
7 item_name[GENDER]="Geschlecht"
8 item_name[KIND]="Typ"
9 item_name[TITLE]="Beruf"
10 item_name[ROLE]="Position"
11 item_name[ORG]="Organisation"
12 item_name[MEMBER]="Mitglied"
13 item_name[CATEGORIES]="Kategorien"
14 item_name[ANNIVERSARY]="Jubiläum"
15 item_name[BDAY]="Geburtstag"
16 item_name[EMAIL]="E-Mail"
17 item_name[TEL]="Telefon"
18 item_name[IMPP]="Chat"
19 item_name[ADR]="Anschrift"
20 item_name[URL]="Webseite"
21 item_name[LANG]="Sprache"
22 item_name[NOTE]="Notiz"
23 item_name
24 item_name[RELATED]="Kontakte"
25 item_name
26 item_name[BEGIN]=""
27 item_name[CALADRURI]=""
28 item_name[CALURI]=""
29 item_name[CLASS]=""
30 item_name[CLIENTPIDMAP]=""
31 item_name[END]=""
32 item_name[FBURL]=""
33 item_name[GEO]=""
34 item_name[MAILER]=""
35 item_name[NAME]=""
36 item_name[PRODID]=""
37 item_name[PROFILE]=""
38 item_name[REV]=""
39 item_name[SORT-STRING]=""
40 item_name[SOURCE]=""
41 item_name[TZ]=""
42 item_name[UID]=""
43 item_name[VERSION]=""
44 item_name[XML]=""
45
46 l10n() {
47   [ -n "$item_name[$1]" ] && echo "$item_name[$1]" || echo "$1"
48 }
49
50 view_card_item() {
51   debug "Item: $key"
52   case "$key" in
53     BEGIN|VERSION|END);;
54     PHOTO)
55       debug "Type: $tag[TYPE]"
56       echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
57       ;;
58     FN)
59       echo "<h2 CLASS=\"FN\">$value</h2>"
60       ;;
61     *)
62       echo "<span class=\"KEY $key\">$(l10n "$key")"
63       [ -n "$tag[TYPE]" ] && echo "($tag[TYPE])"
64       echo ":</span>"
65       ;|
66     EMAIL)
67       echo "<a href=\"mailto:$value\" class=\"VALUE $key\">$value</a><br/>"
68       ;;
69     IMPP)
70       echo "<a href=\"$value\" class=\"VALUE $key\">"$(echo "$value" |cut -d: -f2-)"</a><br/>"
71       ;;
72     *)
73       echo "<span class=\"VALUE $key\">$value</span><br/>"
74       ;;
75   esac
76 }
77
78 view_attendee() {  #Parameter: Cardfile
79   key=""
80   vcf_parse "$1" |while read -r line; do
81     declare -A tag
82     case "$line" in
83       value*) eval "$line";;
84       tag*)   eval "$line";;
85       key*)
86         if [ -z "$key" ]; then
87           eval "$line"
88         else
89           view_card_item
90           eval "$line"
91         fi
92       ;;
93     esac
94   done
95 }