removed debug marks
[confetti] / templates / edit_attendee.sh
index fe33c18..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,17 +9,30 @@ 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
 }
 
 edit_attendee() {
-  cardfile="$1"
-  tempfile="temp/$_GET[\"edit\"].vcf"
-  [ -x "$tempfile" ] && cardfile="$tempfile"
+  cardfile="vcard/$1"
+  tempfile="temp/$1"
+  [ -f "$tempfile" ] && cardfile="$tempfile"
   unset key
   vcf_parse "$cardfile" |while read -r line; do
     declare -A tag