From: paul Date: Thu, 28 Nov 2013 04:13:49 +0000 (+0000) Subject: basic editing functions for new view X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=8b887633d34fe136ffba19a29290ec095c310331;p=confetti basic editing functions for new view svn path=/trunk/; revision=23 --- diff --git a/templates/attendees.html.sh b/templates/attendees.html.sh index 337de10..a237d3e 100644 --- a/templates/attendees.html.sh +++ b/templates/attendees.html.sh @@ -43,13 +43,6 @@ $(listcards |while read card; do
$(edit_attendee "$id") -
- -
-
x_EOF diff --git a/templates/edit_attendee.sh b/templates/edit_attendee.sh index cb0b5b1..13b550a 100755 --- a/templates/edit_attendee.sh +++ b/templates/edit_attendee.sh @@ -1,39 +1,92 @@ -edit_card_item() { - case "$key" in - BEGIN|VERSION|END|FN);; - PHOTO) - echo "" - ;; - *) - echo -n "$(l10n "$key")" - [ -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 "" - ;; - esac +edit_card() { + n_last="$(echo "$values[N]" |sed -r 's:^([^;]*;){0} *([^;]*);.*$:\2:')" + n_first="$(echo "$values[N]" |sed -r 's:^([^;]*;){1} *([^;]*);.*$:\2:')" + n_middle="$(echo "$values[N]" |sed -r 's:^([^;]*;){2} *([^;]*);.*$:\2:')" + n_pre="$(echo "$values[N]" |sed -r 's:^([^;]*;){3} *([^;]*);.*$:\2:')" + n_post="$(echo "$values[N]" |sed -r 's:^([^;]*;){4} *([^;]*);*$:\2:')" + + + echo '
' + echo ' '$(l10n NAME)'' + echo ' ' + echo ' ' + echo ' ' + echo ' ' + echo ' ' + [ -n "$value[GENDER]" ] && \ + echo ' '$(l10n $values[GENDER])'' + for n in NICKNAME NICKNAME{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' aka. '$values[$n]'' + done + [ -n "$values[BDAY]" ] &&\ + echo ' *: '$values[BDAY]'' + if [ -n "$values[SOUND]" ]; then + echo ' ' + fi + [ -n "$values[PHOTO]" ] &&\ + echo ' ' + [ -n "$values[LOGO]" ] &&\ + echo ' ' + echo '
' + echo '' + echo '
' + echo ' '$(l10n TEL)'' + for n in TEL TEL{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$tags[${n}_TYPE]' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' '$(l10n EMAIL)'' + for n in EMAIL EMAIL{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' ' + done + [ -n "$values[IMPP]" ] && \ + echo ' '$(l10n IMPP)'' + for n in IMPP IMPP{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$tags[${n}_TYPE]' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' '$(l10n ADR)'' + for n in ADR ADR{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$values[$n]'' + done + [ -n "$values[URL]" ] && \ + echo ' '$(l10n URL)'' + for n in URL URL{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' '$(l10n NOTE)'' + for n in NOTE NOTE{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' ' + echo ' ' + echo ' ' + echo ' ' + echo '
' } -edit_attendee() { - cardfile="vcard/$1" - tempfile="temp/$1" - [ -f "$tempfile" ] && cardfile="$tempfile" +edit_attendee() { #Parameter: Cardfile + id="$1" + cardfile="vcard/$id" unset key + + declare -A tags + declare -A values vcf_parse "$cardfile" |while read -r line; do declare -A tag case "$line" in @@ -43,12 +96,21 @@ edit_attendee() { if [ -z "$key" ]; then eval "$line" else - edit_card_item + values[$key]="$value" + for t in ${(k)tag}; do + tags[${key}_$t]="$tag[$t]" + done eval "$line" - unset value - unset tag + if [ -n "$values[$key]" ]; then + n=0 + while [ -n "$values[$key$n]" ]; do n=$(($n + 1)); done + key=$key$n + fi + unset value + unset tag fi ;; esac done + edit_card }