diff --git a/build/api/module/subject.php b/build/api/module/subject.php index 21fd0d8..30adfd4 100644 --- a/build/api/module/subject.php +++ b/build/api/module/subject.php @@ -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)); diff --git a/config/modules.json b/config/modules.json index 2c61331..bcbed59 100755 --- a/config/modules.json +++ b/config/modules.json @@ -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>" } diff --git a/public_html/view/js/input.js b/public_html/view/js/input.js index 504fdf4..06a8cd9 100644 --- a/public_html/view/js/input.js +++ b/public_html/view/js/input.js @@ -85,8 +85,9 @@ sField.addEventListener('keypress', function(e){ tmpSubjectSearchListener(e); }, false); - - +/* (4) On lance une recherche par défaut +---------------------------------------------------------*/ +tmpSubjectSearchListener(); diff --git a/public_html/view/js/min/input.js b/public_html/view/js/min/input.js index 262d4d5..5f4e873 100644 --- a/public_html/view/js/min/input.js +++ b/public_html/view/js/min/input.js @@ -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("
  • "),c.push("
    SUJET
    "),c.push("
    "),c.push("
    "+ a.results[g].name+"
    "),c.push("
    "+a.results[g].creation+"
    "),c.push("
    "),c.push("
    "),c.push("
    "),c.push("
    "),c.push("
  • ");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",