From 8821997b6ba81c9172358e20186c15899f903a32 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 12 May 2016 16:11:07 +0200 Subject: [PATCH] =?UTF-8?q?Modification=20de=20`call=5Flog/unserialize`=20?= =?UTF-8?q?et=20`input.js`=20pour=20coller=20avec=20le=20fichier=20de=20so?= =?UTF-8?q?rtie=20+=20optimisation=20des=20donn=C3=A9es.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- automate.php | 134 +- config/dispatcher-tree.json | 4 +- config/upload-auth.json | 3 +- doc/phone_log.json | 3 +- doc/phone_log_dict.json | 2 +- manager/module/call_log.php | 137 +- src/upload/call_log/xdrm.xml | 12678 +++++++++++++++++++-- src/upload/phone_storage/dictionary.json | 54 + view/js/input-min.js | 25 +- view/js/input.js | 106 +- 10 files changed, 12102 insertions(+), 1044 deletions(-) create mode 100644 src/upload/phone_storage/dictionary.json diff --git a/automate.php b/automate.php index 2eb5963..b664b2f 100755 --- a/automate.php +++ b/automate.php @@ -83,92 +83,100 @@ // // } - $phone_log = json_decode( file_get_contents('doc/phone_log.json'), true ); - $dict = json_decode( file_get_contents('doc/phone_log_dict.json'), true ); + function uploadZippedPhoneData(){ + $phone_log = json_decode( file_get_contents('doc/phone_log.json'), true ); + $dict = json_decode( file_get_contents('doc/phone_log_dict.json'), true ); - // Contiendra le résultat - $output = array( 'call_log' => '', 'contacts' => '' ); + // Contiendra le résultat + $output = array( 'call_log' => '', 'contacts' => '' ); - /* [1] Journal d'appel - =========================================================*/ - foreach($phone_log['call_log'] as $i=>$log){ + /* [1] Journal d'appel + =========================================================*/ + foreach($phone_log['call_log'] as $i=>$log){ - /* (1) Colonnes */ - $logid = 0; - if( $i == 0 ) + /* (1) Colonnes */ + $logid = 0; + if( $i == 0 ) + foreach($log as $key=>$val){ + $output['call_log'] .= ($logid$val){ - $output['call_log'] .= ($logid$val){ - - if( isset($dict['call_log'][$key][$val]) ) - $output['call_log'] .= '"'.$dict['call_log'][$key][$val].'"'; - else - $output['call_log'] .= '"'.$val.'"'; - - // Si pas dernier, on met une virgule, sinon retour à la ligne - $output['call_log'] .= ($logid$log){ - /* [2] Contacts - =========================================================*/ - foreach($phone_log['contacts'] as $i=>$log){ + /* (1) Colonnes */ + $logid = 0; + if( $i == 0 ) + foreach($log as $key=>$val){ + $output['contacts'] .= ($logid$val){ - $output['contacts'] .= ($logid$val){ - - if( isset($dict['contacts'][$key][$val]) ) - $output['contacts'] .= '"'.$dict['contacts'][$key][$val].'"'; - else - $output['contacts'] .= '"'.$val.'"'; - - // Si pas dernier, on met une virgule, sinon retour à la ligne - $output['contacts'] .= ($logidopen($fname, ZipArchive::CREATE); + + foreach($output as $name=>$content) + $zip->addFromString($name.'.csv', $content); + + $zip->close(); + + /* [4] On lance le téléchargement + =========================================================*/ + header("Content-type: application/zip"); + header("Content-Disposition: attachment; filename=phone_data.zip"); + header("Pragma: no-cache"); + header("Expires: 0"); + readfile($fname); } - /* [3] Création de l'archive - =========================================================*/ - $zip = new ZipArchive(); - $fname = '/tmp/'.time().'.zip'; - $zip->open($fname, ZipArchive::CREATE); - - foreach($output as $name=>$content) - $zip->addFromString($name.'.csv', $content); - - $zip->close(); - - /* [4] On lance le téléchargement - =========================================================*/ - header("Content-type: application/zip"); - header("Content-Disposition: attachment; filename=phone_data.zip"); - header("Pragma: no-cache"); - header("Expires: 0"); - readfile($fname); + $req = new ModuleRequest('call_log/unserialize', array('phone_number'=>'05 05 05 05 05')); + $res = $req->dispatch(); + var_dump( $res->get('sms') ); ?> diff --git a/config/dispatcher-tree.json b/config/dispatcher-tree.json index 6e7558d..8df3bcf 100755 --- a/config/dispatcher-tree.json +++ b/config/dispatcher-tree.json @@ -10,5 +10,7 @@ "js" : "/js", "highcharts": "/js/lib/highcharts", - "sigma": "/js/lib/sigma" + "sigma": "/js/lib/sigma", + + "upload": "/src/upload" } diff --git a/config/upload-auth.json b/config/upload-auth.json index 75cfc36..88a0e8d 100644 --- a/config/upload-auth.json +++ b/config/upload-auth.json @@ -3,7 +3,6 @@ "directories": [ "call_log", "local_data", - "spss", - "pspp" + "phone_storage" ] } diff --git a/doc/phone_log.json b/doc/phone_log.json index 72c95f2..f6ae1f1 100644 --- a/doc/phone_log.json +++ b/doc/phone_log.json @@ -1,5 +1,5 @@ { - "call_log": [ + "logs": [ { "contact":"1", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" }, { "contact":"2", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" }, { "contact":"3", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" }, @@ -25,6 +25,7 @@ ], "contacts": [ + { "contact":"0", "number":"0102030405", "name":"", "sexe":"0", "age":"1", "studies":"1", "reltype":"1", "dist":"0" }, { "contact":"1", "number":"0502030405", "name":"", "sexe":"0", "age":"1", "studies":"1", "reltype":"1", "dist":"0" }, { "contact":"2", "number":"0502030561", "name":"", "sexe":"0", "age":"2", "studies":"2", "reltype":"2", "dist":"1" }, { "contact":"3", "number":"0502030717", "name":"", "sexe":"0", "age":"3", "studies":"3", "reltype":"3", "dist":"2" }, diff --git a/doc/phone_log_dict.json b/doc/phone_log_dict.json index f7840c9..33479cb 100644 --- a/doc/phone_log_dict.json +++ b/doc/phone_log_dict.json @@ -2,7 +2,7 @@ "call_log": { - "direction": { "0": "INCOMING", "1": "OUTCOMING", "2": "MISSED" }, + "direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" }, "type": { "0": "PHONE", "1": "SMS" } }, diff --git a/manager/module/call_log.php b/manager/module/call_log.php index 1dcd4c2..4bbc755 100644 --- a/manager/module/call_log.php +++ b/manager/module/call_log.php @@ -25,6 +25,7 @@ // On formatte le numéro de téléphone $phone_number = Database::formatNumber($phone_number); + /* [0] On récupère dans la config le chemin du fichier =========================================================*/ /* (1) On récupère le fichier */ @@ -45,7 +46,51 @@ $prefix = 'call_log'; $extension = 'xml'; $path = __ROOT__.$uploadAuth['root']."/$prefix/".$_SESSION['username'].".$extension"; - /* [1] On parse/récupère le xml + + + /* [1] On récupère le dictionnaire des valeurs + =========================================================*/ + /* (1) On récupère le fichier */ + $dict = ResourceDispatcher::getResource('f/json/dictionary/upload/phone_storage'); + + /* (2) Si une erreur pour le fichier de conf */ + if( $dict === false ) + return ManagerError::UnreachableResource; + + /* (3) On récupère la config sous forme de tableau */ + $dict = json_decode( $dict, true ); + + /* (4) Si erreur de PARSAGE */ + if( !is_array($dict) ) + return ManagerError::ParsingFailed; + + + + /* [2] Fonction pour mettre la clé associée dans la dictionnaire + =========================================================*/ + function dParse($dict, $path, $value){ + // {0} On met en forme la clé // + $path = explode(':', $path); + + // {1} Si mauvaise taille, on quitte // + if( count($path) != 2 ) + return $value; + + // {2} Si l'entrée n'existe pas, on retourne la valeur // + if( !isset($dict[$path[0]][$path[1]]) ) + return $value; + + // {3} On charche parmi les valeurs possibles // + foreach($dict[$path[0]][$path[1]] as $k=>$v) + if( $v == $value ) // Si on trouve la valeur, on retourne la clé associée + return $k; + + + // {4} On retourne la valeur tel quel si on ne trouve pas // + return $value; + }; + + /* [3] On parse/récupère le xml =========================================================*/ // Si le fichier n'existe pas, on quitte if( !file_exists($path) ) @@ -62,114 +107,118 @@ if( $xml === false ) return array('ModuleError' => ManagerError::ParsingFailed); - /* [2] On lit chaque élément + + /* [4] On lit chaque élément =========================================================*/ - $phone_directory = array(); // Contiendra les correspondances num->Nom - $phone_logs = array(); // Contiendra nos logs (appels/sms) + $id = array(); // Contiendra les correspondances numéro->id + $phone_directory = array(); // Contiendra les données des contacts (par id) + $call_logs = array(); // Contiendra nos logs (appels/sms) foreach($xml->Item as $log){ /* (1) On formatte le numéro */ $number = Database::formatNumber($log['Number']); /* (2) On enregistre le contact dans l'annuaire s'il y est pas déjà */ - if( !isset($phone_directory[$number]) ) - $phone_directory[$number] = array( - 'name' => strlen($log['Name']) ? (string) $log['Name'] : null, - 'calls' => 0, - 'sms' => 0 + if( !isset($id[$number]) ){ + $id[$number] = count($id); + $cur_id = $id[$number]; + + $phone_directory[$cur_id] = array( + 'id' => $cur_id, + 'number' => $number, + 'name' => is_string($log['Name']) ? (string) $log['Name'] : '', + 'call' => 0, + 'sms' => 0 ); + } + + // On récupère l'id courant + $cur_id = $id[$number]; /* (3) Si c'est un appel, on incrémente le compteur pour ce numéro */ - if( strtolower($log['Type']) == 'phone' ) $phone_directory[$number]['calls']++; + if( strtolower($log['Type']) == 'phone' ) $phone_directory[$cur_id]['call']++; /* (4) Si c'est un sms, on incrémente le compteur pour ce numéro */ - else $phone_directory[$number]['sms']++; + else $phone_directory[$cur_id]['sms']++; /* (5) On complète le log */ - $phone_log = array( - 'source' => ($log['Direction']!='OUTGOING') ? $number : Database::formatNumber($phone_number), - 'target' => ($log['Direction']!='OUTGOING') ? Database::formatNumber($phone_number) : $number, - 'missed' => $log['Direction']==['MISSED'], - 'type' => strtolower($log['Type']), - 'date' => strtotime($log['Date']), - 'duration' => (int) $log['Duration'] + $call_log = array( + 'id' => $cur_id, + 'direction' => dParse($dict, 'logs:direction', $log['Direction']), + 'type' => dParse($dict, 'logs:type', strtoupper($log['Type'])), + 'date' => strtotime($log['Date']), + 'duration' => (int) $log['Duration'] ); - array_push($phone_logs, $phone_log); + array_push($call_logs, $call_log); } + /* [5] On trie les contacts par nombre d'apparition d'APPEL =========================================================*/ $tmp = $phone_directory; // Permet de ne pas efface $phone_directory - $maxNumber = -1; // Contiendra le numéro du plus gros + $maxId = -1; // Contiendra l'id du plus gros $maxVal = null; // Contiendra la valeur max (total calls) $call_sorted = array(); // Contiendra l'annuaire trié par nombre d'interraction /* (1) Tant qu'on a pas tout trié */ while( count($tmp) > 0 ){ - $maxNumber = -1; + $maxId = -1; $maxVal = null; /* (2) On parcours toutes les entrées puor trouver le plus proche */ - foreach($tmp as $number=>$data) - if( $data['calls'] > $maxVal || is_null($maxVal) ){ + foreach($tmp as $cur_id=>$data) + if( $data['call'] > $maxVal || is_null($maxVal) ){ // On met à jour la valeur max - $maxVal = $data['calls']; + $maxVal = $data['call']; // On met à jour l'indice - $maxNumber = $number; + $maxId = $cur_id; } /* (3) On supprime le plus proche qu'on a trouvé et on l'ajoute au tableau trié */ - array_push($call_sorted, array( - 'number' => $maxNumber, - 'name' => $tmp[$maxNumber]['name'], - 'count' => $tmp[$maxNumber]['calls'] - )); + array_push($call_sorted, $maxId); - unset($tmp[$maxNumber]); + unset($tmp[$maxId]); } /* [6] On trie les contacts par nombre d'apparition de SMS/MMS =========================================================*/ $tmp = $phone_directory; // Permet de ne pas efface $phone_directory - $maxNumber = -1; // Contiendra le numéro du plus gros + $maxId = -1; // Contiendra le numéro du plus gros $maxVal = null; // Contiendra la valeur max (total calls) $sms_sorted = array(); // Contiendra l'annuaire trié par nombre d'interraction /* (1) Tant qu'on a pas tout trié */ while( count($tmp) > 0 ){ - $maxNumber = -1; + $maxId = -1; $maxVal = null; /* (2) On parcours toutes les entrées puor trouver le plus proche */ - foreach($tmp as $number=>$data) + foreach($tmp as $cur_id=>$data) if( $data['sms'] > $maxVal || is_null($maxVal) ){ // On met à jour la valeur max $maxVal = $data['sms']; // On met à jour l'indice - $maxNumber = $number; + $maxId = $cur_id; } /* (3) On supprime le plus proche qu'on a trouvé et on l'ajoute au tableau trié */ - array_push($sms_sorted, array( - 'number' => $maxNumber, - 'name' => $tmp[$maxNumber]['name'], - 'count' => $tmp[$maxNumber]['sms'] - )); + array_push($sms_sorted, $maxId ); - unset($tmp[$maxNumber]); + unset($tmp[$maxId]); } - /* [6] Gestion du retour + + /* [7] Gestion du retour =========================================================*/ return array( 'ModuleError' => ManagerError::Success, 'directory' => $phone_directory, - 'calls' => $call_sorted, + 'call' => $call_sorted, 'sms' => $sms_sorted, - 'logs' => $phone_logs + 'logs' => $call_logs ); } diff --git a/src/upload/call_log/xdrm.xml b/src/upload/call_log/xdrm.xml index c11ac62..600ea1b 100755 --- a/src/upload/call_log/xdrm.xml +++ b/src/upload/call_log/xdrm.xml @@ -1,866 +1,11816 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/upload/phone_storage/dictionary.json b/src/upload/phone_storage/dictionary.json new file mode 100644 index 0000000..a8f3e3c --- /dev/null +++ b/src/upload/phone_storage/dictionary.json @@ -0,0 +1,54 @@ +{ + + + "logs": { + "direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" }, + "type": { "0": "PHONE", "1": "SMS" } + + }, + + + + + "contacts": { + "sexe": { "0":"Homme", "1":"Femme" }, + "age": { + "0": "5 à 10", "1": "10 à 15", "2": "15 à 20", "3": "20 à 25", "4": "25 à 30", + "5": "30 à 35", "6": "35 à 40", "7": "40 à 45", "8": "45 à 50", "9": "50 à 55", + "10": "55 à 60", "11": "60 à 65", "12": "65 à 70", "13": "70 à 75", "14": "75 à 80", + "15": "80 à 85", "16": "85 à 90", "17": "90 à 95", "18": "95 à 100" + }, + + "studies": { + ".": "Non défini", + "0": "Inconnu", + "1": "< BAC", + "2": "BAC", + "3": "BAC+2", + "4": "BAC+3", + "5": "BAC+4 et plus" + }, + + "reltype": { + "0": "Père, mère ou équivalent", + "1": "Frère ou soeur", + "2": "Autre membre de la famille", + "3": "Relation amoureuse", + "4": "Collègue", + "5": "Voisin", + "6": "Ami", + "7": "Ami proche", + "8": "Relation de service (médecin, ...)", + "9": "Inconnu" + }, + + "dist": { + "0": "- de 5 minutes", + "1": "de 5 à 15 minutes", + "2": "de 15 à 60 minutes", + "3": "+ d'une heure" + } + + } + +} diff --git a/view/js/input-min.js b/view/js/input-min.js index 263388c..1027868 100644 --- a/view/js/input-min.js +++ b/view/js/input-min.js @@ -1,16 +1,15 @@ var subjectManager,contactManager,miniManager,ficheManager,matriceManager; -function dynamicUpdate(b){var a=b instanceof Element,e=a&&"SPAN"==b.tagName&&"switch-left"==b.className,f=a&&"SPAN"==b.tagName&&"switch-both"==b.className,g=a&&"INPUT"==b.tagName&&"submit"==b.type,c=a&&"SPAN"==b.tagName&&("nav-mini"==b.parentNode.id||"nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"nav-contact"==b.parentNode.id;if(!(f||e||g||c||a)&&!0!==b)return!1;if(f)console.log("> switch firstname <-> lastname"),e=b.parentNode,b=e.children[8],e=e.children[10],f=b.value,b.value=e.value,e.value= -f;else if(e){console.log("> switch firstname+lastname -> username");e=b.parentNode;f=e.children[6];b=e.children[8];e=e.children[10];if(0 dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),matriceManager.fieldsToStorage(),ficheManager.sync(),miniManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(), -matriceManager.storageToFields(),(g||a)&&contactManager.storageToFields()}function readableName(b,a,e){var f=a.length,g=e.length;return 0 switch firstname <-> lastname"),f=a.parentNode,a=f.children[8],f=f.children[10],e=a.value,a.value=f.value,f.value= +e;else if(f){console.log("> switch firstname+lastname -> username");f=a.parentNode;e=f.children[6];a=f.children[8];f=f.children[10];if(0 dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),matriceManager.fieldsToStorage(),ficheManager.sync(),miniManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(), +matriceManager.storageToFields(),(c||b)&&contactManager.storageToFields()}function readableName(a,b,f){var e=b.length,c=f.length;return 0sujet avant d'exporter son journal d'appel"):Notification.error("Erreur", -a.ModuleError);else{for(var b=Notification.info("Info","Chargement du journal d'appel"),f=0,g=[],c=0;cc;c++)g.push(a.calls[c].number);for(c=0;cc;c++)h.push(a.sms[c].number);for(c=0;c GATHERING ALL DATA");subjectManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.fieldsToStorage();ficheManager.fieldsToStorage();if(!subjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du sujet"),!1;b=lsi["export"]("mini-fiches");for(var a in b)if(!b[a].valid)return Notification.warning("Attention","La fiche rapide "+(parseInt(a)+1)+" est incompl\u00e8te et/ou incorrecte"), -!1;b=lsi["export"]("fiches");for(a in b)if(!b[a].valid)return Notification.warning("Attention","La fiche compl\u00e8te "+(parseInt(a)+1)+" est incompl\u00e8te et/ou incorrecte"),!1;a={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};api.send(a,function(a){if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)}, -!1)},!1)})})})})}); +$('input#call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:a.target.files[0]};api.send(a,function(b){console.log(b);var a=null;if(0!=b.ModuleError)9==b.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du sujet avant d'exporter son journal d'appel"):Notification.error("Erreur", +b.ModuleError);else{for(var a=Notification.info("Info","Chargement du journal d'appel"),e=0;e GATHERING ALL DATA");subjectManager.fieldsToStorage(); +contactManager.fieldsToStorage();miniManager.fieldsToStorage();ficheManager.fieldsToStorage();if(!subjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du sujet"),!1;a=lsi["export"]("mini-fiches");for(var b in a)if(!a[b].valid)return Notification.warning("Attention","La fiche rapide "+(parseInt(b)+1)+" est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("fiches");for(b in a)if(!a[b].valid)return Notification.warning("Attention", +"La fiche compl\u00e8te "+(parseInt(b)+1)+" est incompl\u00e8te et/ou incorrecte"),!1;b={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};api.send(b,function(a){if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})}); diff --git a/view/js/input.js b/view/js/input.js index 0def77d..46c162e 100644 --- a/view/js/input.js +++ b/view/js/input.js @@ -161,6 +161,7 @@ function readableName(u, f, l){ /* [2] Inclusion des scripts externes et lancement =========================================================*/ +lsi.createDataset('logs'); // TODO: Mettre les versions minifiées include('/js/includes/input-phone-subject.js', function(){ include('/js/includes/input-phone-contact.js', function(){ @@ -277,65 +278,55 @@ include('/js/includes/input-phone-matrice.js', function(){ loadingNotif = Notification.info('Info', 'Chargement du journal d\'appel'); - var uid = 0; // Contiendra l'uid des contacts - /* (3) On récupère les contacts les plus APPELLÉS */ - var most_called = []; - for( var i = 0 ; i < response.calls.length && i < 10 ; i++ ) - most_called.push( response.calls[i].number ); + /* (3) On crée les 10 contacts les plus APPELÉS */ + for( var i = 0 ; i < response.call.length ; i++ ){ - /* (4) On crée les 10 contacts les plus APPELÉS */ - for( var i = 0 ; i < most_called.length ; i++ ){ + // Données du cnotact + var conData = response.directory[ response.call[i] ]; - var splittedName = ['']; - if( response.directory[most_called[i]].name != null ) - splittedName = response.directory[most_called[i]].name.split(' '); + var splittedName = conData.name.split(' '); - lsi.set('contacts', uid, { - uid: uid, - number: most_called[i], - username: splittedName.length > 0 ? splittedName[0] : '', // Si un seul mot -> pseudo - firstname: splittedName.length > 0 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom - lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom - countsms: response.directory[most_called[i]].sms, // Nombre de sms - countcall: response.directory[most_called[i]].calls, // Nombre d'appels + lsi.set('contacts', conData.id, { + uid: conData.id, + number: conData.number, + username: splittedName.length == 1 ? splittedName[0] : '', // Si un seul mot -> pseudo + firstname: splittedName.length > 1 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom + lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom + countsms: conData.sms, // Nombre de sms + countcall: conData.calls, // Nombre d'appels call: i, // classement dans le top 10 des APPELS sms: -1 // classement dans le top 10 des SMS }); - uid++; } + /* (5) On crée les 10 contacts les plus SMSÉS */ + for( var i = 0 ; i < response.sms.length ; i++ ){ - /* (5) On récupère les contacts les plus SMSÉS */ - var most_sms = []; - for( var i = 0 ; i < response.sms.length && i < 10 ; i++ ) - most_sms.push( response.sms[i].number ); + // Données du cnotact + var conData = response.directory[response.sms[i]]; - /* (6) On crée les 10 contacts les plus SMSÉS */ - for( var i = 0 ; i < most_sms.length ; i++ ){ // Si le contact est déja dans le top 10 des appels, on lui ajoute juste le classement dans le top 10 des SMS - var callIndex = most_called.indexOf(most_sms[i]); + var callIndex = response.call.indexOf(response.sms[i]); if( callIndex > -1 ){ - var created = lsi.get('contacts', callIndex); + var created = lsi.get('contacts', conData.id); created.sms = i; - lsi.set('contacts', callIndex, created); + lsi.set('contacts', conData.id, created); continue; } - var splittedName = ['']; - if( response.directory[most_sms[i]].name != null ) - splittedName = response.directory[most_sms[i]].name.split(' '); + var splittedName = conData.name.split(' '); - lsi.set('contacts', uid, { - uid: uid, - number: most_sms[i], - username: splittedName.length > 0 ? splittedName[0] : '', // Si un seul mot -> pseudo - firstname: splittedName.length > 0 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom - lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom - countsms: response.directory[most_sms[i]].sms, // Nombre de sms - countcall: response.directory[most_sms[i]].calls, // Nombre d'appels + lsi.set('contacts', conData.id, { + uid: conData.id, + number: conData.number, + username: splittedName.length == 1 ? splittedName[0] : '', // Si un seul mot -> pseudo + firstname: splittedName.length > 1 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom + lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom + countsms: conData.sms, // Nombre de sms + countcall: conData.calls, // Nombre d'appels call: -1, // classement dans le top 10 des APPELS sms: i // classement dans le top 10 des SMS }); @@ -345,37 +336,39 @@ include('/js/includes/input-phone-matrice.js', function(){ /* (7) Pour chaque contact qui n'est pas dans le top 10, on l'ajoute */ - for( var number in response.directory ){ + for( var id in response.directory ){ // Si dans top 10 des APPELS, on ne l'ajoute pas - if( most_called.indexOf(number) > -1 ) + if( response.call.indexOf(id) > -1 ) continue; // Si dans top 10 des SMS, on ne l'ajoute pas - if( most_sms.indexOf(number) > -1 ) + if( response.sms.indexOf(id) > -1 ) continue; + // On récupère les données du contact + var conData = response.directory[id]; + // On découpe le nom par espaces - var name = response.directory[number].name===null ? '' : response.directory[number].name; - var splittedName = name.split(' '); + var splittedName = conData.name.split(' '); - - lsi.set('contacts', uid, { - uid: uid, - number: number, + lsi.set('contacts', conData.id, { + uid: conData.id, + number: conData.number, username: splittedName.length == 1 ? splittedName[0] : '', // Si un seul mot -> pseudo - firstname: splittedName.length > 1 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom - lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom - countsms: response.directory[number].sms, // Nombre de sms - countcall: response.directory[number].calls, // Nombre d'appels + firstname: splittedName.length > 1 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom + lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom + countsms: conData.sms, // Nombre de sms + countcall: conData.calls, // Nombre d'appels call: -1, sms: -1 }); - - uid++; } + /* (8) On enregistre les logs (appels/sms) */ + lsi.import('logs', response.logs); + /* (8) On met à jour l'affichage */ contactManager.storageToFields(); dynamicUpdate(true); @@ -399,6 +392,7 @@ include('/js/includes/input-phone-matrice.js', function(){ $('#clear-all').addEventListener('click', function(e){ /* (1) On vide tous les dataset de données */ lsi.clear('subject'); + lsi.clear('logs'); lsi.clear('contacts'); lsi.clear('mini-fiches'); lsi.clear('fiches'); @@ -429,7 +423,8 @@ include('/js/includes/input-phone-matrice.js', function(){ contacts: lsi.export('contacts'), mini: lsi.export('mini-fiches'), fiches: lsi.export('fiches'), - matrice: lsi.export('matrice')[0] + matrice: lsi.export('matrice')[0], + logs: lsi.export('logs') }; @@ -478,6 +473,7 @@ include('/js/includes/input-phone-matrice.js', function(){ /* (3) On enregistre les données dans le 'localStorage' */ lsi.set('subject', 0, response.local_data.subject); lsi.import('contacts', response.local_data.contacts); + lsi.import('logs', response.local_data.logs); lsi.import('mini-fiches', response.local_data.mini); lsi.import('fiches', response.local_data.fiches); lsi.set('matrice', 0, response.local_data.matrice);