-check(){
+# Copyright 2014 Paul Hänsch
+#
+# This file is part of Confetti.
+#
+# Confetti is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Confetti is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
+
+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="?action=filter_attendee" method="POST">
<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">