Gestion de après l'upload -> début

This commit is contained in:
xdrm-brackets 2016-04-27 19:54:11 +02:00
parent 83ab5702ec
commit 66f0b26d2f
17 changed files with 2067 additions and 52 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -197,7 +197,7 @@
padding: 0 15px; padding: 0 15px;
border-radius: 3px; border-radius: 3px;
background: $timeline-1; background: $timeline-0;
color: #222; color: #222;
line-height: 30px; line-height: 30px;
@ -225,14 +225,14 @@
/* Animation de hover*/ /* Animation de hover*/
& input[type='file']:hover + span.file-input{ & input[type='file']:hover + span.file-input{
background: darken($timeline-1, 10); background: darken($timeline-0, 10);
box-shadow: inset 0 0 5px #888; box-shadow: inset 0 0 5px #888;
} }
/* Animation de .active*/ /* Animation de .active*/
& input[type='file'].active + span.file-input{ & input[type='file'].active + span.file-input{
background: $timeline-color; background: $timeline-2;
color: #fff; color: #fff;
// On change l'icône // On change l'icône
&:before{ &:before{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,6 @@ d[c].setAttribute("checked","checked"):d[c].removeAttribute("checked")};inputPho
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");for(var a=lsi.keys("contacts"),c=0;c<a.length&&9>c;c++){var b=lsi.get("contacts",a[c]),d=lsi.get("fiches",a[c]);null==d&&(d=this.defaultData);d.uid=b.uid;d.firstname=b.firstname;d.lastname=b.lastname;d.username=b.username;lsi.set("fiches",a[c],d)}}; inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");for(var a=lsi.keys("contacts"),c=0;c<a.length&&9>c;c++){var b=lsi.get("contacts",a[c]),d=lsi.get("fiches",a[c]);null==d&&(d=this.defaultData);d.uid=b.uid;d.firstname=b.firstname;d.lastname=b.lastname;d.username=b.username;lsi.set("fiches",a[c],d)}};
inputPhoneFiche.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML))return!1;for(var c=$$("#nav-fiche > span.active"),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1;a=$$("article.relation-panel .fiche-relation.active");for(b=0;b<a.length;b++)a[b].remClass("active");this.container.children[this.selected].addClass("active")}; inputPhoneFiche.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML))return!1;for(var c=$$("#nav-fiche > span.active"),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1;a=$$("article.relation-panel .fiche-relation.active");for(b=0;b<a.length;b++)a[b].remClass("active");this.container.children[this.selected].addClass("active")};
inputPhoneFiche.prototype.updateNavBar=function(a){this.nav_container.innerHTML="";for(var c=0;c<a.length;c++){var b=parseInt(a[c])+1;this.nav_container.innerHTML+="<span>"+b+"</span>"}this.check();this.nav(this.nav_container.children[this.selected])}; inputPhoneFiche.prototype.updateNavBar=function(a){this.nav_container.innerHTML="";for(var c=0;c<a.length;c++){var b=parseInt(a[c])+1;this.nav_container.innerHTML+="<span>"+b+"</span>"}this.check();this.nav(this.nav_container.children[this.selected])};
inputPhoneFiche.prototype.check=function(){for(var a=lsi.keys("fiches"),c=0;c<a.length;c++){var b=lsi.get("fiches",a[c]),d=!0,d=d&&!isNaN(parseInt(b.age));console.log(d);d=d&&2<=b.city.length;console.log(d);d=d&&(!isNaN(parseInt(b.duration[0]))||""==b.duration[0].length);console.log(d);d=d&&(!isNaN(parseInt(b.duration[1]))||""==b.duration[1].length);console.log(d);d=d&&0<b.duration[0].length+b.duration[1].length;console.log(d);d=d&&"."!=b.job;console.log(d);d=d&&"."!=b.studies;console.log(d);d=d&& inputPhoneFiche.prototype.check=function(){for(var a=lsi.keys("fiches"),c=0;c<a.length;c++){for(var b=lsi.get("fiches",a[c]),d=!0,d=(d=(d=(d=(d=(d=(d=(d=(d=(d=(d=(d=d&&!isNaN(parseInt(b.age)))&&2<=b.city.length)&&(!isNaN(parseInt(b.duration[0]))||""==b.duration[0].length))&&(!isNaN(parseInt(b.duration[1]))||""==b.duration[1].length))&&0<b.duration[0].length+b.duration[1].length)&&"."!=b.job)&&"."!=b.studies)&&checkRadioValue(b.sexe))&&checkRadioValue(b.famsit))&&checkRadioValue(b.reltype))&&checkRadioValue(b.loc))&&
checkRadioValue(b.sexe);console.log(d);d=d&&checkRadioValue(b.famsit);console.log(d);d=d&&checkRadioValue(b.reltype);console.log(d);d=d&&checkRadioValue(b.loc);console.log(d);d=d&&checkRadioValue(b.context);console.log(d);for(c=0;c<b.freq.length;c++)d=d&&checkRadioValue(b.freq[c]);console.log(d);for(c=0;c<b.connect.length;c++)d=d&&checkRadioValue(b.connect[c]);console.log(d);d=d&&(!b.reltype[8].status||b.reltype[8].status&&2<=b.reltypeSpecial.length);console.log(d);(d=(d=(d=d&&(!b.context[11].status|| checkRadioValue(b.context),c=0;c<b.freq.length;c++)d=d&&checkRadioValue(b.freq[c]);for(c=0;c<b.connect.length;c++)d=d&&checkRadioValue(b.connect[c]);(d=(d=(d=(d=d&&(!b.reltype[8].status||b.reltype[8].status&&2<=b.reltypeSpecial.length))&&(!b.context[11].status||b.context[11].status&&2<=b.contextSpecial[0].length))&&(!b.context[12].status||b.context[12].status&&2<=b.contextSpecial[1].length))&&(!b.context[13].status||b.context[13].status&&2<=b.contextSpecial[2].length))?this.nav_container.children[b.uid].addClass("done"):
b.context[11].status&&2<=b.contextSpecial[0].length))&&(!b.context[12].status||b.context[12].status&&2<=b.contextSpecial[1].length))&&(!b.context[13].status||b.context[13].status&&2<=b.contextSpecial[2].length))?this.nav_container.children[b.uid].addClass("done"):this.nav_container.children[b.uid].remClass("done")}}; this.nav_container.children[b.uid].remClass("done")}};inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var c=this,c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler()},!1)};
inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var c=this,c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler()},!1)};

View File

@ -437,58 +437,43 @@ inputPhoneFiche.prototype.check = function(){
// {1} Vérification des <input> // // {1} Vérification des <input> //
// 1. L'age est un nombre // 1. L'age est un nombre
validForm = validForm && !isNaN(parseInt(ficheData.age)); validForm = validForm && !isNaN(parseInt(ficheData.age));
console.log(validForm);
// 2. La ville a au moins 2 caractères // 2. La ville a au moins 2 caractères
validForm = validForm && ficheData.city.length >= 2; validForm = validForm && ficheData.city.length >= 2;
console.log(validForm);
// 3. La durée de la relation en mois est vide ou un nombre // 3. La durée de la relation en mois est vide ou un nombre
validForm = validForm && (!isNaN(parseInt(ficheData.duration[0])) || ficheData.duration[0].length == ''); validForm = validForm && (!isNaN(parseInt(ficheData.duration[0])) || ficheData.duration[0].length == '');
console.log(validForm);
// 4. La durée de la relation en année est vide ou un nombre // 4. La durée de la relation en année est vide ou un nombre
validForm = validForm && (!isNaN(parseInt(ficheData.duration[1])) || ficheData.duration[1].length == ''); validForm = validForm && (!isNaN(parseInt(ficheData.duration[1])) || ficheData.duration[1].length == '');
console.log(validForm);
// 5. Pour la durée de la relation, au moins un des 2 n'est pas vide // 5. Pour la durée de la relation, au moins un des 2 n'est pas vide
validForm = validForm && ficheData.duration[0].length+ficheData.duration[1].length > 0; validForm = validForm && ficheData.duration[0].length+ficheData.duration[1].length > 0;
console.log(validForm);
// {2} Vérification des <select> // // {2} Vérification des <select> //
// 6. Le <select> pour la profession n'est pas indéfini // 6. Le <select> pour la profession n'est pas indéfini
validForm = validForm && ficheData.job != '.'; validForm = validForm && ficheData.job != '.';
console.log(validForm);
// 7. Le <select> pour les études n'est pas indéfini // 7. Le <select> pour les études n'est pas indéfini
validForm = validForm && ficheData.studies != '.'; validForm = validForm && ficheData.studies != '.';
console.log(validForm);
// {3} Vérification des <input> radio // // {3} Vérification des <input> radio //
// 8. Le SEXE a un et un seul choix // 8. Le SEXE a un et un seul choix
validForm = validForm && checkRadioValue(ficheData.sexe); validForm = validForm && checkRadioValue(ficheData.sexe);
console.log(validForm);
// 9. La SITUATION FAMILIALE a un et un seul choix // 9. La SITUATION FAMILIALE a un et un seul choix
validForm = validForm && checkRadioValue(ficheData.famsit); validForm = validForm && checkRadioValue(ficheData.famsit);
console.log(validForm);
// 10. Le TYPE DE RELATION a un et un seul choix // 10. Le TYPE DE RELATION a un et un seul choix
validForm = validForm && checkRadioValue(ficheData.reltype); validForm = validForm && checkRadioValue(ficheData.reltype);
console.log(validForm);
// 11. La DISTANCE DE DOMICILE (location) a un et un seul choix // 11. La DISTANCE DE DOMICILE (location) a un et un seul choix
validForm = validForm && checkRadioValue(ficheData.loc); validForm = validForm && checkRadioValue(ficheData.loc);
console.log(validForm);
// 12. Le CONTEXTE DE RENCONTRE a un et un seul choix // 12. Le CONTEXTE DE RENCONTRE a un et un seul choix
validForm = validForm && checkRadioValue(ficheData.context); validForm = validForm && checkRadioValue(ficheData.context);
console.log(validForm);
// 13. Les FRÉQUENCES ont un et un seul choix (par question de fréquence) // 13. Les FRÉQUENCES ont un et un seul choix (par question de fréquence)
for( var i = 0 ; i < ficheData.freq.length ; i++ ) for( var i = 0 ; i < ficheData.freq.length ; i++ )
validForm = validForm && checkRadioValue( ficheData.freq[i] ); validForm = validForm && checkRadioValue( ficheData.freq[i] );
console.log(validForm);
// 14. Les CONNECTION ont un et un seul choix (par question de connection) // 14. Les CONNECTION ont un et un seul choix (par question de connection)
for( var i = 0 ; i < ficheData.connect.length ; i++ ) for( var i = 0 ; i < ficheData.connect.length ; i++ )
validForm = validForm && checkRadioValue( ficheData.connect[i] ); validForm = validForm && checkRadioValue( ficheData.connect[i] );
console.log(validForm);
// {4} <input> dépendant d'un choix d'un <input> radio // // {4} <input> dépendant d'un choix d'un <input> radio //
// 15. TYPE DE RELATION si autre est coché (indice 8) // 15. TYPE DE RELATION si autre est coché (indice 8)
validForm = validForm && (!ficheData.reltype[8].status || ficheData.reltype[8].status && ficheData.reltypeSpecial.length >= 2); validForm = validForm && (!ficheData.reltype[8].status || ficheData.reltype[8].status && ficheData.reltypeSpecial.length >= 2);
console.log(validForm);
// 16. CONTEXTE DE RELATION si est coché indice 11 // 16. CONTEXTE DE RELATION si est coché indice 11
validForm = validForm && (!ficheData.context[11].status || ficheData.context[11].status && ficheData.contextSpecial[0].length >= 2); validForm = validForm && (!ficheData.context[11].status || ficheData.context[11].status && ficheData.contextSpecial[0].length >= 2);

View File

@ -72,9 +72,21 @@
/* (2) On enregistre le contact dans l'annuaire s'il y est pas déjà */ /* (2) On enregistre le contact dans l'annuaire s'il y est pas déjà */
if( !isset($phone_directory[$number]) ) if( !isset($phone_directory[$number]) )
$phone_directory[$number] = strlen($log['Name']) ? (string) $log['Name'] : null; $phone_directory[$number] = array(
'name' => strlen($log['Name']) ? (string) $log['Name'] : null,
'calls' => 0,
'sms' => 0
);
/* (3) On complète le log */
/* (3) Si c'est un appel, on incrémente le compteur pour ce numéro */
if( strtolower($log['Type']) == 'phone' ) $phone_directory[$number]['calls']++;
/* (4) Si c'est un sms, on incrémente le compteur pour ce numéro */
else $phone_directory[$number]['sms']++;
/* (5) On complète le log */
$phone_log = array( $phone_log = array(
'source' => ($log['Direction']=='INCOMING') ? $number : Database::formatNumber($phone_number), 'source' => ($log['Direction']=='INCOMING') ? $number : Database::formatNumber($phone_number),
'target' => ($log['Direction']=='INCOMING') ? Database::formatNumber($phone_number) : $number, 'target' => ($log['Direction']=='INCOMING') ? Database::formatNumber($phone_number) : $number,
@ -85,8 +97,14 @@
array_push($phone_logs, $phone_log); array_push($phone_logs, $phone_log);
} }
/* [5] On trie les contacts par nombre d'apparition
=========================================================*/
// Système de poids -> 5 sms = 1 appel
// 0 -> {number, name, calls, sms} (closest contact)
// 1 -> {number, name, calls, sms} (2nd closest contact)
/* [5] Gestion du retour
/* [6] Gestion du retour
=========================================================*/ =========================================================*/
return array( return array(
'ModuleError' => ManagerError::Success, 'ModuleError' => ManagerError::Success,

File diff suppressed because it is too large Load Diff

1001
src/upload/call_log/xdrm.xml Executable file

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
<h5 data-text="Renseigner au moins un des nominatifs pour chaque contact. (pseudo, prénom et/ou nom)"></h5> <h5 data-text="Renseigner au moins un des nominatifs pour chaque contact. (pseudo, prénom et/ou nom)"></h5>
<article class='subject-panel'> <article class='subject-panel'>
<h4 class='self color2' data-icon='a'> <h4 class='self color2' data-icon='a'>
<input type='text' data-name='number' placeholder='Numéro de téléphone'> <input type='text' data-name='number' id='subject_phone_number' placeholder='Numéro de téléphone'>
<input type='text' data-name='username' placeholder='Pseudo'> <input type='text' data-name='username' placeholder='Pseudo'>
<input type='text' data-name='firstname' placeholder='Prénom'> <input type='text' data-name='firstname' placeholder='Prénom'>
<input type='text' data-name='lastname' placeholder='Nom'> <input type='text' data-name='lastname' placeholder='Nom'>

View File

@ -1,5 +1,5 @@
var importCallLog=$('input#call_log-import[type="file"]'),subjectManager,contactManager,miniManager,ficheManager;function dynamicUpdate(){console.log("DYNAMIC UPDATE: UPDATING");miniManager.fieldsToStorage();ficheManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.sync();ficheManager.sync();miniManager.storageToFields();ficheManager.storageToFields();contactManager.storageToFields()} var importCallLog=$('input#call_log-import[type="file"]'),subjectManager,contactManager,miniManager,ficheManager;function dynamicUpdate(){console.log("DYNAMIC UPDATE: UPDATING");miniManager.fieldsToStorage();ficheManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.sync();ficheManager.sync();miniManager.storageToFields();ficheManager.storageToFields();contactManager.storageToFields()}
function checkRadioValue(b){for(var a=0,c=0;c<b.length;c++)!0===b[c].status&&a++;return 1!=a?!1:!0} function checkRadioValue(b){for(var a=0,c=0;c<b.length;c++)!0===b[c].status&&a++;return 1!=a?!1:!0}
include("/js/includes/input-phone-subject.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche.js",function(){subjectManager=new inputPhoneSubject($('article.subject-panel [data-name="number"]'),$('article.subject-panel [data-name="username"]'),$('article.subject-panel [data-name="firstname"]'),$('article.subject-panel [data-name="lastname"]'),$('article.subject-panel [data-name="submit"]')); include("/js/includes/input-phone-subject.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche.js",function(){subjectManager=new inputPhoneSubject($('article.subject-panel [data-name="number"]'),$('article.subject-panel [data-name="username"]'),$('article.subject-panel [data-name="firstname"]'),$('article.subject-panel [data-name="lastname"]'),$('article.subject-panel [data-name="submit"]'));
subjectManager.attach();contactManager=new inputPhoneContact($("article.contact-panel"),$("h4.add-contact"));contactManager.attach(dynamicUpdate);miniManager=new inputPhoneMini($("article.mini-relation-panel"),$("#nav-mini"));miniManager.attach(dynamicUpdate);ficheManager=new inputPhoneFiche($("article.relation-panel"),$("#nav-fiche"));ficheManager.attach(dynamicUpdate);importCallLog.addEventListener("change",function(b){api.send({path:"upload/call_log",file:importCallLog.files[0]},function(a){console.log(a); subjectManager.attach();contactManager=new inputPhoneContact($("article.contact-panel"),$("h4.add-contact"));contactManager.attach(dynamicUpdate);miniManager=new inputPhoneMini($("article.mini-relation-panel"),$("#nav-mini"));miniManager.attach(dynamicUpdate);ficheManager=new inputPhoneFiche($("article.relation-panel"),$("#nav-fiche"));ficheManager.attach(dynamicUpdate);importCallLog.addEventListener("change",function(b){api.send({path:"upload/call_log",file:importCallLog.files[0]},function(a){0==
0==a.ModuleError&&importCallLog.addClass("active")})},!1)})})})}); a.ModuleError&&(importCallLog.addClass("active"),console.log(a),a={path:"call_log/unserialize",phone_number:$("#subject_phone_number").value},api.send(a,function(a){console.log(a)}))})},!1)})})})});

View File

@ -146,13 +146,24 @@ include('/js/includes/input-phone-fiche.js', function(){
}; };
/* (2) On effectue l'upload (import) */ /* (2) On effectue l'upload (import) */
api.send(uploadRequest, function(response){ api.send(uploadRequest, function(uploadResponse){
console.log( response );
// Si tout est bon, on met l'input en bleu // Si tout est bon, on met l'input en bleu
if( response.ModuleError == 0 ){ if( uploadResponse.ModuleError == 0 ){
importCallLog.addClass('active'); importCallLog.addClass('active');
// TODO: Gestion de l'ajout des fiches relation // TODO: Gestion de l'ajout des fiches relation
/* (3) On rédige la requête pour récupérer les données du fichier */
console.log(uploadResponse);
var getCallLogRequest = {
path: 'call_log/unserialize',
phone_number: $('#subject_phone_number').value
};
/* (4) On effectue la récupération d'informations */
api.send(getCallLogRequest, function(dataResponse){
console.log(dataResponse);
});
} }
}); });