X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=pages%2Fcards.sh;h=17b8f73c6fdbe60783cc0a75d996c2fb5f9e0e00;hp=d1170b0ada1f5cb767e4f04af476b2fcc6b6029d;hb=957f0ced0095d421006a0dbc68ef9be8a4325514;hpb=891dee2c19bd2836e6818bffce1174f30c5d1ae5 diff --git a/pages/cards.sh b/pages/cards.sh index d1170b0..17b8f73 100755 --- a/pages/cards.sh +++ b/pages/cards.sh @@ -17,7 +17,27 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -[ -z "${_GET[order]}" ] && _GET[order]="firstname" +BR=' +' + +case $PROFILE in +medical) + view_card="$_EXEC/templates/view_client.sh" + edit_card="$_EXEC/templates/edit_client.sh" + _GET[order]="${_GET[order]:-lastname}" + profile_medical=x +;; +circus) + view_card="$_EXEC/templates/view_attendee.sh" + edit_card="$_EXEC/templates/edit_attendee.sh" + _GET[order]="${_GET[order]:-firstname}" + profile_circus=x +;; +esac + +edit="${_GET[edit]}" +[ \! -f "vcard/$edit" -a \! -f "temp/$edit" ] && edit='' +_GET[filtertype]="${_GET[filtertype]:-any}" listcourses() { ls -1 ${_DATA}/ical/*ics |while read file; do @@ -27,7 +47,8 @@ listcourses() { } list_hi_companies(){ - sed -rn 's;^X-HEALTH-INSURANCE:([^\;]+)\;.*$;\1;p' ${_DATA}/vcard/*vcf + sed -rn 's;^X-HEALTH-INSURANCE:([^\;]+)\;.*$;\1;p' ${_DATA}/vcard/*vcf \ + | sort -u } listcards() { @@ -115,7 +136,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 +175,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 +213,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