All subjects displayed when loading [input/subject::search]

This commit is contained in:
xdrm-brackets 2016-11-05 11:59:42 +01:00
parent 65a1883a53
commit e77e326a1f
4 changed files with 9 additions and 4 deletions

View File

@ -226,6 +226,10 @@
/* [0] Notre fonction de recherche (comparaison)
=========================================================*/
function compareSearch($A, $B){
// Returns all if no search keyword
if( $A == '' )
return true;
// {1} On supprime les espaces et tout en minuscule //
$A = str_replace(' ', '', strtolower($A));
$B = str_replace(' ', '', strtolower($B));

View File

@ -147,7 +147,7 @@
"description": "Recherche d'un sujet par nom",
"permissions": ["admin"],
"parameters": {
"name": { "description": "Le nom du sujet", "type": "varchar(1,50)" }
"name": { "description": "Le nom du sujet", "type": "varchar(0,50)" }
},
"output": {
"results": { "description": "Liste des sujet associés aux mots-clés.", "type": "array<array<mixed>>" }

View File

@ -85,8 +85,9 @@ sField.addEventListener('keypress', function(e){
tmpSubjectSearchListener(e);
}, false);
/* (4) On lance une recherche par défaut
---------------------------------------------------------*/
tmpSubjectSearchListener();

View File

@ -1,7 +1,7 @@
var sField,sSubmit,sList,pSubjectManager=null,pContactManager=null,pMiniManager=null,pFicheManager=null,pMatriceManager=null,fSubjectManager=null,fContactManager=null,fMiniManager=null,fFicheManager=null,fMatriceManager=null,input_ts=Date.now();sField=$("#search-field");sSubmit=$("#search-subject");sList=$('section[data-sublink="survey"] ul[data-list]');
var tmpSubjectSearchListener=function(a){api.send({path:"subject/search",name:sField.value},function(a){if(0!=a.ModuleError)return Notification.error("Erreur","La recherche a \u00e9chou\u00e9."),!1;console.log(a);var c=[],g;for(g in a.results)c.push("<li data-element data-id='"+g+"'>"),c.push("<div data-user><span>SUJET</span></div>"),c.push("<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+g+"'></span> </div>"),c.push("<div> <span data-prefix='Nom'>"+
a.results[g].name+"</span> </div>"),c.push("<div> <span data-prefix='Cr\u00e9ation'>"+a.results[g].creation+"</span> </div>"),c.push("<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=a.results[g].phone?"checked":"")+" disabled><label for='s_"+g+"'>Cellulaire</label>"),c.push("</span> </div>"),c.push("<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=a.results[g].facebook?"checked":"")+" disabled><label for='s_"+g+"'>Facebook</label>"),c.push("</span> </div>"),c.push("</li>");sList.innerHTML=
c.join("")})};sSubmit.addEventListener("click",tmpSubjectSearchListener,!1);sField.addEventListener("keypress",function(a){13===a.keyCode&&tmpSubjectSearchListener(a)},!1);
c.join("")})};sSubmit.addEventListener("click",tmpSubjectSearchListener,!1);sField.addEventListener("keypress",function(a){13===a.keyCode&&tmpSubjectSearchListener(a)},!1);tmpSubjectSearchListener();
var pAlready=0,pLoaded=[0,0,0,0,0],phoneRoutine=function(){!Math.min.apply(Math,pLoaded)|pAlready||(pAlready=1,console.groupEnd(),console.group("[phone] Initialization"),pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="submit"]')),pSubjectManager.attach(pDynamicUpdate),pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact')),
pContactManager.attach(pDynamicUpdate),pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini')),pMiniManager.attach(pDynamicUpdate),pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),$('[data-sublink="phone"] #p_nav-fiche')),pFicheManager.top_size=20,pFicheManager.attach(pDynamicUpdate),pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel')),pMatriceManager.attach(pDynamicUpdate),
$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");lsi.clear("p_friends");pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1),$('[data-sublink="phone"] #p_export-all').addEventListener("click",