From: paul Date: Thu, 28 Nov 2013 03:50:44 +0000 (+0000) Subject: improved visual style X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=7f927856071799039923e9e1f00652819792987a;p=confetti improved visual style svn path=/trunk/; revision=22 --- diff --git a/export.sh b/export.sh new file mode 100755 index 0000000..aa8570a --- /dev/null +++ b/export.sh @@ -0,0 +1,9 @@ +#!/bin/zsh + +case "$_GET[\"export\"]" in + vcard) + echo -n "Content-Type: text/vcard;charset=utf-8\n\n" + card="$_GET[\"card\"]" + cat "$_DATA/vcard/$card" + ;; +esac diff --git a/index.cgi b/index.cgi index 6bd36d5..a7edbb1 100755 --- a/index.cgi +++ b/index.cgi @@ -46,4 +46,10 @@ cgi_get . "$_EXEC/constants.sh" -[ -n "$_GET[\"action\"]" ] && . "$_EXEC/action.sh" || . "$_EXEC/page.sh" +if [ -n "$_GET[\"action\"]" ]; then + . "$_EXEC/action.sh" +elif [ -n "$_GET[\"export\"]" ]; then + . "$_EXEC/export.sh" +else + . "$_EXEC/page.sh" +fi diff --git a/pages/attendees.sh b/pages/attendees.sh index aecc95d..00bbd43 100755 --- a/pages/attendees.sh +++ b/pages/attendees.sh @@ -124,7 +124,7 @@ vcf_parse() { ;; *) [ -n "$n" ] && fn="$n" - [ -n "$fn" -a -n "$nick" ] && fn="$fn aka. $nick" + #[ -n "$fn" -a -n "$nick" ] && fn="$fn aka. $nick" [ -n "$fn" ] && echo -E "003 FN:$fn" \ || echo -E "003 FN:$nick" echo -E "$line" diff --git a/templates/attendees.css.sh b/templates/attendees.css.sh index c024559..126a952 100644 --- a/templates/attendees.css.sh +++ b/templates/attendees.css.sh @@ -6,48 +6,63 @@ cat < -

$(l10n edit)

$(view_attendee "$id") x_EOF diff --git a/templates/text_attendee.sh b/templates/text_attendee.sh index 509fb47..1942b9f 100755 --- a/templates/text_attendee.sh +++ b/templates/text_attendee.sh @@ -51,6 +51,8 @@ item_name[VERSION]="" item_name[XML]="" item_name[edit]="Bearbeiten" +item_name[vcf_export]="Vcard Exportieren" +item_name[control]="Aktionen" item_name[edit_update]="Daten Übernehmen" item_name[edit_cancel]="Abbrechen" item_name[edit_addfieldtext]="Feld hinzufügen" diff --git a/templates/view_attendee.sh b/templates/view_attendee.sh index a96444a..c8a80fb 100755 --- a/templates/view_attendee.sh +++ b/templates/view_attendee.sh @@ -1,49 +1,103 @@ -view_card_item() { - case "$key" in - BEGIN|VERSION|END|N|NICKNAME);; - PHOTO) - echo "" - ;; - FN) - echo "

$value

" - ;; - *) - echo -n "$(l10n "$key")" - [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])" - echo ":" - ;| - EMAIL) - echo "$value" - ;; - IMPP) - echo ""$(echo "$value" |cut -d: -f2-)"" - ;; - *) - echo "$value" - ;; - esac +print_card() { + echo '
' + echo ' '$values[FN]'' + [ -n "$value[GENDER]" ] && \ + echo ' '$(l10n $values[GENDER])'' + for n in NICKNAME NICKNAME{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' aka. '$values[$n]'' + done + [ -n "$values[BDAY]" ] &&\ + echo ' *: '$values[BDAY]'' + if [ -n "$values[SOUND]" ]; then + echo ' ' + fi + [ -n "$values[PHOTO]" ] &&\ + echo ' ' + [ -n "$values[LOGO]" ] &&\ + echo ' ' + echo '
' + echo '' + echo '
' + echo ' '$(l10n TEL)'' + for n in TEL TEL{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$tags[${n}_TYPE]' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' '$(l10n EMAIL)'' + for n in EMAIL EMAIL{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' ' + done + [ -n "$values[IMPP]" ] && \ + echo ' '$(l10n IMPP)'' + for n in IMPP IMPP{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$tags[${n}_TYPE]' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' '$(l10n ADR)'' + for n in ADR ADR{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$values[$n]'' + done + [ -n "$values[URL]" ] && \ + echo ' '$(l10n URL)'' + for n in URL URL{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' '$(l10n NOTE)'' + for n in NOTE NOTE{0..10}; do [ -n "$values[$n]" ] &&\ + echo ' '$values[$n]'' + done + echo '
' + echo '' + echo '
' + echo ' '$(l10n edit)'' + echo ' '$(l10n vcf_export)'' + echo '
' } view_attendee() { #Parameter: Cardfile - cardfile="vcard/$1" - cachefile="cache/${1}.cache" + id="$1" + cardfile="vcard/$id" + cachefile="cache/${id}.cache" unset key - [ "$cachefile" -nt "$cardfile" ] && cat "$cachefile" \ - || vcf_parse "$cardfile" |while read -r line; do - declare -A tag - case "$line" in - value*) eval "$line";; - tag*) eval "$line";; - key*) - if [ -z "$key" ]; then - eval "$line" - else - view_card_item - eval "$line" - unset value - unset tag - fi - ;; - esac - done |tee "$cachefile" + if [ "$cachefile" -nt "$cardfile" ]; then + cat "$cachefile" + else + declare -A tags + declare -A values + vcf_parse "$cardfile" |while read -r line; do + declare -A tag + case "$line" in + value*) eval "$line";; + tag*) eval "$line";; + key*) + if [ -z "$key" ]; then + eval "$line" + else + values[$key]="$value" + for t in ${(k)tag}; do + tags[${key}_$t]="$tag[$t]" + done + eval "$line" + if [ -n "$values[$key]" ]; then + n=0 + while [ -n "$values[$key$n]" ]; do n=$(($n + 1)); done + key=$key$n + fi + unset value + unset tag + fi + ;; + esac + done + print_card |tee "$cachefile" + fi }