autocompletion ameliorations
[platal.git] / templates / search / adv.form.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2007 Polytechnique.org                             *}
4 {*  http://opensource.polytechnique.org/                                  *}
5 {*                                                                        *}
6 {*  This program is free software; you can redistribute it and/or modify  *}
7 {*  it under the terms of the GNU General Public License as published by  *}
8 {*  the Free Software Foundation; either version 2 of the License, or     *}
9 {*  (at your option) any later version.                                   *}
10 {*                                                                        *}
11 {*  This program is distributed in the hope that it will be useful,       *}
12 {*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
13 {*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
14 {*  GNU General Public License for more details.                          *}
15 {*                                                                        *}
16 {*  You should have received a copy of the GNU General Public License     *}
17 {*  along with this program; if not, write to the Free Software           *}
18 {*  Foundation, Inc.,                                                     *}
19 {*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
20 {*                                                                        *}
21 {**************************************************************************}
22
23 <h1>Recherche dans l'annuaire</h1>
24
25 <form id="recherche" action="search/adv" method="get">
26   {javascript name="jquery"}
27   {javascript name="jquery.autocomplete"}
28   <script type="text/javascript">{literal}
29     function launch_form(url) {
30       var f = document.getElementById('recherche');
31       f.action = url;
32       f.submit();
33     }
34     function format_autocomplete(row) {
35       if (row[1] == 1) {
36         return row[0];
37       }
38       return row[0] + ' ('+ row[1] + ')';
39     }
40     $(document).ready(function() {
41       $(".autocomplete").each(function() {
42         $(this).autocomplete("search/autocomplete/"+this.name,{selectOnly:1,formatItem:format_autocomplete,matchSubset:0,width:$(this).width()});
43       });
44     });
45   {/literal}</script>
46   <table class="bicol" cellpadding="3" summary="Recherche">
47     <tr>
48       <th colspan="2">
49         Recherche avancée [<a href="search">&lt;&lt;&lt;&nbsp;Recherche simple</a>]
50       </th>
51     </tr>
52     <tr>
53       <td>Nom</td>
54       <td>
55         <input type="hidden" name="rechercher" value="Chercher"/>
56         <input type="submit" style="display:none"/>
57         <input type="text" class="autocomplete" name="name" size="32" value="{$smarty.request.name}" />
58       </td>
59     </tr>
60     <tr>
61       <td>Prénom</td>
62       <td>
63         <input class="autocomplete" type="text" name="firstname" size="32" value="{$smarty.request.firstname}" />
64       </td>
65     </tr>
66     <tr>
67       <td>Surnom</td>
68       <td>
69         <input class="autocomplete" type="text" name="nickname" size="32" value="{$smarty.request.nickname}" />
70       </td>
71     </tr>
72     <tr>
73       <td>Promotion</td>
74       <td>
75         <select name="egal1">
76           <option value="=" {if $smarty.request.egal1 eq "="}selected="selected"{/if}>&nbsp;=&nbsp;</option>
77           <option value="&gt;=" {if $smarty.request.egal1 eq "&gt;="}selected="selected"{/if}>&nbsp;&gt;=&nbsp;</option>
78           <option value="&lt;=" {if $smarty.request.egal1 eq "&lt;="}selected="selected"{/if}>&nbsp;&lt;=&nbsp;</option>
79         </select>
80         <input type="text" name="promo1" size="4" maxlength="4" value="{$smarty.request.promo1}" />
81         &nbsp;ET&nbsp;
82         <select name="egal2">
83           <option value="=" {if $smarty.request.egal2 eq "="}selected="selected"{/if}>&nbsp;=&nbsp;</option>
84           <option value="&gt;=" {if $smarty.request.egal2 eq "&gt;="}selected="selected"{/if}>&nbsp;&gt;=&nbsp;</option>
85           <option value="&lt;=" {if $smarty.request.egal2 eq "&lt;="}selected="selected"{/if}>&nbsp;&lt;=&nbsp;</option>
86         </select>
87         <input type="text" name="promo2" size="4" maxlength="4" value="{$smarty.request.promo2}" />
88       </td>
89     </tr>
90     <tr>
91       <td>Sexe</td>
92       <td>
93         <table>
94           <tr>
95             <td style="width:100px">
96               <input type="radio" name="woman" value="0" {if !$smarty.request.woman}checked="checked"{/if} />Indifférent
97             </td>
98             <td style="width:100px">
99               <input type="radio" name="woman" value="1" {if $smarty.request.woman eq 1}checked="checked"{/if} />Homme
100             </td>
101             <td style="width:100px">
102               <input type="radio" name="woman" value="2" {if $smarty.request.woman eq 2}checked="checked"{/if} />Femme
103             </td>
104           </tr>
105         </table>
106       </td>
107     </tr>
108     <tr>
109       <td>Sur polytechnique.org</td>
110       <td>
111         <table>
112           <tr>
113             <td style="width:100px">
114               <input type="radio" name="subscriber" value="0" {if !$smarty.request.subscriber}checked="checked"{/if} />Indifférent
115             </td>
116             <td style="width:100px">
117               <input type="radio" name="subscriber" value="1" {if $smarty.request.subscriber eq 1}checked="checked"{/if} />Inscrit
118             </td>
119             <td style="width:100px">
120               <input type="radio" name="subscriber" value="2" {if $smarty.request.subscriber eq 2}checked="checked"{/if} />Non inscrit
121             </td>
122           </tr>
123         </table>
124       </td>
125     </tr>
126     <tr>
127       <td>En vie</td>
128       <td>
129         <table>
130           <tr>
131             <td style="width:100px">
132               <input type="radio" name="alive" value="0" {if !$smarty.request.alive}checked="checked"{/if} />Indifférent
133             </td>
134             <td style="width:100px">
135               <input type="radio" name="alive" value="1" {if $smarty.request.alive eq 1}checked="checked"{/if} />Vivant
136             </td>
137             <td style="width:100px">
138               <input type="radio" name="alive" value="2" {if $smarty.request.alive eq 2}checked="checked"{/if} />Décédé
139             </td>
140           </tr>
141         </table>
142       </td>
143     </tr>
144     <tr>
145       <td colspan="2">
146         <input type="checkbox" name="with_soundex" value="1" {if $smarty.request.with_soundex}checked="checked"{/if} id="sdxn" />
147         <label for="sdxn">étendre par proximité sonore (uniquement sur nom et prénom)</label>
148       </td>
149     </tr>
150     <tr>
151       <th colspan="2">Géographie</th>
152     </tr>
153     <tr>
154       <td>Ville</td>
155       <td><input type="text" name="city" size="32" value="{$smarty.request.city}" /></td>
156     </tr>
157     <tr>
158       <td>Pays</td>
159       <td>
160         <select name="country" onchange="return Ajax.update_html('region', '{#globals.baseurl#}/search/ajax/region/' + this.value);">
161         {if $smarty.request.country}
162           {assign var="country" value=$smarty.request.country}
163         {else}
164           {assign var="country" value=""}
165         {/if}
166         {geoloc_country country=$country available=true}
167         </select>
168       </td>
169     </tr>
170     <tr>
171       <td>Région ou département</td>
172       <td id="region">
173         {if $smarty.request.region}
174           {assign var="region" value=$smarty.request.region}
175         {else}
176           {assign var="region" value=""}
177         {/if}
178         {include file="search/adv.region.form.tpl" country=$smarty.request.country}
179       </td>
180     </tr>
181     <tr>
182       <td colspan="2">
183       <label for="only_current"><input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current}  
184 checked="checked"{/if}/>chercher uniquement les adresses où les camarades sont actuellement.</label></td>
185     </tr>
186     <tr>
187       <th colspan="2">Activité</th>
188     </tr>
189     <tr>
190       <td>Entreprise</td>
191       <td><input type="text" class="autocomplete" name="entreprise" size="32" value="{$smarty.request.entreprise}" /></td>
192     </tr>
193     <tr>
194       <td>Fonction</td>
195       <td>
196         <select name="fonction">
197           <option value="0"></option>
198           {iterate from=$choix_postes item=cp}
199           <option value="{$cp.id}" {if $smarty.request.fonction eq $cp.id}selected{/if}>
200             {$cp.fonction_fr}
201           </option>
202           {/iterate}
203         </select>
204       </td>
205     </tr>
206     <tr>
207       <td>Poste</td>
208       <td><input type="text" name="poste" size="32" value="{$smarty.request.poste}" /></td>
209     </tr>
210     <tr>
211       <td>Secteur</td>
212       <td>
213         <select name="secteur">
214           <option value="0"></option>
215           {iterate item=cs from=$choix_secteurs}
216           <option value="{$cs.id}" {if $smarty.request.secteur eq $cs.id}selected{/if}>
217             {$cs.label}
218           </option>
219           {/iterate}
220         </select>
221       </td>
222     </tr>
223     <tr>
224       <td>CV contient</td>
225       <td><input type="text" name="cv" size="32" value="{$smarty.request.cv}" /></td>
226     </tr>
227     <tr>
228       <td colspan="2">
229         <input type='checkbox' name='only_referent' {if $smarty.request.only_referent}checked='checked'{/if} />
230         chercher uniquement parmi les camarades se proposant comme référents
231       </td>
232     </tr>
233     <tr>
234       <th colspan="2">Divers</th>
235     </tr>
236     <tr>
237       <td>Nationalité</td>
238       <td>
239         <select name="nationalite">
240           {iterate from=$choix_nats item=cn}
241           <option value="{$cn.id}" {if $smarty.request.nationalite eq $cn.id}selected="selected"{/if}>
242             {$cn.text}
243           </option>
244           {/iterate}
245         </select>
246       </td>
247     </tr>
248     <tr>
249       <td>Binet</td>
250       <td>
251         <select name="binet">
252         <option value="0"></option>
253         {iterate item=cb from=$choix_binets}
254           <option value="{$cb.id}" {if $smarty.request.binet eq $cb.id}selected="selected"{/if}>
255             {$cb.text|htmlspecialchars}
256           </option>
257         {/iterate}
258         </select>
259       </td>
260     </tr>
261     <tr>
262       <td>Groupe X</td>
263       <td>
264         <select name="groupex">
265         <option value="0"></option>
266         {iterate item=cg from=$choix_groupesx}
267           <option value="{$cg.id}" {if $smarty.request.groupex eq $cg.id}selected="selected"{/if}>
268             {$cg.text}
269           </option>
270         {/iterate}
271         </select>
272       </td>
273     </tr>
274     <tr>
275       <td>Section</td>
276       <td>
277         <select name="section">
278           {iterate item=cs from=$choix_sections}
279           <option value="{$cs.id}" {if $smarty.request.section eq $cs.id}selected="selected"{/if}>
280             {$cs.text}
281           </option>
282           {/iterate}
283         </select>
284       </td>
285     </tr>
286     <tr>
287       <td>Formation</td>
288       <td>
289         <select name="school" onchange="return Ajax.update_html('grade', '{#globals.baseurl#}/search/ajax/grade/' + this.value);">
290           <option value="0"></option>
291           {iterate item=cs from=$choix_schools}
292           <option value="{$cs.id}" {if $smarty.request.school eq $cs.id}selected="selected"{/if}>
293             {$cs.text|htmlspecialchars}
294           </option>
295           {/iterate}
296         </select>
297       </td>
298     </tr>
299     <tr>
300       <td></td>
301       <td id="grade">
302         {include file="search/adv.grade.form.tpl" grade=$smarty.request.diploma}
303       </td>
304     </tr>
305     <tr>
306       <td>Commentaire contient</td>
307       <td><input type="text" name="free" size="32" value="{$smarty.request.free}" /></td>
308     </tr>
309     <tr>
310       <td colspan="2" style="padding-top: 1.5em">
311         <div style="float: right">
312           <input type="button" value="Chercher" onclick="launch_form('search/adv')"/>
313         </div>
314         {if $smarty.session.auth ge AUTH_COOKIE}
315           <input type='checkbox' name='order' value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} />
316           mettre les fiches modifiées récemment en premier
317         {/if}
318       </td>
319     </tr>
320   </table>
321 </form>
322 <p class="center">
323   <input type="button" value="Voir les résultats sur une carte" onclick="launch_form('geoloc/')"/>
324 </p>
325 <p>
326   <strong>N.B.</strong> Le caractère joker * peut remplacer une ou plusieurs lettres dans les recherches.
327 </p>
328
329 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}