#173: Select countries where there is somebody
[platal.git] / templates / search / adv.form.tpl
index d53b537..ef19e5a 100644 (file)
@@ -1,6 +1,6 @@
 {**************************************************************************}
 {*                                                                        *}
-{*  Copyright (C) 2003-2006 Polytechnique.org                             *}
+{*  Copyright (C) 2003-2007 Polytechnique.org                             *}
 {*  http://opensource.polytechnique.org/                                  *}
 {*                                                                        *}
 {*  This program is free software; you can redistribute it and/or modify  *}
 {*                                                                        *}
 {**************************************************************************}
 
-<h1>Recherche avancée</h1>
+<h1>Recherche dans l'annuaire</h1>
 
-<p>[<a href="{rel}/search">Recherche simple</a>]</p>
-
-<form id="recherche" action="{rel}/search/adv" method="get">
+<form id="recherche" action="search/adv" method="get">
+  <script type="text/javascript">{literal}
+    function launch_form(url) {
+      var f = document.getElementById('recherche');
+      f.action = url;
+      f.submit();
+    }
+  {/literal}</script>
   <table class="bicol" cellpadding="3" summary="Recherche">
     <tr>
+      <th colspan="2">
+        Recherche avancée [<a href="search">&lt;&lt;&lt;&nbsp;Recherche simple</a>]
+      </th>
+    </tr>
+    <tr>
       <td>Nom</td>
       <td>
        <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="{$smarty.server.PHP_SELF}?with_soundex=1&amp;{$url_args}">
-          étendre par proximité sonore
+        <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>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="{$smarty.server.PHP_SELF}?with_soundex=1&amp;{$url_args}">
-          étendre par proximité sonore
+        <a class='smaller' href="search/adv?with_soundex=1&amp;{$url_args}">
+          étendre par proximité sonore
         </a>
         {/if}
       </td>
@@ -80,7 +90,7 @@
         <table>
           <tr>
             <td style="width:100px">
-              <input type="radio" name="woman" value="0" {if !$smarty.request.woman}checked="checked"{/if} />Indifférent
+              <input type="radio" name="woman" value="0" {if !$smarty.request.woman}checked="checked"{/if} />Indifférent
             </td>
             <td style="width:100px">
               <input type="radio" name="woman" value="1" {if $smarty.request.woman eq 1}checked="checked"{/if} />Homme
         <table>
           <tr>
             <td style="width:100px">
-              <input type="radio" name="subscriber" value="0" {if !$smarty.request.subscriber}checked="checked"{/if} />Indifférent
+              <input type="radio" name="subscriber" value="0" {if !$smarty.request.subscriber}checked="checked"{/if} />Indifférent
             </td>
             <td style="width:100px">
               <input type="radio" name="subscriber" value="1" {if $smarty.request.subscriber eq 1}checked="checked"{/if} />Inscrit
         <table>
           <tr>
             <td style="width:100px">
-              <input type="radio" name="alive" value="0" {if !$smarty.request.alive}checked="checked"{/if} />Indifférent
+              <input type="radio" name="alive" value="0" {if !$smarty.request.alive}checked="checked"{/if} />Indifférent
             </td>
             <td style="width:100px">
               <input type="radio" name="alive" value="1" {if $smarty.request.alive eq 1}checked="checked"{/if} />Vivant
             </td>
             <td style="width:100px">
-              <input type="radio" name="alive" value="2" {if $smarty.request.alive eq 2}checked="checked"{/if} />Décédé
+              <input type="radio" name="alive" value="2" {if $smarty.request.alive eq 2}checked="checked"{/if} />Décédé
             </td>
           </tr>
         </table>
       </td>
     </tr>
     <tr>
-      <th colspan="2">Géographie</th>
+      <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>
+      <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>
       <td>Ville</td>
     <tr>
       <td>Pays</td>
       <td>
-        <select name="country" onchange="javascript:document.forms.recherche.submit();">
+        <select name="country" onchange="return Ajax.update_html('region', '{$platal->ns}search/ajax/region/' + this.value);">
         {if $smarty.request.country}
           {assign var="country" value=$smarty.request.country}
         {else}
           {assign var="country" value=""}
         {/if}
-        {geoloc_country country=$country}
+        {geoloc_country country=$country available=true}
         </select>
       </td>
     </tr>
     <tr>
-      <td>Région ou département</td>
-      <td>
-        <select name="region">
+      <td>Région ou département</td>
+      <td id="region">
         {if $smarty.request.region}
           {assign var="region" value=$smarty.request.region}
         {else}
           {assign var="region" value=""}
         {/if}
-        {if $smarty.request.country neq ""}
-        {geoloc_region country=$smarty.request.country region=$region}
-        {else}
-        <option value=""></option>
-        {/if}
-        </select>
+        {include file="search/adv.region.form.tpl" country=$smarty.request.country}
       </td>
     </tr>
     <tr>
-      <th colspan="2">Activité</th>
+      <th colspan="2">Activité</th>
     </tr>
     <tr>
       <td>Entreprise</td>
     <tr>
       <td colspan="2">
         <input type='checkbox' name='only_referent' {if $smarty.request.only_referent}checked='checked'{/if} />
-        chercher uniquement parmi les camarades se proposant comme référents
+        chercher uniquement parmi les camarades se proposant comme référents
       </td>
     </tr>
     <tr>
       <th colspan="2">Divers</th>
     </tr>
     <tr>
-      <td>Nationalité</td>
+      <td>Nationalité</td>
       <td>
         <select name="nationalite">
           {iterate from=$choix_nats item=cn}
     <tr>
       <td>Formation</td>
       <td>
-        <select name="school" onchange="javascript:document.forms.recherche.submit();">
+        <select name="school" onchange="return Ajax.update_html('grade', '{$platal->ns}search/ajax/grade/' + this.value);">
           <option value="0"></option>
           {iterate item=cs from=$choix_schools}
           <option value="{$cs.id}" {if $smarty.request.school eq $cs.id}selected="selected"{/if}>
     </tr>
     <tr>
       <td></td>
-      <td>
-        <select name="diploma">
-          <option value="0"></option>
-          {section name=diploma loop=$choix_diplomas}
-          <option value="{$choix_diplomas[diploma]}" {if $smarty.request.diploma eq
-          $choix_diplomas[diploma]}selected="selected"{/if}>
-            {$choix_diplomas[diploma]}
-          </option>
-          {/section}
-        </select>
+      <td id="grade">
+        {include file="search/adv.grade.form.tpl" grade=$smarty.request.diploma}
       </td>
     </tr>
     <tr>
       <td>Commentaire contient</td>
       <td><input type="text" name="free" size="32" value="{$smarty.request.free}" /></td>
     </tr>
+    <tr>
+      <td colspan="2" style="padding-top: 1.5em">
+        <div style="float: right">
+          <input type="button" value="Chercher" onclick="launch_form('search/adv')"/>
+        </div>
+        {if $smarty.session.auth ge AUTH_COOKIE}
+          <input type='checkbox' name='order' value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} />
+          mettre les fiches modifiées récemment en premier
+        {/if}
+      </td>
+    </tr>
   </table>
-       {min_auth level='cookie'}
-       <p>
-               <input type='checkbox' name='order' value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} />
-               mettre les fiches modifiées récemment en premier
-       </p>
-       {/min_auth}
 </form>
-       <p class="center">
-               <script type="text/javascript">{literal}
-               function launch_form(url) {
-                       var f = document.getElementById('recherche');
-                       f.action = url;
-                       f.submit();
-               }
-               {/literal}</script>
-               {if $use_map}
-                 <input type="button" value="Voir les résultats sur une carte" onclick="launch_form('geoloc/')"/>
-               {/if}
-               <input type="button" value="Chercher" onclick="launch_form('{$smarty.server.PHP_SELF}')"/>
-  </p>
+<p class="center">
+  <input type="button" value="Voir les résultats sur une carte" onclick="launch_form('geoloc/')"/>
+</p>
 <p>
-  <strong>N.B.</strong> Le caractère joker * peut remplacer une ou plusieurs lettres dans les recherches.
+  <strong>N.B.</strong> Le caractère joker * peut remplacer une ou plusieurs lettres dans les recherches.
 </p>
 
-{* vim:set et sw=2 sts=2 sws=2: *}
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}