From bab7cadaeae32434eb16872bd8e09449817d4f90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 5 Aug 2019 15:52:33 +0200 Subject: [PATCH] bugfixes, styling --- cards/cards.css | 22 ++++++++++++++++++---- cards/l10n.sh | 20 +++++--------------- cards/list.sh | 20 ++++++++++---------- cards/update_card.sh | 9 +++++++-- 4 files changed, 40 insertions(+), 31 deletions(-) diff --git a/cards/cards.css b/cards/cards.css index 9515e83..7d4593c 100644 --- a/cards/cards.css +++ b/cards/cards.css @@ -145,8 +145,15 @@ .card .control input.item { font-size: normal; } .card .control button.item { text-align: right;} .card .control button.item:hover{ border-color: #888;} -.card .control .item[name=newfield] { width: 85%;} -.card .control .item[value=addfield] { width: 15%;} + +.card .control .item[name=newfield] { + width: calc(100% - 2.5em); +} +.card .control .item[value=addfield] { + width: 2.5em; + border-style: solid solid solid none; + text-align: center; +} .card .control #delete + label + button, .card .control #delete { display: none; } @@ -218,8 +225,9 @@ width: 100%; max-height: 10em; } -.card .section .GENDER { display: inline-block; padding-right: .5ex;} +.card .section .GENDER { display: inline-block; padding-right: .5ex; } .card .section .BDAY { display: inline-block;} +.card .section .TEL .type { color: #444; } .card .section select { display: block; @@ -245,7 +253,13 @@ form.card .section input[type=text], form.card .section input:not([type]), form.card .section textarea, -form.card .section select {width: 100%;} +form.card .section select { + width: 100%; + margin-bottom: .25em; +} + +form.card .section select.teltype { margin-bottom: 0; } +form.card .section input.TEL { margin-bottom: .5em; } form.card .attendance { min-width: 66%; diff --git a/cards/l10n.sh b/cards/l10n.sh index 841adb4..044a6a1 100755 --- a/cards/l10n.sh +++ b/cards/l10n.sh @@ -41,16 +41,11 @@ l10n(){ BDAY) printf %s "Geburtstag";; EMAIL) printf %s "E-Mail";; TEL) printf %s "Telefon";; - phone_typeselect) printf %s "Typ";; - phone_home) printf %s "Privat";; - phone_cell) printf %s "Mobil";; - phone_work) printf %s "Büro";; - phone_fax) printf %s "Fax";; - tHOME) printf %s "Privat:";; - tWORK) printf %s "Büro:";; - tCELL) printf %s "Mobil:";; - tFAX) printf %s "Fax:";; - tVOICE) printf %s "";; + teltype) printf %s "Anschlusstyp:";; + TYPE=HOME) printf %s "Privat";; + TYPE=WORK) printf %s "Geschäftlich";; + TYPE=CELL) printf %s "Mobil";; + TYPE=FAX) printf %s "Fax";; IMPP) printf %s "Chat";; ADR) printf %s "Anschrift";; URL) printf %s "Webseite";; @@ -136,11 +131,6 @@ l10n(){ other) printf %s "⚥";; none) printf %s "⚪";; - teltype) printf %s "Anschlusstyp:";; - HOME) printf %s "Privat";; - WORK) printf %s "Geschäftlich";; - CELL) printf %s "Mobil";; - FAX) printf %s "Fax";; *) printf %s "$1";; esac diff --git a/cards/list.sh b/cards/list.sh index 834803f..ab2be50 100755 --- a/cards/list.sh +++ b/cards/list.sh @@ -62,7 +62,7 @@ card_item(){ teltype="$(pdi_attrib "$card" TEL $c TYPE)" [ "$teltype" ] \ && printf '[span .item .TEL [span .type ­%s:] %s]' \ - "$(l10n "$teltype" |HTML)" \ + "$(l10n "TYPE=$teltype" |HTML)" \ "$(pdi_value "$card" TEL $c |unescape |HTML)" \ || printf '[span .item .TEL ­%s]' \ "$(pdi_value "$card" TEL $c |unescape |HTML)" @@ -91,9 +91,10 @@ edit_item(){ [ $cnt -lt 1 ] && cnt=1 case $item in - N)if N="$(pdi_value "$card" N)"; then + N)N="$(pdi_value "$card" N)" + if [ "$N" ]; then IFS=\; read n1 n2 n3 n4 n5 <<-EOF - $(pdi_value "$card" N) + $N EOF else N="$(pdi_value "$card" FN |unescape)" @@ -153,10 +154,10 @@ edit_item(){ [option value="FAX" %s %s] ]\n' \ "$([ "$teltype" = '' ] && printf 'selected="selected"')" "$(l10n teltype)" \ - "$([ "$teltype" = 'HOME' ] && printf 'selected="selected"')" "$(l10n HOME)" \ - "$([ "$teltype" = 'WORK' ] && printf 'selected="selected"')" "$(l10n WORK)" \ - "$([ "$teltype" = 'CELL' ] && printf 'selected="selected"')" "$(l10n CELL)" \ - "$([ "$teltype" = 'FAX' ] && printf 'selected="selected"')" "$(l10n FAX)" + "$([ "$teltype" = 'HOME' ] && printf 'selected="selected"')" "$(l10n TYPE=HOME)" \ + "$([ "$teltype" = 'WORK' ] && printf 'selected="selected"')" "$(l10n TYPE=WORK)" \ + "$([ "$teltype" = 'CELL' ] && printf 'selected="selected"')" "$(l10n TYPE=CELL)" \ + "$([ "$teltype" = 'FAX' ] && printf 'selected="selected"')" "$(l10n TYPE=FAX)" printf '[input .item .%s name="%s" value="%s" placeholder="%s"]' \ "$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" "$(l10n "$item")" @@ -227,11 +228,10 @@ edit_card(){ [div .control [select .item name="newfield" [option value="" disabled="disabled" selected="selected" $(l10n edit_addfieldtext)] - $(for f in ; do + $(for f in NICKNAME EMAIL TEL IMPP ADR URL NOTE; do printf '[option value="%s" %s] ' "$f" "$(l10n "$f")" done) - ] - [button .item type="submit" name="action" value="addfield" $(l10n edit_addfield)] + ][button .item type="submit" name="action" value="addfield" $(l10n edit_addfield)] [button .item type="submit" name="action" value="update" $(l10n edit_update)] [input type="checkbox" #delete] [label .item for="delete" $(l10n edit_delete)] [button .item type="submit" name="action" value="delete"] diff --git a/cards/update_card.sh b/cards/update_card.sh index c2b9720..1975e4e 100755 --- a/cards/update_card.sh +++ b/cards/update_card.sh @@ -27,6 +27,9 @@ card="$(POST card)" cardfile="$_DATA/vcard/$card" attfile="$_DATA/mappings/attendance" +action="$(POST action)" +newfield="$(POST newfield)" + if ! tempfile=$(CHECK_SLOCK "$cardfile"); then SET_COOKIE 0 message="NO VALID FILE LOCK" REDIRECT "/cards/?o=${order}&f=${filter}&e=${card}" @@ -68,11 +71,13 @@ for field in $(POST_KEYS |grep -xE '[A-Z][A-Z0-9-]*'); do ;; esac done; done -[ "$(POST action)" = addfield ] && vcf="$(vcf_update_field "$vcf" "$(POST newfield)" $(($(pdi_count $(POST newfield)) + 1)) '')" +if [ "$action" = addfield ]; then + vcf="$(pdi_update_value "$vcf" "$newfield" $(( $(pdi_count "$vcf" "$newfield") + 1 )) '')" +fi printf '%s' "$vcf" |grep -vx '' >"$tempfile" -case "$(POST action)" in +case "$action" in addfield) REDIRECT "/cards/?o=${order}&f=${filter}&e=${card}" ;; -- 2.39.2