From a3b9e4e65d7b5cd36cfed154d4ec06a3177c642f Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 27 Feb 2011 13:51:46 +0000 Subject: Better display of vcard import results (#1485457) --- CHANGELOG | 2 ++ program/localization/de_CH/messages.inc | 3 ++- program/localization/en_US/messages.inc | 3 ++- program/steps/addressbook/import.inc | 28 ++++++++++++++++++++++------ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e2d27b9ff..a108991ad 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ CHANGELOG Roundcube Webmail =========================== +- Better display of vcard import results (#1485457) +- Improved vcard import - Interactive update script with improved DB schema check - jQuery 1.5.1 - Fix problem with contactgroupmembers table creation on MySQL 4.x, add index on contact_id column diff --git a/program/localization/de_CH/messages.inc b/program/localization/de_CH/messages.inc index fe61a791a..3b4f75c42 100644 --- a/program/localization/de_CH/messages.inc +++ b/program/localization/de_CH/messages.inc @@ -107,7 +107,8 @@ $messages['contactaddedtogroup'] = 'Kontakte wurden dieser Gruppe hinzugefügt'; $messages['contactremovedfromgroup'] = 'Kontakte wurden aus dieser Gruppe entfernt'; $messages['importwait'] = 'Daten werden importiert, bitte warten...'; $messages['importerror'] = 'Import fehlgeschlagen! Die hochgeladene Datei ist nicht im vCard-Format.'; -$messages['importconfirm'] = 'Es wurden $inserted Adressen erfolgreich importiert und $skipped bestehende Einträge übersprungen:

$names

'; +$messages['importconfirm'] = 'Es wurden $inserted Adressen erfolgreich importiert'; +$messages['importconfirmskipped'] = '$skipped bestehende Einträge wurden übersprungen'; $messages['opnotpermitted'] = 'Operation nicht erlaubt!'; $messages['nofromaddress'] = 'Fehlende E-Mail-Adresse in ausgewählter Identität'; $messages['editorwarning'] = 'Beim Wechseln in den Texteditor gehen alle Textformatierungen verloren. Möchten Sie fortfahren?'; diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index df347d1db..d787f831d 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -107,7 +107,8 @@ $messages['contactaddedtogroup'] = 'Successfully added the contacts to this grou $messages['contactremovedfromgroup'] = 'Successfully removed contacts from this group'; $messages['importwait'] = 'Importing, please wait...'; $messages['importerror'] = 'Import failed! The uploaded file is not a valid vCard file.'; -$messages['importconfirm'] = 'Successfully imported $inserted contacts, $skipped existing entries skipped:

$names

'; +$messages['importconfirm'] = 'Successfully imported $inserted contacts'; +$messages['importconfirmskipped'] = 'Skipped $skipped existing entries'; $messages['opnotpermitted'] = 'Operation not permitted!'; $messages['nofromaddress'] = 'Missing e-mail address in selected identity'; $messages['editorwarning'] = 'Switching to the plain text editor will cause all text formatting to be lost. Do you wish to continue?'; diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc index 7300e3370..e20fbe082 100644 --- a/program/steps/addressbook/import.inc +++ b/program/steps/addressbook/import.inc @@ -62,13 +62,27 @@ function rcmail_import_confirm($attrib) 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 @@ if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name' 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 ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name' } if ($existing->count) { $IMPORT_STATS->skipped++; + $IMPORT_STATS->skipped_names[] = $vcard->displayname; continue; } } -- cgit v1.2.3