From: paul Date: Sun, 10 Jan 2016 23:15:40 +0000 (+0000) Subject: rename attendees section to more generic "cards" to allow alternate views for vcards X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=69e661b5c8ec195bd3c4998a623a60607b47059e;p=confetti rename attendees section to more generic "cards" to allow alternate views for vcards svn path=/trunk/; revision=76 --- diff --git a/actions/edit_attendee.sh b/actions/edit_card.sh similarity index 91% rename from actions/edit_attendee.sh rename to actions/edit_card.sh index 2252582..f90b326 100755 --- a/actions/edit_attendee.sh +++ b/actions/edit_card.sh @@ -24,4 +24,4 @@ filter="&filter=${_REF[filter]}" filtertype="&filtertype=${_REF[filtertype]}" order="&order=${_REF[order]}" -echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n" +echo -n "Location: ?p=cards${filter}${filtertype}${order}&edit=$card\n\n" diff --git a/actions/filter_attendee.sh b/actions/filter_card.sh similarity index 87% rename from actions/filter_attendee.sh rename to actions/filter_card.sh index cb620d5..9de0288 100755 --- a/actions/filter_attendee.sh +++ b/actions/filter_card.sh @@ -24,9 +24,9 @@ case "${_POST[choice]}"; in filter="${_POST[filter]}" filtertype="${_POST[filtertype]}" order="${_POST[order]}" - echo -n "Location: ?p=attendees&filter=$filter&filtertype=$filtertype&order=$order\n\n" + echo -n "Location: ?p=cards&filter=$filter&filtertype=$filtertype&order=$order\n\n" ;; *) - echo -n "Location: ?p=attendees\n\n" + echo -n "Location: ?p=cards\n\n" ;; esac diff --git a/actions/generate_courselist.sh b/actions/generate_courselist.sh index 6ea6d43..f6fdda7 100755 --- a/actions/generate_courselist.sh +++ b/actions/generate_courselist.sh @@ -24,7 +24,7 @@ fromdate=$(date -d "$fromdate" +%s) [ -z "$fromdate" ] && fromdate=$(date +%s) . ${_EXEC}/pages/courses.sh loadfunctions -. ${_EXEC}/pages/attendees.sh loadfunctions +. ${_EXEC}/pages/card.sh loadfunctions tex_clean() { #in dire need for improvement echo "$*" |tr -d '{&}\' diff --git a/actions/new_attendee.sh b/actions/new_card.sh similarity index 92% rename from actions/new_attendee.sh rename to actions/new_card.sh index 0b9b70e..2d6c39b 100755 --- a/actions/new_attendee.sh +++ b/actions/new_card.sh @@ -42,4 +42,4 @@ UID:$uid END:VCARD EOF -echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n" +echo -n "Location: ?p=cards${filter}${filtertype}${order}&edit=$card\n\n" diff --git a/actions/update_attendee.sh b/actions/update_card.sh similarity index 86% rename from actions/update_attendee.sh rename to actions/update_card.sh index 4bdd6ba..2250f19 100755 --- a/actions/update_attendee.sh +++ b/actions/update_card.sh @@ -54,7 +54,7 @@ case "${_POST[action]}" in addfield) echo "${_POST[newfield]}:\r" >>"$tempfile" echo "END:VCARD\r" >>"$tempfile" - echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n" + echo -n "Location: ?p=cards${filter}${filtertype}${order}&edit=$card\n\n" ;; update) attendance=() @@ -74,16 +74,16 @@ case "${_POST[action]}" in echo "END:VCARD\r" >>"$tempfile" mv "$tempfile" "$cardfile" - echo -n "Location: ?p=attendees${filter}${filtertype}${order}#$card\n\n" + echo -n "Location: ?p=cards${filter}${filtertype}${order}#$card\n\n" ;; cancel) rm "$tempfile" [ -f "$cardfile" ] \ - && echo -n "Location: ?p=attendees${filter}${filtertype}${order}#$card\n\n" \ - || echo -n "Location: ?p=attendees${filter}${filtertype}${order}\n\n" + && echo -n "Location: ?p=cards${filter}${filtertype}${order}#$card\n\n" \ + || echo -n "Location: ?p=cards${filter}${filtertype}${order}\n\n" ;; delete) rm "$tempfile" "$cardfile" - echo -n "Location: ?p=attendees${filter}${filtertype}${order}\n\n" + echo -n "Location: ?p=cards${filter}${filtertype}${order}\n\n" ;; esac diff --git a/globals.sh b/globals.sh index aac6dc9..5a9d9fe 100755 --- a/globals.sh +++ b/globals.sh @@ -1,6 +1,6 @@ #!/bin/zsh -# Copyright 2014,2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Confetti. # @@ -18,13 +18,21 @@ # along with Confetti. If not, see . export LC_ALL=de_DE.UTF-8 -data_dirs vcard ical cache temp mappings +PROFILE=$(validate "$PROFILE" 'medical|circus' circus ) -VCF_FIELDS=(PHOTO LOGO FN NICKNAME SOUND GENDER KIND TITLE ROLE ORG MEMBER CATEGORIES ANNIVERSARY BDAY EMAIL TEL IMPP ADR URL LANG NOTE RELATED X-ZACK-JOINDATE X-ZACK-LEAVEDATE) - -[ -z "$NAVIGATION" ] && NAVIGATION=(attendees courses) PAGE="${_GET[p]:-$PAGE}" uuidgenerator(){ head -c16 /dev/urandom |sha1sum - |cut -c1-32 } + +VCF_FIELDS=(PHOTO LOGO FN NICKNAME SOUND GENDER KIND TITLE ROLE ORG MEMBER CATEGORIES ANNIVERSARY BDAY EMAIL TEL IMPP ADR URL LANG NOTE RELATED X-ZACK-JOINDATE X-ZACK-LEAVEDATE) + +case "${PROFILE}" in +medical) +;; +circus) + data_dirs vcard ical cache temp mappings + [ -z "$NAVIGATION" ] && NAVIGATION=(cards courses) +;; +esac diff --git a/pages/attendees.sh b/pages/cards.sh similarity index 97% rename from pages/attendees.sh rename to pages/cards.sh index 0a1f88d..f2675ba 100755 --- a/pages/attendees.sh +++ b/pages/cards.sh @@ -1,6 +1,6 @@ #!/bin/zsh -# Copyright 2014, 2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Confetti. # @@ -204,7 +204,7 @@ vcf_parse() { | sed -r 's:[\\$`]:\\&:g' } -view_attendee() { #Parameter: Cardfile +view_card() { #Parameter: Cardfile id="$1" cardfile="$_DATA/vcard/${id}" cachefile="$_DATA/cache/${id}.cache" @@ -239,11 +239,11 @@ view_attendee() { #Parameter: Cardfile ;; esac done - . ${_EXEC}/templates/view_attendee.sh |tee "$cachefile" + . $view_card |tee "$cachefile" fi } -edit_attendee() { #Parameter: Cardfile +edit_card() { #Parameter: Cardfile id="$1" cardfile="$_DATA/vcard/$id" tempfile="$_DATA/temp/$id" @@ -277,5 +277,5 @@ edit_attendee() { #Parameter: Cardfile ;; esac done - . ${_EXEC}/templates/edit_attendee.sh + . $edit_card } diff --git a/templates/attendees.html.sh b/templates/attendees.html.sh index fbc5fe5..12f1226 100755 --- a/templates/attendees.html.sh +++ b/templates/attendees.html.sh @@ -1,4 +1,4 @@ -# Copyright 2014 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Confetti. # @@ -23,13 +23,14 @@ check_order(){ } edit="${_GET[edit]}" +[ \! -f "vcard/$edit" -a \! -f "temp/$edit" ] && edit='' [ -z "${_GET[filtertype]}" ] && _GET[filtertype]="any" [ -z "${_GET[order]}" ] && _GET[order]="firstname" cat < +

$(l10n filter_label)

- +
@@ -52,19 +53,25 @@ cat <$(l10n filter_cancel) -
+
+${edit:+$(edit_card "$edit")} + $( -[ -f "vcard/$edit" -o -f "temp/$edit" ] && edit_attendee "$edit" -if [ "$?" = 0 ]; then - listcards |grep -v "$edit" -else - listcards -fi |while read card; do - view_attendee "$card" -done + listcards |grep ${edit:+-v} "$edit" \ + | while read card; do + cat <<-ENDCARD +
+ $(view_card "$card") +
+ ENDCARD + done ) EOF diff --git a/templates/cards.css.sh b/templates/cards.css.sh new file mode 100755 index 0000000..6a8cef0 --- /dev/null +++ b/templates/cards.css.sh @@ -0,0 +1,7 @@ +case $PROFILE in +medical) +;; +circus) + . ${0%/*}/attendees.css.sh +;; +esac diff --git a/templates/cards.html.sh b/templates/cards.html.sh new file mode 100755 index 0000000..f1f039a --- /dev/null +++ b/templates/cards.html.sh @@ -0,0 +1,9 @@ +case $PROFILE in +medical) +;; +circus) + view_card=${0%/*}/view_attendee.sh + edit_card=${0%/*}/edit_attendee.sh + . ${0%/*}/attendees.html.sh +;; +esac diff --git a/templates/course_print.sh b/templates/course_print.sh index 6f23b33..b9fd840 100755 --- a/templates/course_print.sh +++ b/templates/course_print.sh @@ -1,4 +1,4 @@ -# Copyright 2014 - 2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Confetti. # @@ -15,7 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -. ${_EXEC}/templates/text_attendee.sh +. ${_EXEC}/templates/text_cards.sh echo -E ' \documentclass[landscape,10pt]{article} diff --git a/templates/edit_attendee.sh b/templates/edit_attendee.sh index 5e472a8..9340232 100755 --- a/templates/edit_attendee.sh +++ b/templates/edit_attendee.sh @@ -33,7 +33,7 @@ SUP_FIELDS=(N NICKNAME GENDER BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE EMAIL TEL IM [ -z "$values[UID]" ] && values[UID]="$(uuidgenerator)" cat < +

$(l10n N)

diff --git a/templates/text_attendees.sh b/templates/text_cards.sh similarity index 97% rename from templates/text_attendees.sh rename to templates/text_cards.sh index 2ec576e..ec308ff 100755 --- a/templates/text_attendees.sh +++ b/templates/text_cards.sh @@ -109,7 +109,3 @@ item_name[female]="♀" item_name[male]="♂" item_name[other]="⚥" item_name[none]="⚪" - -l10n() { - [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" -} diff --git a/templates/text_frame.sh b/templates/text_frame.sh index b76b584..aa5858e 100755 --- a/templates/text_frame.sh +++ b/templates/text_frame.sh @@ -1,4 +1,4 @@ -# Copyright 2014, 2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Confetti. # @@ -15,13 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -declare -A item_name - -item_name[p_attendees]="Teilnehmende" +item_name[p_cards]="Teilnehmende" item_name[p_courses]="Kurse" item_name[p_email]="Email" item_name[p_error]="Fehler" - -l10n() { - [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" -} diff --git a/templates/view_attendee.sh b/templates/view_attendee.sh index 0bc29f7..e1b6530 100755 --- a/templates/view_attendee.sh +++ b/templates/view_attendee.sh @@ -16,7 +16,6 @@ # along with Confetti. If not, see . cat <

$values[FN]

${values[GENDER]:+$(l10n $values[GENDER])} @@ -77,11 +76,5 @@ cat <'$cname'' done) -
-
END_HTML diff --git a/templates/view_course.sh b/templates/view_course.sh index f8e2f2c..23088f1 100755 --- a/templates/view_course.sh +++ b/templates/view_course.sh @@ -87,7 +87,7 @@ echo ' ' echo '
' echo '

'$(l10n course_attendance)'

' -list_attendance "$id" |sort -k 2 |sed -r 's:^([^ ]+) (.*)$:\2:' +list_attendance "$id" |sort -k 2 |sed -r 's:^([^ ]+) (.*)$:\2:' echo '
' echo '
'