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