X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=forms.sh;fp=forms.sh;h=0000000000000000000000000000000000000000;hp=50cb20431a15061370b879f8664d3d567a46fa6d;hb=3fdb8e7e2ed8fcf3129de33147d1dd3b4a204b21;hpb=c287482dc24988cabd48a085e6d752d12b489550 diff --git a/forms.sh b/forms.sh deleted file mode 100755 index 50cb204..0000000 --- a/forms.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -# Copyright 2018 Paul Hänsch -# -# This is the forms helper, part of CGIlite. -# -# CGIlite 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. -# -# CGIlite 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 CGIlite. If not, see . - -# ksh and zsh workaround -# set -o posix # ksh, not portable -setopt -o OCTAL_ZEROES 2>&- - -form_radio(){ - # Usage: form_radio Name Value Condition Label - # if "Condition" is the same as "Value", the button will be checked - - name="$1" - value="$2" - cond="$3" - label="$4" - id="rd_${name}_${value}" - - [ "$value" = "$cond" ] && check='checked="checked"' || check='' - - printf '' \ - "$id" "$name" "$value" "$check" "$id" "$label" -} - -form_check(){ - # Usage: form_check Name Value Condition Label - # if "Condition" is the same as "Value", the Checkbox will be checked - - name="$1" - value="$2" - cond="$3" - label="$4" - id="rd_${name}_${value}" - - [ "$value" = "$cond" ] && check='checked="checked"' || check='' - - printf '' \ - "$id" "$name" "$value" "$check" "$id" "$label" -}