+++ /dev/null
-#!/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 <http://www.gnu.org/licenses/>.
-
-. $_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 <<EOF |yield_page categories
-[form .categories action="edit_categories.sh" method="POST"
- [h1 $(l10n categories_label)]
- [input type="hidden" name="page" value="categories"]
- [ul
- $(list_categories | while read cat; do
- printf '[li . %s [button type="submit" name="remove" value="%s" . %s]]\n' \
- "$(HTML "$cat")" "$(HTML "$cat")" "$(l10n cat_remove)"
- done)
- [li
- [input type="text" name="newcat" placeholder="$(l10n cat_newlabel)"]
- [button type="submit" name="add" value="add" . $(l10n cat_add)]
- ]
- ]
-]
-
-[form .namelist action="update_categories.sh" method="POST"
- [fieldset
- [button type="submit" name="submit" value="submit" . $(l10n cat_update)]
- ]
- [ul .namelist
- $(for vcffile in "$_DATA"/vcard/*vcf; do
- vcf="$(pdi_load "$vcffile")"
- printf ' [li [h2 . %s][ul ' "$(pdi_value "$vcf" FN)"
- list_catsel "$vcf" "${vcffile##*/}"
- printf ']]\n'
- done |sort)
- ]
- [fieldset
- [button type="submit" name="submit" value="submit" . $(l10n cat_update)]
- ]
-]
-EOF