#!/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() {
. ${_EXEC}/templates/view_attendee.sh
+check(){
+ [ "$_GET[\"filtertype\"]" = "$1" ] && echo 'checked="checked"'
+}
+
cat <<EOF
<div class="filter">
<form action="/" method="GET">
<div class="search">
<span class="label">Filter:</span>
<input type="hidden" name="page" value="attendees"/>
- <input type="text" name="filter"/>
- <input type="radio" name="filtertype" value="any" checked="checked">Alles</input>
- <input type="radio" name="filtertype" value="name">Name</input>
- <input type="radio" name="filtertype" value="street">Straße</input>
- <input type="radio" name="filtertype" value="zip">PLZ.</input>
- <input type="radio" name="filtertype" value="telephone">Telefon</input>
- <input type="radio" name="filtertype" value="birth">Geburtsjahr</input>
- <input type="radio" name="filtertype" value="course">Kurs</input>
+ <input type="text" name="filter" value="$_GET["filter"]"/><br/>
+ <input type="radio" name="filtertype" value="any" $(check any)>Alles</input>
+ <input type="radio" name="filtertype" value="name" $(check name)>Name</input>
+ <input type="radio" name="filtertype" value="street" $(check street)>Straße</input>
+ <input type="radio" name="filtertype" value="zip" $(check zip)>PLZ.</input>
+ <input type="radio" name="filtertype" value="telephone" $(check telephone)>Telefon</input>
+ <input type="radio" name="filtertype" value="birth" $(check birth)>Geburtsjahr</input>
+ <input type="radio" name="filtertype" value="course" $(check course)>Kurs</input><br/>
<button type="submit" name="action" value="new_filter">Filtern</button>
<button type="submit" name="action" value="del_filter">Filter löschen</button>
</div>
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() {
echo "<h2 CLASS=\"FN\">$value</h2>"
;;
*)
- echo "<span class=\"item\"><span class=\"KEY $key\">$(l10n "$key")"
- [ -n "$tag[TYPE]" ] && echo "($tag[TYPE])"
+ echo -n "<span class=\"item\"><span class=\"KEY $key\">$(l10n "$key")"
+ [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
echo ":</span>"
;|
EMAIL)
else
view_card_item
eval "$line"
+ unset value
+ unset tag
fi
;;
esac