From: paul Date: Sat, 27 Feb 2016 16:20:54 +0000 (+0000) Subject: enable support for phone number types X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=aedb6776919b351df7df7c310c238c41317ddc44;p=confetti enable support for phone number types svn path=/trunk/; revision=88 --- diff --git a/actions/update_card.sh b/actions/update_card.sh index a810476..f18c9ee 100755 --- a/actions/update_card.sh +++ b/actions/update_card.sh @@ -47,9 +47,10 @@ UID:${_POST[UID]} $( for field in $VCF_FIELDS; do for key in $field $field{0..100}; do - [ -z "$_POST[$key]" ] && break + [ -z "${_POST[$key]+x}" ] && break value="$(printf %s "$_POST[$key]" |sed -r ':a;N;$!ba;s:\n:\\n:g;s:\r:\\r:g')" - printf '%s:%s\n' "${field}" "$value" + [ "${key%%[0-9]*}" = TEL ] && tag="TYPE=${_POST[phonetype${key#TEL}]}" || tag='' + [ -n "$value" ] && printf '%s:%s\n' "${field}${tag:+;$tag}" "$value" done done [ "${_POST[action]}" = addfield ] && printf '%s:\n' "${_POST[newfield]}" diff --git a/pages/cards.sh b/pages/cards.sh index d1170b0..50fee63 100755 --- a/pages/cards.sh +++ b/pages/cards.sh @@ -19,6 +19,9 @@ [ -z "${_GET[order]}" ] && _GET[order]="firstname" +BR=' +' + listcourses() { ls -1 ${_DATA}/ical/*ics |while read file; do icstime="$(sed -rn 's:^DTSTART\:(TZID=.*\:)?([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z?\r$:\2-\3-\4 \5\:\6\:\7:p' "$file")" @@ -115,7 +118,7 @@ vcf_parse() { case "$line" in key=*) printf %s\\n "$line" ;; - value=*) printf %s\\n "$line" + value=*) printf %s\\n "${line}" ;; tag=*) ot='' printf %s "$line" \ @@ -154,7 +157,7 @@ view_card() { #Parameter: Cardfile if [ -z "$key" ]; then eval "$line" else - values[$key]="$value" + values[$key]="${value//\\r\\n/$BR}" for t in ${(k)tag}; do tags[${key}_$t]="$tag[$t]" done @@ -192,7 +195,7 @@ edit_card() { #Parameter: Cardfile if [ -z "$key" ]; then eval "$line" else - [ -n "$value" ] && values[$key]="$value" || values[$key]='\r' + [ -n "$value" ] && values[$key]="${value//\\r\\n/$BR}" || values[$key]='\r' for t in ${(k)tag}; do tags[${key}_$t]="$tag[$t]" done diff --git a/templates/attendees.css.sh b/templates/attendees.css.sh index 036ad04..b7c800e 100755 --- a/templates/attendees.css.sh +++ b/templates/attendees.css.sh @@ -134,6 +134,35 @@ cat <. +setchecked() { + printf 'checked="checked"' +} +setselected() { + printf 'selected="selected"' +} check_gen() { - [ "$values[GENDER]" = "$1" ] && echo 'selected="selected"' + [ "$values[GENDER]" = "$1" ] && setselected } check_a() { - egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && echo 'checked="checked"' + egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && setchecked +} +teltype() { + cat <<-EOF + + EOF } n_last="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')" @@ -85,13 +103,13 @@ cat <

$(l10n TEL)

- + $(teltype "${tags[TEL_TYPE]}") $(for n in TEL{0..10}; do - echo "${values[$n]:+}" + printf "${values[$n]:+$(teltype "${tags[$n_TYPE]}")}" done) ${values[EMAIL]:+

$(l10n EMAIL)

} $(for n in EMAIL EMAIL{0..10}; do - echo "${values[$n]:+}" + printf "${values[$n]:+}" done) ${values[IMPP]:+

$(l10n IMPP)

} $(for n in IMPP IMPP{0..10}; do diff --git a/templates/text_cards.sh b/templates/text_cards.sh index 53d8489..be2efa7 100755 --- a/templates/text_cards.sh +++ b/templates/text_cards.sh @@ -37,6 +37,16 @@ item_name[ANNIVERSARY]="Jubiläum" item_name[BDAY]="Geburtstag" item_name[EMAIL]="E-Mail" item_name[TEL]="Telefon" +item_name[phone_typeselect]="Typ" +item_name[phone_home]="Privat" +item_name[phone_cell]="Mobil" +item_name[phone_work]="Büro" +item_name[phone_fax]="Fax" +item_name[tHOME]="Privat:" +item_name[tWORK]="Büro:" +item_name[tCELL]="Mobil:" +item_name[tFAX]="Fax:" +item_name[tVOICE]="" item_name[IMPP]="Chat" item_name[ADR]="Anschrift" item_name[URL]="Webseite" diff --git a/templates/text_courses.sh b/templates/text_courses.sh index fd92ddd..b86240a 100755 --- a/templates/text_courses.sh +++ b/templates/text_courses.sh @@ -1,4 +1,4 @@ -# Copyright 2014 Paul Hänsch +# Copyright 2014, 2016 Paul Hänsch # # This file is part of Confetti. # @@ -58,7 +58,3 @@ item_name[t_eternal]="ewig" item_name[t_times]="mal" item_name[t_until]="Bis" item_name[t_oclock]="Uhr" - -l10n() { - [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" -} diff --git a/templates/view_client.sh b/templates/view_client.sh index 4b06268..bbcc091 100755 --- a/templates/view_client.sh +++ b/templates/view_client.sh @@ -29,57 +29,57 @@ hi_status="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f3)" cat <

$fullname

- ${values[GENDER]:+$(l10n $values[GENDER])} + ${values[GENDER]:+$(l10n $values[GENDER])} $(for n in NICKNAME NICKNAME{0..10}; do - echo "${values[$n]:+aka. $values[$n]}" + echo "${values[$n]:+aka. $values[$n]}" done) - ${values[BDAY]:+ ${values[BDAY]}} - ${values[SOUND]:+} - ${values[PHOTO]:+} - ${values[LOGO]:+} + ${values[BDAY]:+ ${values[BDAY]}} + ${values[SOUND]:+} + ${values[PHOTO]:+} + ${values[LOGO]:+}

$(l10n ADR)

$(for n in ADR ADR{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done) ${values[URL]:+

$(l10n URL)

} $(for n in URL URL{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done)

$(l10n TEL)

$(for n in TEL TEL{0..10}; do - echo "${values[$n]:+$tags[${n}_TYPE] $values[$n]}" + echo "${values[$n]:+$(l10n t${tags[${n}_TYPE]}) $values[$n]}" done) ${values[EMAIL]:+

$(l10n EMAIL)

} $(for n in EMAIL EMAIL{0..10}; do - echo "${values[$n]:+}" + echo "${values[$n]:+$values[$n]}" done) ${values[IMPP]:+

$(l10n IMPP)

} $(for n in IMPP IMPP{0..10}; do - echo "${values[$n]:+$tags[${n}_TYPE] $values[$n]}" + echo "${values[$n]:+$tags[${n}_TYPE] $values[$n]}" done)

$(l10n X-HEALTH-INSURANCE)

- ${hi_company:+${hi_company}} - ${hi_number:+ ${hi_number}} - ${hi_status:+ ${hi_status}} + ${hi_company:+${hi_company}} + ${hi_number:+ ${hi_number}} + ${hi_status:+ ${hi_status}}
${values[NOTE]:+

$(l10n NOTE)

} $(for n in NOTE NOTE{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done) ${values[X-CLIENT-REFERRAL]:+

$(l10n X-CLIENT-REFERRAL)

} $(for n in X-CLIENT-REFERRAL X-CLIENT-REFERRAL{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done)