X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=categories%2Findex.cgi;fp=categories%2Findex.cgi;h=236b1e3abb24b41149f00501427793135be875b0;hp=0000000000000000000000000000000000000000;hb=76c1e7bff1a8604ef2ef7da5d274d0db0e639139;hpb=90288ab07bb1ec83a91581fadc674a87a250a853 diff --git a/categories/index.cgi b/categories/index.cgi new file mode 100755 index 0000000..236b1e3 --- /dev/null +++ b/categories/index.cgi @@ -0,0 +1,71 @@ +#!/bin/sh +# Copyright 2015, 2017, 2018, 2021 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 . + +. $_EXEC/pdiread.sh +. $_EXEC/categories/l10n.sh + +catfile="${_DATA}/mappings/categories" + +list_categories() { + grep -vxE '[ ]*' "$catfile" |sort -u +} + +list_catsel(){ + local vcf="$1" card="$2" n=1 cats="${BR}" + while cats="${cats}${BR}$(pdi_value "$vcf" CATEGORIES $n)"; do n=$((n + 1)); done + + list_categories |while read cat; do + printf '[li [label [input %s type="checkbox" name="%s" value="%s"] %s]]' \ + "$([ "${cats%*${BR}${cat}${BR}*}" != "$cats" ] && printf checked=checked)" \ + "$(HTML "$card")" "$(HTML "$cat")" "$(HTML "$cat")" + done +} + +cat <