X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=templates%2Fedit_attendee.sh;h=357e2bfaccad22f293519093ddbd09422403cd23;hp=13b550a407ee446482203f9668b3050ca3d31a7a;hb=b3ddca9d8e6af72d0e9847b3d5d1f7778ef1f1af;hpb=8b887633d34fe136ffba19a29290ec095c310331 diff --git a/templates/edit_attendee.sh b/templates/edit_attendee.sh index 13b550a..357e2bf 100755 --- a/templates/edit_attendee.sh +++ b/templates/edit_attendee.sh @@ -1,116 +1,114 @@ -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:')" +check_gen() { + [ "$value[GENDER]" = "$1" ] && echo 'selected="selected"' +} +check_a() { + egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && echo 'checked="checked"' +} + +n_last="$(echo "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')" +n_first="$(echo "$values[N]" |sed -rn 's:^([^;]*;){1} *([^;]*).*$:\2:p')" +n_middle="$(echo "$values[N]" |sed -rn 's:^([^;]*;){2} *([^;]*).*$:\2:p')" +n_pre="$(echo "$values[N]" |sed -rn 's:^([^;]*;){3} *([^;]*).*$:\2:p')" +n_post="$(echo "$values[N]" |sed -rn 's:^([^;]*;){4} *([^;]*)*$:\2:p')" + +SUP_FIELDS=(N NICKNAME GENDER BDAY EMAIL TEL IMPP ADR URL NOTE) +[ -z "$values[UID]" ] && values[UID]="$(dbus-uuidgen)" - 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 ' '$values[$n]'' - 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 ' '$(l10n N)'' +echo ' ' +echo ' ' +echo ' ' +echo ' ' +echo ' ' +if [ -n "$value[GENDER]" ]; then echo '
' echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo '
' -} - -edit_attendee() { #Parameter: Cardfile - id="$1" - cardfile="vcard/$id" - unset key +fi +for n in NICKNAME NICKNAME{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' ' +done +if [ -n "$values[BDAY]" ]; then + echo ' '$(l10n BDAY)'' + echo ' ' +fi +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 ' ' +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 ' ' +done +echo '
' +echo '' +echo '
' +echo ' '$(l10n ADR)'' +for n in ADR ADR{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' ' +done +[ -n "$values[URL]" ] && \ + echo ' '$(l10n URL)'' +for n in URL URL{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' ' +done +echo '
' +echo '' +echo '
' +echo ' '$(l10n NOTE)'' +for n in NOTE NOTE{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' ' +done +echo '
' +echo '' +echo '
' +echo ' '$(l10n course_attendance)'' +listcourses |while read each; do + cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")" + echo ' '$cname'' +done +echo '
' +echo '' +echo '
' +echo ' ' +echo ' ' +echo ' ' +echo ' ' +echo ' ' +echo '
' +echo '' +echo '
' +echo '
' - declare -A tags - declare -A values - vcf_parse "$cardfile" |while read -r line; do - declare -A tag - case "$line" in - value*) eval "$line";; - tag*) eval "$line";; - key*) - if [ -z "$key" ]; then - eval "$line" - else - values[$key]="$value" - for t in ${(k)tag}; do - tags[${key}_$t]="$tag[$t]" - done - eval "$line" - 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 -}