From 786c12839c61826d4d06e2a2f62d1a3d8b7ea780 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 14 Nov 2016 17:02:47 +0000 Subject: [PATCH] unify client and attendee editing templates svn path=/trunk/; revision=147 --- pages/cards.sh | 4 +- templates/{edit_attendee.sh => edit_card.sh} | 6 +- templates/edit_client.sh | 160 ------------------- 3 files changed, 4 insertions(+), 166 deletions(-) rename templates/{edit_attendee.sh => edit_card.sh} (98%) delete mode 100755 templates/edit_client.sh diff --git a/pages/cards.sh b/pages/cards.sh index 2d1d4e2..945908e 100755 --- a/pages/cards.sh +++ b/pages/cards.sh @@ -31,7 +31,6 @@ medical) SUP_FIELDS=(N NICKNAME GENDER BDAY ADR TEL EMAIL X-HEALTH-INSURANCE X-HEALTH-INSURANCE-NOCONTRIB IMPP URL NOTE X-CLIENT-REFERRAL) FORCE_ITEMS=(ADR TEL EMAIL NOTE X-CLIENT-REFERRAL) view_card="$_EXEC/templates/view_client.sh" - edit_card="$_EXEC/templates/edit_client.sh" _GET[order]="${_GET[order]:-lastname}" _GET[filtertype]="${_GET[filtertype]:-name}" profile_medical=x @@ -40,7 +39,6 @@ circus) SUP_FIELDS=(N NICKNAME GENDER BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE EMAIL TEL IMPP ADR URL NOTE) FORCE_ITEMS=(BDAY X-ZACK-JOINDATE TEL EMAIL ADR NOTE) view_card="$_EXEC/templates/view_attendee.sh" - edit_card="$_EXEC/templates/edit_attendee.sh" _GET[order]="${_GET[order]:-firstname}" _GET[filtertype]="${_GET[filtertype]:-any}" profile_circus=x @@ -269,5 +267,5 @@ edit_card() { #Parameter: Cardfile declare -A values vcf_parse "$cardfile" force_items $FORCE_ITEMS - . $edit_card + . "$_EXEC/templates/edit_card.sh" } diff --git a/templates/edit_attendee.sh b/templates/edit_card.sh similarity index 98% rename from templates/edit_attendee.sh rename to templates/edit_card.sh index 820bce8..b3af045 100755 --- a/templates/edit_attendee.sh +++ b/templates/edit_card.sh @@ -76,9 +76,9 @@ list_section(){ printf '' } -hi_company="${values[X-HEALTH-INSURANCE+1]}" - hi_number="${values[X-HEALTH-INSURANCE+2]}" - hi_status="${values[X-HEALTH-INSURANCE+3]}" +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)" diff --git a/templates/edit_client.sh b/templates/edit_client.sh deleted file mode 100755 index f2c5afb..0000000 --- a/templates/edit_client.sh +++ /dev/null @@ -1,160 +0,0 @@ -# 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 -} - -hi_company="${values[X-HEALTH-INSURANCE+1]}" -hi_number= "${values[X-HEALTH-INSURANCE+2]}" -hi_status= "${values[X-HEALTH-INSURANCE+3]}" - -[ -z "$values[UID]" ] && values[UID]="$(uuidgenerator)" - -cat < - -
-

$(l10n N)

- - - - - - - - - $(for n in NICKNAME NICKNAME{0..10}; do - printf %s\\n "${values[$n]+}" - 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]" - ) - ${values[PHOTO]+} - ${values[LOGO]+} -
- -
- $(list_items ADR) -
- -
- $(list_items TEL) - $(list_items EMAIL) - $(list_items IMPP) - $(list_items URL) -
- -
-

$(l10n X-HEALTH-INSURANCE)

- - - - - - -
- -
- $(list_items NOTE) - $(list_items X-CLIENT-REFERRAL) -
- -
- - - - - -
- - -END_HTML -- 2.39.2