From: paul Date: Wed, 6 Nov 2013 12:21:02 +0000 (+0000) Subject: separeted text view and edit section X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=15f8fb79643d8e76e836b673ea339cb805b3e3fc;p=confetti separeted text view and edit section svn path=/trunk/; revision=16 --- diff --git a/templates/attendees.html.sh b/templates/attendees.html.sh index a4e6b52..c97bc46 100644 --- a/templates/attendees.html.sh +++ b/templates/attendees.html.sh @@ -1,4 +1,6 @@ +. ${_EXEC}/templates/text_attendee.sh . ${_EXEC}/templates/view_attendee.sh +. ${_EXEC}/templates/edit_attendee.sh check(){ [ "$_GET[\"filtertype\"]" = "$1" ] && echo 'checked="checked"' @@ -11,15 +13,15 @@ cat <Filter:
- Alles - Name - Straße - PLZ. - Telefon - Geburtsjahr - Kurs
- - + $(l10n filter_all) + $(l10n filter_name) + $(l10n filter_street) + $(l10n filter_zip) + $(l10n filter_phone) + $(l10n filter_birthyear) + $(l10n filter_course)
+ + @@ -34,18 +36,28 @@ cat <
- $(listcards |while read card; do - id="vcf_$card" - echo '
' - if [ "$_GET[\"edit\"]" = "$id" ]; then - debug "Edit: $card" - edit_attendee "$card" - else - echo '

Bearbeiten

' - view_attendee "$card" - fi - echo '
' - done) +$(listcards |while read card; do + id="vcf_$card" + if [ "$_GET[\"edit\"]" = "$id" ]; then cat < +
+ + + $(edit_attendee "$card") +
+
+
+
+x_EOF + debug "Edit: $card" + else cat < +

$(l10n edit)

+ $(view_attendee "$card") + +x_EOF + fi +done) EOF diff --git a/templates/edit_attendee.sh b/templates/edit_attendee.sh new file mode 100755 index 0000000..f2acb9f --- /dev/null +++ b/templates/edit_attendee.sh @@ -0,0 +1,38 @@ +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 +} + +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 +} diff --git a/templates/text_attendee.sh b/templates/text_attendee.sh new file mode 100755 index 0000000..6ce0466 --- /dev/null +++ b/templates/text_attendee.sh @@ -0,0 +1,59 @@ +declare -A item_name + +item_name[PHOTO]="Foto" +item_name[LOGO]="Logo" +item_name[FN]="Voller Name" +item_name[SOUND]="Aussprache" +item_name[GENDER]="Geschlecht" +item_name[KIND]="Typ" +item_name[TITLE]="Beruf" +item_name[ROLE]="Position" +item_name[ORG]="Organisation" +item_name[MEMBER]="Mitglied" +item_name[CATEGORIES]="Kategorien" +item_name[ANNIVERSARY]="Jubiläum" +item_name[BDAY]="Geburtstag" +item_name[EMAIL]="E-Mail" +item_name[TEL]="Telefon" +item_name[IMPP]="Chat" +item_name[ADR]="Anschrift" +item_name[URL]="Webseite" +item_name[LANG]="Sprache" +item_name[NOTE]="Notiz" + +item_name[RELATED]="Kontakte" + +item_name[BEGIN]="" +item_name[CALADRURI]="" +item_name[CALURI]="" +item_name[CLASS]="" +item_name[CLIENTPIDMAP]="" +item_name[END]="" +item_name[FBURL]="" +item_name[GEO]="" +item_name[MAILER]="" +item_name[NAME]="" +item_name[PRODID]="" +item_name[PROFILE]="" +item_name[REV]="" +item_name[SORT-STRING]="" +item_name[SOURCE]="" +item_name[TZ]="" +item_name[UID]="" +item_name[VERSION]="" +item_name[XML]="" + +item_name[edit]="Bearbeiten" +item_name[filter_all]="Alles" +item_name[filter_name]="Name" +item_name[filter_street]="Straße" +item_name[filter_zip]="PLZ." +item_name[filter_phone]="Telefon" +item_name[filter_birthyear]="Geburtsjahr" +item_name[filter_course]="Kurs" +item_name[filter_apply]="Filtern" +item_name[filter_cancel]="Filter löschen" + +l10n() { + [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" +} diff --git a/templates/view_attendee.sh b/templates/view_attendee.sh index 01fb3f0..5b7c772 100755 --- a/templates/view_attendee.sh +++ b/templates/view_attendee.sh @@ -1,52 +1,3 @@ -declare -A item_name - -item_name[PHOTO]="Foto" -item_name[LOGO]="Logo" -item_name[FN]="Voller Name" -item_name[SOUND]="Aussprache" -item_name[GENDER]="Geschlecht" -item_name[KIND]="Typ" -item_name[TITLE]="Beruf" -item_name[ROLE]="Position" -item_name[ORG]="Organisation" -item_name[MEMBER]="Mitglied" -item_name[CATEGORIES]="Kategorien" -item_name[ANNIVERSARY]="Jubiläum" -item_name[BDAY]="Geburtstag" -item_name[EMAIL]="E-Mail" -item_name[TEL]="Telefon" -item_name[IMPP]="Chat" -item_name[ADR]="Anschrift" -item_name[URL]="Webseite" -item_name[LANG]="Sprache" -item_name[NOTE]="Notiz" - -item_name[RELATED]="Kontakte" - -item_name[BEGIN]="" -item_name[CALADRURI]="" -item_name[CALURI]="" -item_name[CLASS]="" -item_name[CLIENTPIDMAP]="" -item_name[END]="" -item_name[FBURL]="" -item_name[GEO]="" -item_name[MAILER]="" -item_name[NAME]="" -item_name[PRODID]="" -item_name[PROFILE]="" -item_name[REV]="" -item_name[SORT-STRING]="" -item_name[SOURCE]="" -item_name[TZ]="" -item_name[UID]="" -item_name[VERSION]="" -item_name[XML]="" - -l10n() { - [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" -} - view_card_item() { case "$key" in BEGIN|VERSION|END);; @@ -73,23 +24,6 @@ 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" @@ -113,25 +47,3 @@ 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 -}