From 73b09eb59bd1d77580980478fff8f581f89b9fc5 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 2 May 2016 22:10:55 +0200 Subject: [PATCH] =?UTF-8?q?Export=20des=20donn=C3=A9es=20locales=20r=C3=A9?= =?UTF-8?q?ussi=20full-js=20()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/input.php | 1 + view/js/input-min.js | 11 ++++++----- view/js/input.js | 8 ++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/view/input.php b/view/input.php index 8f6d076..0ef8375 100755 --- a/view/input.php +++ b/view/input.php @@ -39,6 +39,7 @@

Effacer les données de la dernière enquête

+

diff --git a/view/js/input-min.js b/view/js/input-min.js index 524c5f4..29ba565 100644 --- a/view/js/input-min.js +++ b/view/js/input-min.js @@ -1,10 +1,11 @@ var clearAllButton=$("#clear-all"),submitAllButton=$("#submit-all"),importCallLog=$('input#call_log-import[type="file"]'),subjectManager,contactManager,miniManager,ficheManager; -function dynamicUpdate(a){var c=a instanceof Element,b=c&&"SPAN"==a.tagName&&"switch-left"==a.className,d=c&&"SPAN"==a.tagName&&"switch-both"==a.className,e=c&&"INPUT"==a.tagName&&"submit"==a.type,f=c&&"SPAN"==a.tagName&&("nav-mini"==a.parentNode.id||"nav-fiche"==a.parentNode.id),c=c&&"SPAN"==a.tagName&&"nav-contact"==a.parentNode.id;if(!(d||b||e||f||c)&&!0!==a)return!1;if(d)console.log("> switch firstname <-> lastname"),b=a.parentNode,a=b.children[3],b=b.children[5],d=a.value,a.value=b.value,b.value= -d;else if(b){console.log("> switch firstname+lastname -> username");b=a.parentNode;d=b.children[1];a=b.children[3];b=b.children[5];if(0 dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),miniManager.sync(),ficheManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(),(e||c)&&contactManager.storageToFields()} -function checkRadioValue(a){for(var c=0,b=0;b switch firstname <-> lastname"),c=a.parentNode,a=c.children[3],c=c.children[5],e=a.value,a.value=c.value,c.value= +e;else if(c){console.log("> switch firstname+lastname -> username");c=a.parentNode;e=c.children[1];a=c.children[3];c=c.children[5];if(0 dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),miniManager.sync(),ficheManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(),(d||b)&&contactManager.storageToFields()} +function checkRadioValue(a){for(var b=0,c=0;c GATHERING ALL DATA");subjectManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.fieldsToStorage();ficheManager.fieldsToStorage();a={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"), fiches:lsi["export"]("fiches")};api.send(a,function(a){console.log(a)},!1)},!1)})})})}); diff --git a/view/js/input.js b/view/js/input.js index b5cd3f2..787d4f6 100644 --- a/view/js/input.js +++ b/view/js/input.js @@ -291,9 +291,13 @@ include('/js/includes/input-phone-fiche.js', function(){ }; /* (2) On lance le téléchargement */ - console.log(JSON.stringify(data)); + var downloadTarget = $('#download-target'); + downloadTarget.download = 'local-data.json'; + downloadTarget.href = 'data:application/octet-stream,charset:utf-8,'+encodeURIComponent(JSON.stringify(data)); + downloadTarget.click(); + + - // TODO: Gestion du download du fichier avec les données souhaitées }, false);