From c85b284208494b08af742ba3182417e8cbecb23f Mon Sep 17 00:00:00 2001 From: babelouest Date: Wed, 12 Mar 2014 14:23:42 -0400 Subject: [PATCH] Revert "a little code cleaning, removed {count} value during the import process" This reverts commit 2a435622292e5b5c57710d890b3ce84eacbe29fe. --- js/addressbooks.js | 4 ++-- l10n/fr.php | 6 +++--- lib/controller/importcontroller.php | 10 ++++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/js/addressbooks.js b/js/addressbooks.js index 63994827..a31bb8ff 100644 --- a/js/addressbooks.js +++ b/js/addressbooks.js @@ -378,8 +378,8 @@ OC.Contacts = OC.Contacts || {}; .then(function(response) { if(!response.error) { self.$importProgress.progressbar('value', Number(response.data.progress)); - self.$importStatusText.text(t('contacts', 'Processed {count} contacts', - {count:response.data.progress})); + self.$importStatusText.text(t('contacts', 'Imported {count} of {total} contacts', + {count:response.data.progress, total: self.importCount})); } else { console.warn('Error', response.message); self.$importStatusText.text(response.message); diff --git a/l10n/fr.php b/l10n/fr.php index edbb7c08..4a80a39d 100644 --- a/l10n/fr.php +++ b/l10n/fr.php @@ -1,10 +1,10 @@ "Contacts", "Save" => "Sauvegarder", -"Uploading..." => "Téléversement en cours...", -"Importing..." => "Import en cours...", +"Uploading..." => "Téléversement en cours…", +"Importing..." => "Import en cours…", "Preparing..." => "En préparation...", -"Processed {count} contacts" => "{count} contacts ont été traités", +"Imported {count} of {total} contacts" => "{count} contacts sur {total} ont été importés", "Imported {imported} contacts. {failed} failed." => "{imported} contacts importés. {failed} échoués.", "An address book called {name} already exists" => "Un carnet d'adresse appelé {name} existe déjà", "Failed adding address book: {error}" => "Échec de l'ajout du carnet d'adresses : {error}", diff --git a/lib/controller/importcontroller.php b/lib/controller/importcontroller.php index 094ac26f..7929c5a7 100644 --- a/lib/controller/importcontroller.php +++ b/lib/controller/importcontroller.php @@ -28,8 +28,8 @@ class ImportController extends Controller { public function upload() { $request = $this->request; $params = $this->request->urlParams; - $addressBookId = $params['addressBookId']; - $format = $params['importType']; + $addressBookId = $params['addressBookId']; + $format = $params['importType']; $response = new JSONResponse(); $view = \OCP\Files::getStorage('contacts'); @@ -81,10 +81,12 @@ class ImportController extends Controller { \OC_FileProxy::$enabled = false; if($view->file_put_contents('/imports/'.$filename, $content)) { \OC_FileProxy::$enabled = $proxyStatus; + $count = substr_count($content, 'BEGIN:'); $progresskey = 'contacts-import-' . rand(); $response->setParams( array( 'filename'=>$filename, + 'count' => $count, 'progresskey' => $progresskey, 'backend' => $params['backend'], 'addressBookId' => $params['addressBookId'] @@ -126,10 +128,12 @@ class ImportController extends Controller { //$content = file_get_contents('oc://' . $path . '/' . $filename); if($view->file_put_contents('/imports/' . $filename, $content)) { \OC_FileProxy::$enabled = $proxyStatus; + $count = substr_count($content, 'BEGIN:'); $progresskey = 'contacts-import-' . rand(); $response->setParams( array( 'filename'=>$filename, + 'count' => $count, 'progresskey' => $progresskey, 'backend' => $params['backend'], 'addressBookId' => $params['addressBookId'], @@ -279,6 +283,8 @@ class ImportController extends Controller { 'addressBookId' => $params['addressBookId'], 'importType' => $params['importType'], 'imported' => $imported, + 'count' => $processed, + 'total' => $total, 'failed' => $failed, ) );