Merge commit '36d5feed172cb12ccd469abddebf04eaf9a7c9ae' as 'cgilite'
[confetti] / cards / index.cgi
1 #!/bin/sh
2
3 if [ "$_PATH" = "/cards/cards.css" ]; then
4   . $_EXEC/cgilite/file.sh
5   FILE $_EXEC/cards/cards.css
6   return 0
7 fi
8
9 . $_EXEC/pdiread.sh
10 . $_EXEC/cards/l10n.sh
11 . $_EXEC/cards/widgets.sh
12 . $_EXEC/cards/list.sh
13
14 unescape() { [ $# = 0 ] && sed -E 's;\\(.);\1;g' || printf %s "$*" |sed -E 's;\\(.);\1;g'; }
15 upcase=' y;abcdefghijklmnopqrstuvwxyzäöüé;ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉ;; '
16
17 filter="$(GET f)"
18 order="$(GET o)"
19 edit="$(GET e |PATH)"
20
21 [ "$order" ] || order=firstname
22 edit="${edit##*/}"
23
24 { w_filter_diag
25   printf '
26   [form class="newcard" action="/cards/new_card.sh" method="POST"
27     [button type="submit" %s]
28   ]' "$(l10n newcard)"
29
30   [ "$edit" ] && edit_card "$edit"
31   list_cards
32 } | yield_page cards /cards/cards.css