1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-19 08:52:22 +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) {
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);

View File

@ -1,10 +1,10 @@
<?php $TRANSLATIONS = array(
"Contacts" => "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}",

View File

@ -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,
)
);