echo "BEGIN:VCARD\r" >"$tempfile"
echo "VERSION:4.0\r" >>"$tempfile"
+echo "N:$_POST[\"0N\"];$_POST[\"1N\"];$_POST[\"2N\"];$_POST[\"3N\"];$_POST[\"4N\"]\r" >>"$tempfile"
for field in $VCF_FIELDS; do
value="$_POST[\"$field\"]"
n=0
s:^X-MS-CARDPICTURE:001 PHOTO:p;
s:^LOGO:002 LOGO:p;
s:^FN:003 FN:p;
- s:^N:004 N:p
s:^NICKNAME:005 NICKNAME:p;
+ s:^N:004 N:p
s:^SOUND:006 SOUND:p;
s:^GENDER:007 GENDER:p;
s:^X-GENDER:007 GENDER:p;
|sed -r 's:,: :;s:\;: :g;s: +: :g' \
|tr -d '\r'
)
+ echo -E "$line"
;;
005*)
nick=$(echo -E "$line" |sed -r 's:^[0-9]{3} ([^;\:]+)(;[^"\:]+|;"[^"]+")*\:(.*)$:\3:g' |tr -d '\r')
+ echo -E "$line"
;;
- *) [ -n "$n" ] && fn="$n"
- [ -n "$fn" -a -n "$nick" ] && fn="$fn aka. $nick"
- [ -n "$fn" ] && echo -E "003 FN:$fn" \
+ *)
+ [ -n "$n" ] && fn="$n"
+ [ -n "$fn" -a -n "$nick" ] && fn="$fn aka. $nick"
+ [ -n "$fn" ] && echo -E "003 FN:$fn" \
|| echo -E "003 FN:$nick"
- echo -E "$line"
- cat
+ echo -E "$line"
+ cat
;;
esac
done |tr -d '\r' \
edit_card_item() {
case "$key" in
- BEGIN|VERSION|END);;
+ BEGIN|VERSION|END|FN);;
PHOTO)
echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
;;
[ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
echo ":</span>"
;|
+ N)
+ n_last="$(echo "$value" |sed -r 's:^([^;]*;){0} *([^;]*);.*$:\2:')"
+ n_first="$(echo "$value" |sed -r 's:^([^;]*;){1} *([^;]*);.*$:\2:')"
+ n_middle="$(echo "$value" |sed -r 's:^([^;]*;){2} *([^;]*);.*$:\2:')"
+ n_pre="$(echo "$value" |sed -r 's:^([^;]*;){3} *([^;]*);.*$:\2:')"
+ n_post="$(echo "$value" |sed -r 's:^([^;]*;){4} *([^;]*);*$:\2:')"
+ echo "<input class=\"VALUE\" name=\"3$key\" value=\"$n_pre\" placeholder=\"$(l10n n_pre)\" />"
+ echo "<input class=\"VALUE\" name=\"1$key\" value=\"$n_first\" placeholder=\"$(l10n n_first)\" />"
+ echo "<input class=\"VALUE\" name=\"2$key\" value=\"$n_middle\" placeholder=\"$(l10n n_middle)\" />"
+ echo "<input class=\"VALUE\" name=\"0$key\" value=\"$n_last\" placeholder=\"$(l10n n_last)\" />"
+ echo "<input class=\"VALUE\" name=\"4$key\" value=\"$n_post\" placeholder=\"$(l10n n_post)\" /></span>"
+ echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
+ ;;
*)
- echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></item>"
+ echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></span>"
echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
;;
esac
cardfile="vcard/$1"
tempfile="temp/$1"
[ -f "$tempfile" ] && cardfile="$tempfile"
- debug Using card: $cardfile
unset key
- vcf_parse "$cardfile" |debug |while read -r line; do
+ vcf_parse "$cardfile" |while read -r line; do
declare -A tag
case "$line" in
value*) eval "$line";;
item_name[PHOTO]="Foto"
item_name[LOGO]="Logo"
item_name[FN]="Voller Name"
+item_name[N]="Name"
+item_name[n_pre]="Titel"
+item_name[n_first]="Vorname"
+item_name[n_middle]="Mittelnamen"
+item_name[n_last]="Nachname"
+item_name[n_post]="Zusätze"
item_name[NICKNAME]="Spitzname"
item_name[SOUND]="Aussprache"
item_name[GENDER]="Geschlecht"
view_card_item() {
case "$key" in
- BEGIN|VERSION|END);;
+ BEGIN|VERSION|END|N|NICKNAME);;
PHOTO)
echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
;;
echo ":</span>"
;|
EMAIL)
- echo "<a href=\"mailto:$value\" class=\"VALUE $key\">$value</a></item>"
+ echo "<a href=\"mailto:$value\" class=\"VALUE $key\">$value</a></span>"
;;
IMPP)
- echo "<a href=\"$value\" class=\"VALUE $key\">"$(echo "$value" |cut -d: -f2-)"</a></item>"
+ echo "<a href=\"$value\" class=\"VALUE $key\">"$(echo "$value" |cut -d: -f2-)"</a></span>"
;;
*)
- echo "<span class=\"VALUE $key\">$value</span></item>"
+ echo "<span class=\"VALUE $key\">$value</span></span>"
;;
esac
}
view_attendee() { #Parameter: Cardfile
cardfile="vcard/$1"
- cachefile="cache/vcf_$(basename "$cardfile").cache"
+ cachefile="cache/${1}.cache"
unset key
[ "$cachefile" -nt "$cardfile" ] && cat "$cachefile" \
|| vcf_parse "$cardfile" |while read -r line; do