]> git.plutz.net Git - confetti/commitdiff
multiple logical fixes in vcard updater
authorpaul <paul@plutz.net>
Thu, 28 Nov 2013 22:42:39 +0000 (22:42 +0000)
committerpaul <paul@plutz.net>
Thu, 28 Nov 2013 22:42:39 +0000 (22:42 +0000)
svn path=/trunk/; revision=25

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

index 6f46cb2034eaeda33c967523fcb59fde5d1126a6..ba84be8f75462627580b3f45643137269217cfb1 100644 (file)
@@ -9,6 +9,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"
+echo "UID:$_POST[\"UID\"]\r" >>"$tempfile"
 for field in $VCF_FIELDS; do
   value="$_POST[\"$field\"]"
   n=0
index 00bbd438906d0b4e87c79ea084c208346d2d556a..4a352ca89724f8d3f7226f288f4b8975db6232cb 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 &: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;
@@ -102,7 +102,7 @@ vcf_parse() {
 
     s:^([A-Z].*)$:024 \1:p;
     ' \
-  | sort |while read -r line; do
+  |sort |while read -r line; do
     case "$line" in
       00[012]*)
        echo -E "$line"
index 72824528a164d68e06db7bfbe5b0dd8d12d0c599..679a7bd249fd06644a1bcbc7ad0e2e524a0cbe75 100755 (executable)
@@ -9,6 +9,8 @@ edit_card() {
   n_pre="$(echo "$values[N]" |sed -rn 's:^([^;]*;){3} *([^;]*).*$:\2:p')"
   n_post="$(echo "$values[N]" |sed -rn 's:^([^;]*;){4} *([^;]*)*$:\2:p')"
 
+  [ -z "$values[UID]" ] && values[UID]="$(dbus-uuidgen)"
+
   echo '  <div class="section basic">'
   echo '    <span class="sectitle">'$(l10n N)'</span>'
   echo '    <input class="item N" name="3N" placeholder="'$(l10n n_pre)'" value="'$n_pre'" />'
@@ -90,6 +92,7 @@ edit_card() {
   echo '    <button class="item control" type="submit" name="action" value="update">'$(l10n edit_update)'</button>'
   echo '    <button class="item control" type="submit" name="action" value="cancel">'$(l10n edit_cancel)'</button>'
   echo '  </div>'
+  echo '<input type="hidden" name="UID" value="'$values[UID]'"/>'
 }
 
 edit_attendee() {  #Parameter: Cardfile
@@ -108,7 +111,7 @@ edit_attendee() {  #Parameter: Cardfile
         if [ -z "$key" ]; then
           eval "$line"
         else
-          values[$key]="$value"
+         [ -n "$value" ] && values[$key]="$value" || values[$key]='\r'
           for t in ${(k)tag}; do
             tags[${key}_$t]="$tag[$t]"
           done