1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +01:00

Revert "a little code cleaning, removed {count} value during the import process"

This reverts commit 2a435622292e5b5c57710d890b3ce84eacbe29fe.
This commit is contained in:
babelouest 2014-03-12 14:23:42 -04:00
parent 2a43562229
commit c85b284208
3 changed files with 13 additions and 7 deletions

View File

@ -378,8 +378,8 @@ OC.Contacts = OC.Contacts || {};
.then(function(response) { .then(function(response) {
if(!response.error) { if(!response.error) {
self.$importProgress.progressbar('value', Number(response.data.progress)); self.$importProgress.progressbar('value', Number(response.data.progress));
self.$importStatusText.text(t('contacts', 'Processed {count} contacts', self.$importStatusText.text(t('contacts', 'Imported {count} of {total} contacts',
{count:response.data.progress})); {count:response.data.progress, total: self.importCount}));
} else { } else {
console.warn('Error', response.message); console.warn('Error', response.message);
self.$importStatusText.text(response.message); self.$importStatusText.text(response.message);

View File

@ -1,10 +1,10 @@
<?php $TRANSLATIONS = array( <?php $TRANSLATIONS = array(
"Contacts" => "Contacts", "Contacts" => "Contacts",
"Save" => "Sauvegarder", "Save" => "Sauvegarder",
"Uploading..." => "Téléversement en cours...", "Uploading..." => "Téléversement en cours",
"Importing..." => "Import en cours...", "Importing..." => "Import en cours",
"Preparing..." => "En préparation...", "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.", "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à", "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}", "Failed adding address book: {error}" => "Échec de l'ajout du carnet d'adresses : {error}",

View File

@ -28,8 +28,8 @@ class ImportController extends Controller {
public function upload() { public function upload() {
$request = $this->request; $request = $this->request;
$params = $this->request->urlParams; $params = $this->request->urlParams;
$addressBookId = $params['addressBookId']; $addressBookId = $params['addressBookId'];
$format = $params['importType']; $format = $params['importType'];
$response = new JSONResponse(); $response = new JSONResponse();
$view = \OCP\Files::getStorage('contacts'); $view = \OCP\Files::getStorage('contacts');
@ -81,10 +81,12 @@ class ImportController extends Controller {
\OC_FileProxy::$enabled = false; \OC_FileProxy::$enabled = false;
if($view->file_put_contents('/imports/'.$filename, $content)) { if($view->file_put_contents('/imports/'.$filename, $content)) {
\OC_FileProxy::$enabled = $proxyStatus; \OC_FileProxy::$enabled = $proxyStatus;
$count = substr_count($content, 'BEGIN:');
$progresskey = 'contacts-import-' . rand(); $progresskey = 'contacts-import-' . rand();
$response->setParams( $response->setParams(
array( array(
'filename'=>$filename, 'filename'=>$filename,
'count' => $count,
'progresskey' => $progresskey, 'progresskey' => $progresskey,
'backend' => $params['backend'], 'backend' => $params['backend'],
'addressBookId' => $params['addressBookId'] 'addressBookId' => $params['addressBookId']
@ -126,10 +128,12 @@ class ImportController extends Controller {
//$content = file_get_contents('oc://' . $path . '/' . $filename); //$content = file_get_contents('oc://' . $path . '/' . $filename);
if($view->file_put_contents('/imports/' . $filename, $content)) { if($view->file_put_contents('/imports/' . $filename, $content)) {
\OC_FileProxy::$enabled = $proxyStatus; \OC_FileProxy::$enabled = $proxyStatus;
$count = substr_count($content, 'BEGIN:');
$progresskey = 'contacts-import-' . rand(); $progresskey = 'contacts-import-' . rand();
$response->setParams( $response->setParams(
array( array(
'filename'=>$filename, 'filename'=>$filename,
'count' => $count,
'progresskey' => $progresskey, 'progresskey' => $progresskey,
'backend' => $params['backend'], 'backend' => $params['backend'],
'addressBookId' => $params['addressBookId'], 'addressBookId' => $params['addressBookId'],
@ -279,6 +283,8 @@ class ImportController extends Controller {
'addressBookId' => $params['addressBookId'], 'addressBookId' => $params['addressBookId'],
'importType' => $params['importType'], 'importType' => $params['importType'],
'imported' => $imported, 'imported' => $imported,
'count' => $processed,
'total' => $total,
'failed' => $failed, 'failed' => $failed,
) )
); );