From: paul Date: Wed, 27 Nov 2013 21:07:54 +0000 (+0000) Subject: allowed editing of full name X-Git-Url: https://git.plutz.net/?p=confetti;a=commitdiff_plain;h=d959549ee6cec995f6e8975002b3bc0e9375e564 allowed editing of full name svn path=/trunk/; revision=20 --- diff --git a/actions/update_attendee.sh b/actions/update_attendee.sh index 10eb82c..6f46cb2 100644 --- a/actions/update_attendee.sh +++ b/actions/update_attendee.sh @@ -8,6 +8,7 @@ cardfile="vcard/$card" 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 diff --git a/pages/attendees.sh b/pages/attendees.sh index 9ea073e..aecc95d 100755 --- a/pages/attendees.sh +++ b/pages/attendees.sh @@ -35,8 +35,8 @@ vcf_parse() { 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; @@ -116,16 +116,19 @@ vcf_parse() { |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' \ diff --git a/templates/edit_attendee.sh b/templates/edit_attendee.sh index d79553f..cb0b5b1 100755 --- a/templates/edit_attendee.sh +++ b/templates/edit_attendee.sh @@ -1,6 +1,6 @@ edit_card_item() { case "$key" in - BEGIN|VERSION|END);; + BEGIN|VERSION|END|FN);; PHOTO) echo "" ;; @@ -9,8 +9,21 @@ edit_card_item() { [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])" echo ":" ;| + 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 "" + echo "" + echo "" + echo "" + echo "" + echo "" + ;; *) - echo "" + echo "" echo "" ;; esac @@ -20,9 +33,8 @@ edit_attendee() { 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";; diff --git a/templates/text_attendee.sh b/templates/text_attendee.sh index 6a90192..509fb47 100755 --- a/templates/text_attendee.sh +++ b/templates/text_attendee.sh @@ -3,6 +3,12 @@ declare -A item_name 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" diff --git a/templates/view_attendee.sh b/templates/view_attendee.sh index 86dad68..a96444a 100755 --- a/templates/view_attendee.sh +++ b/templates/view_attendee.sh @@ -1,6 +1,6 @@ view_card_item() { case "$key" in - BEGIN|VERSION|END);; + BEGIN|VERSION|END|N|NICKNAME);; PHOTO) echo "" ;; @@ -13,20 +13,20 @@ view_card_item() { echo ":" ;| EMAIL) - echo "$value" + echo "$value" ;; IMPP) - echo ""$(echo "$value" |cut -d: -f2-)"" + echo ""$(echo "$value" |cut -d: -f2-)"" ;; *) - echo "$value" + echo "$value" ;; 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