From: paul Date: Mon, 7 Oct 2013 09:27:04 +0000 (+0000) Subject: implemented filters X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=71195981a9ea7cc2a050c52f4247609e67d1dbf5;p=lobster implemented filters svn path=/trunk/; revision=12 --- diff --git a/pages/attendees.sh b/pages/attendees.sh index b6088d6..a2730e6 100755 --- a/pages/attendees.sh +++ b/pages/attendees.sh @@ -1,7 +1,31 @@ #!/bin/sh +[ "$_GET[\"action\"]" = "del_filter" ] && _GET["filter"]="" && _GET["filtertype"]="" listcards() { - ls -1 ${_DATA}/vcard/*vcf + case "$_GET["filtertype"]" in + any) + grep -il "$_GET[\"filter\"]" ${_DATA}/vcard/*vcf |debug + ;; + name) + egrep -xil "(FN|NICKNAME|N)(;.+)*:.*$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf |debug + ;; + street) + egrep -xil "(ADR)(;.+)*:([^;]*;){2}$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf |debug + ;; + zip) + egrep -xil "(ADR)(;.+)*:([^;]*;){5}$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf |debug + ;; + telephone) + egrep -xil "(TEL)(;.+)*:.*$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf |debug + ;; + birth) + egrep -xil "(BDAY)(;.+)*:$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf |debug + ;; + course) + ;; + *) ls -1 ${_DATA}/vcard/*vcf + ;; + esac } vcf_parse() { diff --git a/templates/attendees.html.sh b/templates/attendees.html.sh index 002db63..c481c61 100644 --- a/templates/attendees.html.sh +++ b/templates/attendees.html.sh @@ -1,19 +1,23 @@ . ${_EXEC}/templates/view_attendee.sh +check(){ + [ "$_GET[\"filtertype\"]" = "$1" ] && echo 'checked="checked"' +} + cat <
diff --git a/templates/view_attendee.sh b/templates/view_attendee.sh index 8a0f2d5..c9adf7f 100755 --- a/templates/view_attendee.sh +++ b/templates/view_attendee.sh @@ -44,7 +44,7 @@ item_name[VERSION]="" item_name[XML]="" l10n() { - [ -n "$item_name[$1]" ] && echo "$item_name[$1]" || echo "$1" + [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" } view_card_item() { @@ -57,8 +57,8 @@ view_card_item() { echo "

$value

" ;; *) - echo "$(l10n "$key")" - [ -n "$tag[TYPE]" ] && echo "($tag[TYPE])" + echo -n "$(l10n "$key")" + [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])" echo ":" ;| EMAIL) @@ -86,6 +86,8 @@ view_attendee() { #Parameter: Cardfile else view_card_item eval "$line" + unset value + unset tag fi ;; esac