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