From e308373633b80056507ee9cedc5c9b7fc3a00dca Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 6 Nov 2013 02:34:31 +0000 Subject: [PATCH] basic editing functions svn path=/trunk/; revision=15 --- templates/attendees.html.sh | 11 +++++++++-- templates/view_attendee.sh | 39 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/templates/attendees.html.sh b/templates/attendees.html.sh index c481c61..a4e6b52 100644 --- a/templates/attendees.html.sh +++ b/templates/attendees.html.sh @@ -35,8 +35,15 @@ cat < $(listcards |while read card; do - echo '
' - view_attendee "$card" + id="vcf_$card" + echo '
' + if [ "$_GET[\"edit\"]" = "$id" ]; then + debug "Edit: $card" + edit_attendee "$card" + else + echo '

Bearbeiten

' + view_attendee "$card" + fi echo '
' done)
diff --git a/templates/view_attendee.sh b/templates/view_attendee.sh index 1e02e3d..01fb3f0 100755 --- a/templates/view_attendee.sh +++ b/templates/view_attendee.sh @@ -73,6 +73,23 @@ view_card_item() { esac } +edit_card_item() { + case "$key" in + BEGIN|VERSION|END);; + PHOTO) + echo "" + ;; + *) + echo -n "$(l10n "$key")" + [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])" + echo ":" + ;| + *) + echo "" + ;; + esac +} + view_attendee() { #Parameter: Cardfile cardfile="$1" cachefile="cache/vcf_$(basename "$cardfile").cache" @@ -96,3 +113,25 @@ view_attendee() { #Parameter: Cardfile esac done |tee "$cachefile" } + +edit_attendee() { + cardfile="$1" + unset key + 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 + edit_card_item + eval "$line" + unset value + unset tag + fi + ;; + esac + done +} -- 2.39.2