uid=$(dbus-uuidgen)
card="${uid}.vcf"
-cardfile="vcard/$card"
-tempfile="temp/$card"
-
-touch "$cardfile"
+tempfile="$_DATA/temp/$card"
cat >"$tempfile" <<EOF
BEGIN:VCARD
;;
cancel)
rm "$tempfile"
- echo -n "Location: http://$HTTP_HOST/?page=attendees#$card\n\n"
+ [ -f "$cardfile" ] \
+ && echo -n "Location: http://$HTTP_HOST/?page=attendees#$card\n\n" \
+ || echo -n "Location: http://$HTTP_HOST/?page=attendees\n\n"
;;
delete)
rm "$tempfile" "$cardfile"
[ "$_GET[\"choice\"]" = "del_filter" ] && _GET["filter"]="" && _GET["filtertype"]=""
listcards() {
- case "$_GET["filtertype"]" in
+ case "$_GET[\"filtertype\"]" in
any)
grep -il "$_GET[\"filter\"]" ${_DATA}/vcard/*vcf
;;
;;
*) ls -1 ${_DATA}/vcard/*vcf
;;
- esac |sed -r 's:^(.*/)([^/]+)$:\2:'
+ esac |case "$_GET[\"order\"]" in
+ firstname)
+ while read file; do
+ fn=$(sed -rn 's:^N(;.+)*\:([^;]*;){1} *([^;]*).*$:\3:p' "$file")
+ echo "$fn\t$file"
+ done
+ ;;
+ lastname)
+ while read file; do
+ ln=$(sed -rn 's:^N(;.+)*\:([^;]*;){0} *([^;]*).*$:\3:p' "$file")
+ echo "$ln\t$file"
+ done
+ ;;
+ bdate)
+ while read file; do
+ bd=$(sed -rn 's:^BDAY(;.+)*\:(.*)$:\2:p' "$file")
+ echo "$bd\t$file"
+ done
+ ;;
+ *)
+ sed -r 's:^.*$:x\t&:'
+ ;;
+ esac |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:'
}
vcf_parse() {
cat <<EOF
-#filter {}
-#newcard {}
+.filter {
+ display: block;
+ width: 128ex;
+ border-width: 1px;
+ border-style: solid;
+ margin: 2em 5% .5em 5%;
+ padding: .25em 1ex .25em 1ex;
+ background: #EFF;
+}
-#cardlist {}
+.filter > .label {
+ display: block;
+ font-weight: bold;
+ font-size: 1.2em;
+ border-style: none none solid none;
+ border-width: 1px;
+ margin: 0em 0ex .5em 0ex;
+ background: #EEF;
+}
-.cardlist .card {
- margin: 4px 5%;
+.filter .search {
+ margin: 0em 2ex .5em 2ex;
+}
+.filter .search .label {
+ display: inline-block;
+ width: 12ex;
+ font-weight: bold;
+ margin-top: .5em;
+}
+.filter .search input[type="radio"] {
+ margin-top: .5em;
+ margin-left: 1ex;
+}
+.filter .search button {
+ margin-top: .5em;
+}
+
+.filter .search input[type="text"] {
+ width: 124ex;
+}
+
+.newcard {
+ display: block;
+ width: 126ex;
border-width: 1px;
border-style: solid;
+ margin: .5em 5% 1em 5%;
+ padding: .25em 2ex .25em 2ex;
+ background: #EFF;
+}
+
+.cardlist .card {
+ display: block;
+ width: 130ex;
+ border-style: solid;
+ border-width: 1px;
+ margin: 4px 5%;
padding: 0;
overflow: auto;
- width:130ex;
- display: block;
}
.cardlist .card .section {
- float:left;
display: inline-block;
+ float:left;
width: 20ex;
margin: .125em .5ex .5ex .5ex;
- background: #EEE;
padding: 0 .2em .2em .2em;
+ background: #EEE;
}
.cardlist .card .control {
float: right;
- background: #EEF;
text-align: right;
margin-right: 0;
+ background: #EEF;
}
.cardlist .card .control .item {
- margin-right: 1ex;
margin-top: .2em;
+ margin-right: 1ex;
}
.cardlist .card .control a.item {
+ min-width: 10ex;
border-style: solid double solid solid;
border-width: 1px 3px 1px 1px;
- background: #FFF;
- padding: .1em 1ex;
- min-width: 10ex;
border-color: #000;
+ padding: .1em 1ex;
+ background: #FFF;
}
.cardlist .card .control a.item:hover{
border-width: 1px 1px 1px 1px;
}
.cardlist .card .section .item {
- max-width: 20ex;
display: block;
+ max-width: 20ex;
word-wrap: break-word;
}
-check(){
+check_type(){
[ "$_GET[\"filtertype\"]" = "$1" ] && echo 'checked="checked"'
}
+check_order(){
+ [ "$_GET[\"order\"]" = "$1" ] && echo 'checked="checked"'
+}
edit="$_GET[\"edit\"]"
-[ -z "$_GET[\"filtertype\"]" ] && _GET[filtertype]="any"
+[ -z "$_GET[\"filtertype\"]" ] && _GET["filtertype"]="any"
+[ -z "$_GET[\"order\"]" ] && _GET["order"]="firstname"
cat <<EOF
<div class="filter">
-<form action="/" method="GET">
- <div class="search">
- <span class="label">Filter:</span>
+ <span class="label">$(l10n filter_label)</span>
+ <form class="search" action="/" method="GET">
<input type="hidden" name="page" value="attendees"/>
- <input type="text" name="filter" value="$_GET["filter"]"/><br/>
- <input type="radio" name="filtertype" value="any" $(check any)>$(l10n filter_all)</input>
- <input type="radio" name="filtertype" value="name" $(check name)>$(l10n filter_name)</input>
- <input type="radio" name="filtertype" value="street" $(check street)>$(l10n filter_street)</input>
- <input type="radio" name="filtertype" value="zip" $(check zip)>$(l10n filter_zip)</input>
- <input type="radio" name="filtertype" value="telephone" $(check telephone)>$(l10n filter_phone)</input>
- <input type="radio" name="filtertype" value="birth" $(check birth)>$(l10n filter_birthyear)</input>
- <input type="radio" name="filtertype" value="course" $(check course)>$(l10n filter_course)</input><br/>
+ <input type="text" name="filter" value="$_GET["filter"]" placeholder="$(l10n filter_placeholder)"/>
+ <br />
+ <span class="label">$(l10n filter_type):</span>
+ <input type="radio" name="filtertype" value="any" $(check_type any)>$(l10n filter_all)</input>
+ <input type="radio" name="filtertype" value="name" $(check_type name)>$(l10n filter_name)</input>
+ <input type="radio" name="filtertype" value="street" $(check_type street)>$(l10n filter_street)</input>
+ <input type="radio" name="filtertype" value="zip" $(check_type zip)>$(l10n filter_zip)</input>
+ <input type="radio" name="filtertype" value="telephone" $(check_type telephone)>$(l10n filter_phone)</input>
+ <input type="radio" name="filtertype" value="birth" $(check_type birth)>$(l10n filter_birthyear)</input>
+ <input type="radio" name="filtertype" value="course" $(check_type course)>$(l10n filter_course)</input>
+ <br />
+ <span class="label">$(l10n filter_order):</span>
+ <input type="radio" name="order" value="firstname" $(check_order firstname)>$(l10n filter_firstname)</input>
+ <input type="radio" name="order" value="lastname" $(check_order lastname)>$(l10n filter_lastname)</input>
+ <input type="radio" name="order" value="bdate" $(check_order bdate)>$(l10n filter_bdate)</input>
+ <br>
<button type="submit" name="choice" value="new_filter">$(l10n filter_apply)</button>
<button type="submit" name="choice" value="del_filter">$(l10n filter_cancel)</button>
- </div>
-</form>
+ </form>
</div>
<div class="newcard">
item_name[edit_addfieldtext]="Neues Feld"
item_name[edit_addfield]="+"
item_name[edit_deletefield]="X"
+item_name[filter_label]="Filter"
+item_name[filter_placeholder]="Begriffe zur Eingrenzung eingeben"
+item_name[filter_type]="Filtertyp"
+item_name[filter_order]="Sortierung"
item_name[filter_all]="Alles"
item_name[filter_name]="Name"
+item_name[filter_firstname]="Vorname"
+item_name[filter_lastname]="Nachname"
item_name[filter_street]="Straße"
item_name[filter_zip]="PLZ."
item_name[filter_phone]="Telefon"
item_name[filter_birthyear]="Geburtsjahr"
+item_name[filter_bdate]="Geburtsdatum"
item_name[filter_course]="Kurs"
item_name[filter_apply]="Filtern"
item_name[filter_cancel]="Filter löschen"