From: paul Date: Wed, 1 Jun 2016 12:47:44 +0000 (+0000) Subject: moved some decision logic out of template X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=bdf05fd0cb8f4c79152adbba9070213bc3087193;p=confetti moved some decision logic out of template svn path=/trunk/; revision=110 --- diff --git a/pages/cards.sh b/pages/cards.sh index 50fee63..056f4d2 100755 --- a/pages/cards.sh +++ b/pages/cards.sh @@ -17,11 +17,28 @@ # 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 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")" diff --git a/templates/cards.html.sh b/templates/cards.html.sh index c3d277f..df630c0 100755 --- a/templates/cards.html.sh +++ b/templates/cards.html.sh @@ -22,30 +22,11 @@ check_order(){ [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"' } -edit="${_GET[edit]}" -[ \! -f "vcard/$edit" -a \! -f "temp/$edit" ] && edit='' -[ -z "${_GET[filtertype]}" ] && _GET[filtertype]="any" - -case $PROFILE in -medical) - view_card=${0%/*}/view_client.sh - edit_card=${0%/*}/edit_client.sh - _GET[order]="${_GET[order]:-lastname}" - profile_medical=x -;; -circus) - view_card=${0%/*}/view_attendee.sh - edit_card=${0%/*}/edit_attendee.sh - _GET[order]="${_GET[order]:-firstname}" - profile_circus=x -;; -esac - cat <

$(l10n filter_label)

- +
$(l10n filter_type):