Repare search by proximity of pronunciation
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 14 Mar 2007 21:10:07 +0000 (21:10 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 14 Mar 2007 21:10:07 +0000 (21:10 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1573 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/platalpage.php
modules/search.php
templates/search/adv.form.tpl
templates/search/index.tpl

index 0fe8ec6..9e737eb 100644 (file)
@@ -224,10 +224,10 @@ class PlatalPage extends Smarty
 function escape_html($string)
 {
     if (is_string($string)) {
-       $transtbl = Array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;', '\'' => '&#39;');
-       return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/u", "&amp;", strtr(pl_entities($string), $transtbl));
+       $transtbl = Array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;', '\'' => '&#39;');
+           return strtr($string, $transtbl);
     } else {
-       return $string;
+           return $string;
     }
 }
 
index 9f42273..0a0229c 100644 (file)
@@ -231,15 +231,13 @@ class SearchModule extends PLModule
         if (!Env::has('rechercher')) {
             $this->form_prepare();
         } else {
-
             $search = new XOrgSearch(array($this, 'get_advanced'));
             $search->setNbLines($globals->search->per_page);
 
             $page->assign('url_search_form', $search->make_url(Array('rechercher'=>0)));
-            if (Env::has('with_soundex')) {
-                $page->assign('with_soundex', $search->make_url(Array())."&with_soundex=1");
+            if (!Env::i('with_soundex')) {
+                $page->assign('with_soundex', $search->make_url(Array()) . "&with_soundex=1");
             }
-
             $nb_tot = $search->show();
 
             if ($nb_tot > $globals->search->private_max) {
index ef19e5a..3da46a3 100644 (file)
        <input type="hidden" name="rechercher" value="Chercher"/>
        <input type="submit" style="display:none"/>
         <input type="text" name="name" size="32" value="{$smarty.request.name}" />
-        {if $smarty.request.name && !$with_soundex && $smarty.request.recherche}
-        <a class='smaller' href="search/adv?with_soundex=1&amp;{$url_args}">
-          étendre par proximité sonore
-        </a>
-        {/if}
       </td>
     </tr>
     <tr>
       <td>Prénom</td>
       <td>
         <input type="text" name="firstname" size="32" value="{$smarty.request.firstname}" />
-        {if $smarty.request.firstname && !$with_soundex && $smarty.request.recherche}
-        <a class='smaller' href="search/adv?with_soundex=1&amp;{$url_args}">
-          étendre par proximité sonore
-        </a>
-        {/if}
       </td>
     </tr>
     <tr>
       </td>
     </tr>
     <tr>
-      <th colspan="2">Géographie</th>
-    </tr>
-    <tr>
       <td colspan="2">
-      <label for="only_current"><input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current} checked="checked"{/if}/>chercher uniquement les adresses où les camarades sont actuellement.</label></td>
+        <input type="checkbox" name="with_soundex" value="1" {if $smarty.request.with_soundex}checked="checked"{/if} id="sdxn" />
+        <label for="sdxn">étendre par proximité sonore (uniquement sur nom et prénom)</label>
+      </td>
+    <tr>
+      <th colspan="2">Géographie</th>
     </tr>
     <tr>
       <td>Ville</td>
       </td>
     </tr>
     <tr>
+      <td colspan="2">
+      <label for="only_current"><input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current}  
+checked="checked"{/if}/>chercher uniquement les adresses où les camarades sont actuellement.</label></td>
+    </tr>
+    <tr>
       <th colspan="2">Activité</th>
     </tr>
     <tr>
index d78610a..21097f6 100644 (file)
   {/if}
   </div>
   {/if}
-  
   <p class="noprint">
-  <strong>Astuce:</strong>
-  Si tu survoles une fiche, tu sauras quand elle a été mise à jour la dernière fois !</p>
+    <strong>{icon name=lightbulb title=Astruce}Astuce&nbsp;:</strong>
+    {if $search_results_nb}
+    Si tu survoles une fiche, tu sauras quand elle a été mise à jour la dernière fois !
+    {elseif $advanced && $with_soundex && ($smarty.request.name || $smarty.request.firstname)}
+    Si tu n'es pas sur de l'orthographe d'un nom, tu peux essayer la <a href="{$with_soundex}">recherche par
+    proximité sonore</a>
+    {elseif $advanced}
+    Essaye d'élargir tes critères de recherche.
+    {elseif $smarty.session.auth ge AUTH_COOKIE}
+    Essaye la <a href="search/adv">recherche avancée</a>
+    {else}
+    Pour les X inscrits à Polytechnique.org, un module de recherche avancée est disponible permettant de réaliser
+    des recherches fines dans l'annuaire. Si vous êtes un X et que vous n'êtes pas encore inscrit, commencez dès
+    maintenant la <a href="register">procédure</a>.
+    {/if}
+  </p>
   {/if}
 {else}
   {if $advanced}