+++ /dev/null
-# Copyright 2014 - 2016 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/>.
-
-setchecked() {
- printf 'checked="checked"'
-}
-setselected() {
- printf 'selected="selected"'
-}
-check_gen() {
- [ "$values[GENDER]" = "$1" ] && setselected
-}
-check_a() {
- egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && setchecked
-}
-teltype() {
- cat <<-EOF
- <select class="item phonetype" name="phonetype">
- <option value="" disabled="disabled" $([ -z "$1" ] && setselected )>$(l10n phone_typeselect)</option>
- <option value=""></option>
- <option value="HOME" $([ "$1" = HOME ] && setselected)>$(l10n phone_home)</option>
- <option value="CELL" $([ "$1" = CELL ] && setselected)>$(l10n phone_cell)</option>
- <option value="WORK" $([ "$1" = WORK ] && setselected)>$(l10n phone_work)</option>
- <option value="FAX" $([ "$1" = FAX ] && setselected)>$(l10n phone_fax )</option>
- </select>
- EOF
-}
-
-list_items(){
- item="$1"
- placeholder="$2"
- [ -n "${values[$item]+x}" ] && printf '<h3>%s</h3>\n' "$(l10n $item)"
- for n in "$item" "$item"{0..100}; do
- if [ -n "${values[$n]+x}" ]; then
- case "$item" in
- (ADR|NOTE)
- printf '<textarea class="item %s" name="%s">%s</textarea>\n' \
- "$item" "$item" "$(htmlsafe ${values[$n]})"
- ;;
- (TEL)
- teltype "${values[${n}_TYPE]}"
- printf '<input class="item %s" name="%s" value="%s" />\n' \
- "$item" "$item" "$(attribsafe ${values[$n]})"
- ;;
- (*)
- printf '<input class="item %s" name="%s" value="%s" placeholder="%s"/>\n' \
- "$item" "$item" "$(attribsafe ${values[$n]})" "$placeholder"
- ;;
- esac
- else
- break
- fi
- done
-}
-
-hi_company="${values[X-HEALTH-INSURANCE+1]}"
-hi_number= "${values[X-HEALTH-INSURANCE+2]}"
-hi_status= "${values[X-HEALTH-INSURANCE+3]}"
-
-[ -z "$values[UID]" ] && values[UID]="$(uuidgenerator)"
-
-cat <<END_HTML
-<form id="$id" class="card" action="?action=update_card" method="POST">
- <input type="hidden" name="card" value="${id}"/>
- <div class="section basic">
- <h3>$(l10n N)</h3>
- <input class="item N" name="3N" placeholder="$(l10n n_pre)" value="$values[N+3]" />
- <input class="item N" name="1N" placeholder="$(l10n n_first)" value="$values[N+1]" />
- <input class="item N" name="2N" placeholder="$(l10n n_middle)" value="$values[N+2]" />
- <input class="item N" name="0N" placeholder="$(l10n n_last)" value="$values[N+0]" />
- <input class="item N" name="4N" placeholder="$(l10n n_post)" value="$values[N+4]" />
-
- <select class="item GENDER" name="GENDER">
- <option value="" disabled="disabled">$(l10n GENDER)</option>
- <option value="female" $(check_gen female)>$(l10n gender_female)</option>
- <option value="male" $(check_gen male)>$(l10n gender_male)</option>
- <option value="other" $(check_gen other)>$(l10n gender_other)</option>
- <option value="none" $(check_gen none)>$(l10n gender_none)</option>
- </select>
-
- $(for n in NICKNAME NICKNAME{0..10}; do
- printf %s\\n "${values[$n]+<input class="item NICKNAME" name="NICKNAME" placeholder="$(l10n NICKNAME)" value="$values[$n]" />}"
- done)
-
- $(list_items BDAY YYYY-MM-DD)
-
- $(list_items X-ZACK-JOINDATE YYYY-MM-DD)
- $(list_items X-ZACK-LEAVEDATE YYYY-MM-DD)
-
- $([ -n "$values[SOUND]" ] && printf '
- <audio controls="controls" class="item SOUND">
- <source type="audio/ogg" src="data:audio/ogg;base64,%s" />
- </audio>' "$values[SOUND]"
- )
- ${values[PHOTO]+<img class="item PHOTO" src="data:image/$values[PHOTO_TYPE];base64,$values[PHOTO]" />}
- ${values[LOGO]+<img class="item LOGO" src="data:image/$values[LOGO_TYPE];base64,$values[LOGO]" />}
- </div>
-
- <div class="section address">
- $(list_items ADR)
- </div>
-
- <div class="section phone">
- $(list_items TEL)
- $(list_items EMAIL)
- $(list_items IMPP)
- $(list_items URL)
- </div>
-
- <div class="section insurance">
- <h3>$(l10n X-HEALTH-INSURANCE)</h3>
- <input type="radio" name="hi_select" value="list" id="hi_select_list" checked /><label for="hi_select_list">$(l10n hi_from_list)</label><!--
- --><input type="radio" name="hi_select" value="other" id="hi_other"><label for="hi_other">$(l10n hi_other)</label>
- <select class="item" name="hi_company">
- <option value="" disabled="disabled" ${hi_company:-selected}>$(l10n hi_company)</option>
- $(list_hi_companies |while read f; do
- [ "$f" = "$hi_company" ] \
- && printf '<option value="%s" selected>%s</option>' "$f" "$f" \
- || printf '<option value="%s">%s</option>' "$f" "$f"
- done)
- </select>
- <input type="text" name="hi_other" value="$hi_company" placeholder="$(l10n hi_company)" />
- <input name="hi_number" value="$hi_number" placeholder="$(l10n hi_number)" />
- <input name="hi_status" value="$hi_status" placeholder="$(l10n hi_status)" />
-
- </div>
-
- <div class="section note">
- $(list_items NOTE)
- $(list_items X-CLIENT-REFERRAL)
- </div>
-
- <div class="control">
- <select class="item" name="newfield">
- <option value="" disabled="disabled" selected="selected">$(l10n edit_addfieldtext)</option>
- $(for f in $SUP_FIELDS; do printf %s\\n "<option value=\"$f\">$(l10n $f)</option>"; done)
- </select
- ><button class="item" type="submit" name="action" value="addfield">$(l10n edit_addfield)</button>
- <button class="item" type="submit" name="action" value="update">$(l10n edit_update)</button>
- <input type="checkbox" id="delete"><label class="item" for="delete">$(l10n edit_delete)</label>
- <button class="item" type="submit" name="action" value="delete">$(l10n edit_delete)</button>
- <button class="item" type="submit" name="action" value="cancel">$(l10n edit_cancel)</button>
- </div>
- <input type="hidden" name="UID" value="$values[UID]"/>
-</form>
-END_HTML