]> git.plutz.net Git - confetti/blob - templates/cards.html.sh
377ccf8ebe478e39e3083e699cfed30dcc6014a8
[confetti] / templates / cards.html.sh
1 # Copyright 2014 - 2016 Paul Hänsch
2 #
3 # This file is part of Confetti.
4
5 # Confetti is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9
10 # Confetti is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Affero General Public License for more details.
14
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
17
18 check_type(){
19   #[ "${_GET[filtertype]}" = "$1" ] && echo 'checked="checked"'
20   [ "${_GET[filter]%%:*}" = "$1" ] && echo 'checked="checked"'
21 }
22 check_order(){
23   [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"'
24 }
25
26 cat <<EOF
27 <form class="filter" action="?action=filter_card" method="POST">
28   <h1>$(l10n filter_label)</h1>
29   <input type="hidden" name="page" value="cards"/>
30   <fieldset class="item">
31   <legend>$(l10n filter_item):</legend>
32     <input  id="any" type="radio" name="filtertype" value="any" $(check_type any)>
33     <label for="any" >$(l10n filter_all)</label>
34
35     <input  id="name" type="radio" name="filtertype" value="name" $(check_type name)>
36     <label for="name">$(l10n filter_name)</label>
37
38     <input  id="street" type="radio" name="filtertype" value="street" $(check_type street)>
39     <label for="street">$(l10n filter_street)</label>
40
41     <input  id="zip" type="radio" name="filtertype" value="zip" $(check_type zip)>
42     <label for="zip">$(l10n filter_zip)</label>
43
44     <input  id="telephone" type="radio" name="filtertype" value="TEL" $(check_type TEL)>
45     <label for="telephone">$(l10n filter_phone)</label>
46
47     <input  id="birth" type="radio" name="filtertype" value="BDAY" $(check_type BDAY)>
48     <label for="birth">$(l10n filter_birthyear)</label>
49
50 <!--
51     ${profile_circus:+
52     <input  id="course" type="radio" name="filtertype" value="course" $(check_type course)>
53     <label for="course">$(l10n filter_course)</label>
54     }
55 -->
56
57     <input type="text" name="filter" value="${_GET[filter]#*:}" placeholder="$(l10n filter_placeholder)"/>
58   </fieldset>
59
60   <fieldset class="order">
61     <legend>$(l10n filter_order):</legend>
62     <label><input type="radio" name="order" value="firstname" $(check_order firstname)>$(l10n filter_firstname)</label>
63     <label><input type="radio" name="order" value="lastname"  $(check_order lastname) >$(l10n filter_lastname)</label>
64     <label><input type="radio" name="order" value="bdate"     $(check_order bdate)    >$(l10n filter_bdate)</label>
65   </fieldset>
66   <button type="submit" name="choice" value="new_filter">$(l10n filter_apply)</button>
67   <button type="submit" name="choice" value="del_filter">$(l10n filter_cancel)</button>
68 </form>
69
70 <form class="newcard" action="?action=new_card" method="POST">
71   <button type="submit">$(l10n newcard)</button>
72 </form>
73
74 ${edit:+$(edit_card "$edit")}
75 EOF
76
77 listcards |grep ${edit:+-v} "$edit" \
78 | while read card; do
79   cat <<-ENDCARD
80         <div id="${card}" class="card">
81           $(view_card "$card")<!--
82           --><div class="control">
83             <a class="item" href="?action=edit_card&card=${card}">$(l10n edit)</a>
84             <a class="item" href="?action=export_vcard&card=${card}">$(l10n vcf_export)</a>
85             ${profile_medical:+
86             <a class="item" href="?action=new_prescription&client=${card}">$(l10n new_prescription)</a>
87             }
88           </div>
89         </div>
90         ENDCARD
91 done
92
93 # vi:set filetype=html: