# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Confetti. # # Confetti is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Confetti is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . setchecked() { printf 'checked="checked"' } setselected() { printf 'selected="selected"' } check_gen() { [ "$values[GENDER]" = "$1" ] && setselected } check_a() { egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && setchecked } teltype() { cat <<-EOF EOF } list_items(){ item="$1" placeholder="$2" [ -n "${values[$item]+x}" ] && printf '

%s

\n' "$(l10n $item)" for n in "$item" "$item"{0..100}; do if [ -n "${values[$n]+x}" ]; then case "$item" in (ADR|NOTE) printf '\n' \ "$item" "$item" "$(htmlsafe ${values[$n]})" ;; (TEL) teltype "${values[${n}_TYPE]}" printf '\n' \ "$item" "$item" "$(attribsafe ${values[$n]})" ;; (*) printf '\n' \ "$item" "$item" "$(attribsafe ${values[$n]})" "$placeholder" ;; esac else break fi done } list_section(){ printf '
' "$1" shift 1 for each in $@; do list_items "$each" done printf '
' } hi_company="${values[X-HEALTH-INSURANCE+0]}" hi_number="${values[X-HEALTH-INSURANCE+1]}" hi_status="${values[X-HEALTH-INSURANCE+2]}" [ -z "$values[UID]" ] && values[UID]="$(uuidgenerator)" cat <

$(l10n N)

END_HTML for n in NICKNAME NICKNAME{0..100}; do [ -z "${values[$n]+x}" ] && break \ || printf ' ' "$(attribsafe ${values[$n]})" "$(l10n NICKNAME)" done list_items BDAY YYYY-MM-DD list_items X-ZACK-JOINDATE YYYY-MM-DD list_items X-ZACK-LEAVEDATE YYYY-MM-DD [ -n "$values[SOUND]" ] && printf ' ' "$values[SOUND]" [ -n "$values[PHOTO]" ] && printf ' ' "${values[PHOTO_TYPE]}" "${values[PHOTO]}" [ -n "$values[LOGO]" ] && printf ' ' "${values[LOGO_TYPE]}" "${values[LOGO]}" printf '
' if [ "$PROFILE" = circus ]; then list_section phone TEL list_section message EMAIL IMPP URL list_section address ADR list_section note NOTE X-CLIENT-REFERRAL cat <<-END_HTML

$(l10n course_attendance)

$(listcourses |while read each; do cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")" printf '' \ "$(attribsafe "$each")" "$(check_a "$each")" "$(htmlsafe "$cname")" done)
END_HTML elif [ "$PROFILE" = medical ]; then list_section address ADR list_section phone TEL EMAIL IMPP URL cat <<-END_HTML

$(l10n X-HEALTH-INSURANCE)

END_HTML list_section note NOTE X-CLIENT-REFERRAL fi cat < END_HTML