From a3b9e4e65d7b5cd36cfed154d4ec06a3177c642f Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 27 Feb 2011 08:51:46 -0500
Subject: [PATCH] Better display of vcard import results (#1485457)

---
 program/steps/addressbook/import.inc |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index 7300e33..e20fbe0 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -62,13 +62,27 @@
   global $IMPORT_STATS;
   
   $vars = get_object_vars($IMPORT_STATS);
-  $vars['names'] = join(', ', array_map('Q', $IMPORT_STATS->names));
+  $vars['names'] = $vars['skipped_names'] = '';
   
-  return html::p($attrib, Q(rcube_label(array(
-    'name' => 'importconfirm',
-    'nr' => $IMORT_STATS->inserted,
-    'vars' => $vars,
-  )), 'show'));
+  $content = html::p(null, rcube_label(array(
+      'name' => 'importconfirm',
+      'nr' => $IMORT_STATS->inserted,
+      'vars' => $vars,
+    )) . ($IMPORT_STATS->names ? ':' : '.'));
+    
+  if ($IMPORT_STATS->names)
+    $content .= html::p('em', join(', ', array_map('Q', $IMPORT_STATS->names)));
+  
+  if ($IMPORT_STATS->skipped) {
+      $content .= html::p(null, rcube_label(array(
+          'name' => 'importconfirmskipped',
+          'nr' => $IMORT_STATS->skipped,
+          'vars' => $vars,
+        )) . ':');
+      $content .= html::p('em', join(', ', array_map('Q', $IMPORT_STATS->skipped_names)));
+  }
+  
+  return html::div($attrib, $content);
 }
 
 
@@ -120,6 +134,7 @@
   else {
     $IMPORT_STATS = new stdClass;
     $IMPORT_STATS->names = array();
+    $IMPORT_STATS->skipped_names = array();
     $IMPORT_STATS->count = count($vcards);
     $IMPORT_STATS->inserted = $IMPORT_STATS->skipped = $IMPORT_STATS->nomail = $IMPORT_STATS->errors = 0;
     
@@ -146,6 +161,7 @@
         }
         if ($existing->count) {
           $IMPORT_STATS->skipped++;
+          $IMPORT_STATS->skipped_names[] = $vcard->displayname;
           continue;
         }
       }

--
Gitblit v1.9.1