allowed editing of full name
authorpaul <paul@plutz.net>
Wed, 27 Nov 2013 21:07:54 +0000 (21:07 +0000)
committerpaul <paul@plutz.net>
Wed, 27 Nov 2013 21:07:54 +0000 (21:07 +0000)
svn path=/trunk/; revision=20

actions/update_attendee.sh
pages/attendees.sh
templates/edit_attendee.sh
templates/text_attendee.sh
templates/view_attendee.sh

index 10eb82c..6f46cb2 100644 (file)
@@ -8,6 +8,7 @@ cardfile="vcard/$card"
 
 echo "BEGIN:VCARD\r" >"$tempfile"
 echo "VERSION:4.0\r" >>"$tempfile"
+echo "N:$_POST[\"0N\"];$_POST[\"1N\"];$_POST[\"2N\"];$_POST[\"3N\"];$_POST[\"4N\"]\r" >>"$tempfile"
 for field in $VCF_FIELDS; do
   value="$_POST[\"$field\"]"
   n=0
index 9ea073e..aecc95d 100755 (executable)
@@ -35,8 +35,8 @@ vcf_parse() {
     s:^X-MS-CARDPICTURE:001 PHOTO:p;
     s:^LOGO:002 LOGO:p;
     s:^FN:003 FN:p;
-    s:^N:004 N:p
     s:^NICKNAME:005 NICKNAME:p;
+    s:^N:004 N:p
     s:^SOUND:006 SOUND:p;
     s:^GENDER:007 GENDER:p;
     s:^X-GENDER:007 GENDER:p;
@@ -116,16 +116,19 @@ vcf_parse() {
          |sed -r 's:,: :;s:\;: :g;s: +: :g' \
          |tr -d '\r'
        )
+       echo -E "$line"
        ;;
       005*)
        nick=$(echo -E "$line" |sed -r 's:^[0-9]{3} ([^;\:]+)(;[^"\:]+|;"[^"]+")*\:(.*)$:\3:g' |tr -d '\r')
+       echo -E "$line"
        ;;
-      *) [ -n "$n" ] && fn="$n"
-        [ -n "$fn" -a -n "$nick" ] && fn="$fn aka. $nick"
-        [ -n "$fn" ] && echo -E "003 FN:$fn" \
+      *)
+        [ -n "$n" ] && fn="$n"
+       [ -n "$fn" -a -n "$nick" ] && fn="$fn aka. $nick"
+       [ -n "$fn" ] && echo -E "003 FN:$fn" \
                      || echo -E "003 FN:$nick"
-        echo -E "$line"
-        cat
+       echo -E "$line"
+       cat
        ;;
     esac
   done |tr -d '\r' \
index d79553f..cb0b5b1 100755 (executable)
@@ -1,6 +1,6 @@
 edit_card_item() {
   case "$key" in
-    BEGIN|VERSION|END);;
+    BEGIN|VERSION|END|FN);;
     PHOTO)
       echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
       ;;
@@ -9,8 +9,21 @@ edit_card_item() {
       [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
       echo ":</span>"
       ;|
+    N)
+      n_last="$(echo "$value" |sed -r 's:^([^;]*;){0} *([^;]*);.*$:\2:')"
+      n_first="$(echo "$value" |sed -r 's:^([^;]*;){1} *([^;]*);.*$:\2:')"
+      n_middle="$(echo "$value" |sed -r 's:^([^;]*;){2} *([^;]*);.*$:\2:')"
+      n_pre="$(echo "$value" |sed -r 's:^([^;]*;){3} *([^;]*);.*$:\2:')"
+      n_post="$(echo "$value" |sed -r 's:^([^;]*;){4} *([^;]*);*$:\2:')"
+      echo "<input class=\"VALUE\" name=\"3$key\" value=\"$n_pre\" placeholder=\"$(l10n n_pre)\" />"
+      echo "<input class=\"VALUE\" name=\"1$key\" value=\"$n_first\" placeholder=\"$(l10n n_first)\" />"
+      echo "<input class=\"VALUE\" name=\"2$key\" value=\"$n_middle\" placeholder=\"$(l10n n_middle)\" />"
+      echo "<input class=\"VALUE\" name=\"0$key\" value=\"$n_last\" placeholder=\"$(l10n n_last)\" />"
+      echo "<input class=\"VALUE\" name=\"4$key\" value=\"$n_post\" placeholder=\"$(l10n n_post)\" /></span>"
+      echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
+      ;;
     *)
-      echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></item>"
+      echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></span>"
       echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
       ;;
   esac
@@ -20,9 +33,8 @@ edit_attendee() {
   cardfile="vcard/$1"
   tempfile="temp/$1"
   [ -f "$tempfile" ] && cardfile="$tempfile"
-  debug Using card: $cardfile
   unset key
-  vcf_parse "$cardfile" |debug |while read -r line; do
+  vcf_parse "$cardfile" |while read -r line; do
     declare -A tag
     case "$line" in
       value*) eval "$line";;
index 6a90192..509fb47 100755 (executable)
@@ -3,6 +3,12 @@ declare -A item_name
 item_name[PHOTO]="Foto"
 item_name[LOGO]="Logo"
 item_name[FN]="Voller Name"
+item_name[N]="Name"
+item_name[n_pre]="Titel"
+item_name[n_first]="Vorname"
+item_name[n_middle]="Mittelnamen"
+item_name[n_last]="Nachname"
+item_name[n_post]="Zus├Ątze"
 item_name[NICKNAME]="Spitzname"
 item_name[SOUND]="Aussprache"
 item_name[GENDER]="Geschlecht"
index 86dad68..a96444a 100755 (executable)
@@ -1,6 +1,6 @@
 view_card_item() {
   case "$key" in
-    BEGIN|VERSION|END);;
+    BEGIN|VERSION|END|N|NICKNAME);;
     PHOTO)
       echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
       ;;
@@ -13,20 +13,20 @@ view_card_item() {
       echo ":</span>"
       ;|
     EMAIL)
-      echo "<a href=\"mailto:$value\" class=\"VALUE $key\">$value</a></item>"
+      echo "<a href=\"mailto:$value\" class=\"VALUE $key\">$value</a></span>"
       ;;
     IMPP)
-      echo "<a href=\"$value\" class=\"VALUE $key\">"$(echo "$value" |cut -d: -f2-)"</a></item>"
+      echo "<a href=\"$value\" class=\"VALUE $key\">"$(echo "$value" |cut -d: -f2-)"</a></span>"
       ;;
     *)
-      echo "<span class=\"VALUE $key\">$value</span></item>"
+      echo "<span class=\"VALUE $key\">$value</span></span>"
       ;;
   esac
 }
 
 view_attendee() {  #Parameter: Cardfile
   cardfile="vcard/$1"
-  cachefile="cache/vcf_$(basename "$cardfile").cache"
+  cachefile="cache/${1}.cache"
   unset key
   [ "$cachefile" -nt "$cardfile" ] && cat "$cachefile" \
   || vcf_parse "$cardfile" |while read -r line; do