0337d704 |
1 | {**************************************************************************} |
2 | {* *} |
5ddeb07c |
3 | {* Copyright (C) 2003-2007 Polytechnique.org *} |
0337d704 |
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 | |
1f17ab93 |
23 | <h1>Recherche dans l'annuaire</h1> |
0337d704 |
24 | |
a94040d2 |
25 | {javascript name="jquery"} |
26 | {javascript name="jquery.autocomplete"} |
66f2b6b3 |
27 | <script type="text/javascript">// <!-- |
28 | var baseurl = "{#globals.baseurl#}/search/"; |
29 | {literal} |
30 | |
31 | // use same form to send to search or map |
32 | function launch_form(url) { |
33 | var f = document.getElementById('recherche'); |
34 | f.action = url; |
35 | f.submit(); |
36 | } |
37 | |
38 | // display an autocomplete row : blabla (nb of found matches) |
39 | function format_autocomplete(row) { |
40 | if (row[1] == 1) { |
41 | return row[0]; |
42 | } |
43 | return row[0] + ' ('+ row[1] + ')'; |
44 | } |
45 | |
46 | // when changing country, open up region choice |
47 | function changeCountry(a2) { |
48 | $(".autocompleteTarget[@name='country']").attr('value',a2); |
49 | if (a2) { |
50 | $(".autocomplete[@name='countryTxt']").addClass('hidden_valid'); |
51 | $("[@name='region']").parent().load(baseurl + 'list/region/', { country:a2 }, function() { |
52 | if ($("select[@name='region']").children("option").size() > 1) { |
53 | $("select[@name='region']").attr('value', '{/literal}{$smarty.request.region}{literal}').show(); |
54 | } else { |
55 | $("select[@name='region']").attr('value', '').hide(); |
56 | } |
57 | }); |
58 | } else { |
59 | $(".autocomplete[@name='countryTxt']").removeClass('hidden_valid'); |
60 | $("select[@name='region']").attr('value', '').hide(); |
61 | } |
62 | } |
63 | |
64 | // when changing school, open diploma choice |
65 | function changeSchool(schoolId) { |
66 | $(".autocompleteTarget[@name='school']").attr('value',schoolId); |
67 | if (schoolId) { |
68 | $(".autocomplete[@name='schoolTxt']").addClass('hidden_valid'); |
69 | $("[@name='diploma']").parent().load(parent + 'list/diploma/', { school:schoolId }, function() { |
70 | if ($("select[@name='diploma']").children("option").size() > 1) { |
71 | $("select[@name='diploma']").attr('value', '{/literal}{$smarty.request.diploma}{literal}'); |
72 | } else { |
73 | $("select[@name='diploma']").attr('value', '').hide(); |
74 | } |
75 | }); |
76 | } else { |
77 | $(".autocomplete[@name='schoolTxt']").removeClass('hidden_valid'); |
78 | $("select[@name='diploma']").attr('value', '').hide(); |
79 | } |
80 | } |
81 | |
82 | // when choosing autocomplete from list, must validate |
83 | function select_autocomplete(name) { |
84 | nameRealField = name.replace(/Txt$/, ''); |
85 | // nothing to do if field is not a text field for a list |
86 | if (nameRealField == name) |
87 | return null; |
88 | // if changing country, might want to open region choice |
89 | if (nameRealField == 'country') |
90 | return function(i) { |
91 | changeCountry(i.extra[1]); |
92 | } |
93 | if (nameRealField == 'school') |
94 | return function(i) { |
95 | changeSchool(i.extra[1]); |
96 | } |
97 | // change field in list and display text field as valid |
98 | return function(i) { |
99 | nameRealField = this.field.replace(/Txt$/, ''); |
100 | $(".autocompleteTarget[@name='"+nameRealField+"']").attr('value',i.extra[1]); |
101 | $(".autocomplete[@name='"+this.field+"']").addClass('hidden_valid'); |
102 | } |
103 | } |
104 | $(document).ready(function() { |
105 | $(".autocompleteTarget").hide(); |
106 | $(".autocomplete").show().each(function() { |
107 | targeted = $("../.autocompleteTarget",this)[0]; |
108 | if (targeted && targeted.value) { |
109 | me = $(this); |
110 | $.get(baseurl + 'list/'+ targeted.name +'/'+targeted.value, {},function(textValue) { |
111 | me.attr('value', textValue); |
112 | me.addClass('hidden_valid'); |
113 | }); |
114 | } |
115 | $(this).autocomplete(baseurl + "autocomplete/"+this.name,{ |
116 | selectOnly:1, |
117 | formatItem:format_autocomplete, |
118 | field:this.name, |
119 | onItemSelect:select_autocomplete(this.name), |
120 | matchSubset:0, |
121 | width:$(this).width()}); |
122 | }); |
123 | $(".autocomplete").change(function() { $(this).removeClass('hidden_valid'); }); |
124 | $(".autocomplete[@name='countryTxt']").change(function() { changeCountry(''); }); |
125 | changeCountry({/literal}'{$smarty.request.country}'{literal}); |
126 | $(".autocomplete[@name='schoolTxt']").change(function() { changeSchool(''); }); |
127 | changeSchool({/literal}'{$smarty.request.school}'{literal}); |
128 | $(".autocompleteToSelect").each(function() { |
129 | var fieldName = $(this).attr('href'); |
130 | $(this).attr('href', baseurl + 'list/'+fieldName).click(function() { |
131 | var oldval = $("input.autocompleteTarget[@name='"+fieldName+"']")[0].value; |
132 | $(".autocompleteTarget[@name='"+fieldName+"']").parent().load(baseurl + 'list/'+fieldName,{},function(selectBox) { |
133 | $(".autocompleteTarget[@name='"+fieldName+"']").remove(); |
134 | $(".autocomplete[@name='"+fieldName+"Txt']").remove(); |
135 | $("select[@name='"+fieldName+"']").attr('value', oldval); |
136 | }); |
137 | return false; |
138 | }); |
139 | }); |
140 | }); |
141 | --> |
a94040d2 |
142 | {/literal}</script> |
7b2413f6 |
143 | <form id="recherche" action="search/adv" method="get"> |
0337d704 |
144 | <table class="bicol" cellpadding="3" summary="Recherche"> |
145 | <tr> |
1f17ab93 |
146 | <th colspan="2"> |
a7de4ef7 |
147 | Recherche avancée [<a href="search"><<< Recherche simple</a>] |
1f17ab93 |
148 | </th> |
149 | </tr> |
150 | <tr> |
0337d704 |
151 | <td>Nom</td> |
152 | <td> |
66f2b6b3 |
153 | <input type="hidden" name="rechercher" value="Chercher"/> |
154 | <input type="submit" style="display:none"/> |
838cc16a |
155 | <input type="text" class="autocomplete" name="name" size="32" value="{$smarty.request.name}" /> |
0337d704 |
156 | </td> |
157 | </tr> |
158 | <tr> |
a7de4ef7 |
159 | <td>Prénom</td> |
0337d704 |
160 | <td> |
838cc16a |
161 | <input class="autocomplete" type="text" name="firstname" size="32" value="{$smarty.request.firstname}" /> |
0337d704 |
162 | </td> |
163 | </tr> |
164 | <tr> |
165 | <td>Surnom</td> |
166 | <td> |
838cc16a |
167 | <input class="autocomplete" type="text" name="nickname" size="32" value="{$smarty.request.nickname}" /> |
0337d704 |
168 | </td> |
169 | </tr> |
170 | <tr> |
171 | <td>Promotion</td> |
172 | <td> |
173 | <select name="egal1"> |
174 | <option value="=" {if $smarty.request.egal1 eq "="}selected="selected"{/if}> = </option> |
175 | <option value=">=" {if $smarty.request.egal1 eq ">="}selected="selected"{/if}> >= </option> |
176 | <option value="<=" {if $smarty.request.egal1 eq "<="}selected="selected"{/if}> <= </option> |
177 | </select> |
178 | <input type="text" name="promo1" size="4" maxlength="4" value="{$smarty.request.promo1}" /> |
179 | ET |
180 | <select name="egal2"> |
181 | <option value="=" {if $smarty.request.egal2 eq "="}selected="selected"{/if}> = </option> |
182 | <option value=">=" {if $smarty.request.egal2 eq ">="}selected="selected"{/if}> >= </option> |
f6818108 |
183 | <option value="<=" {if $smarty.request.egal2 neq ">=" && $smarty.request.egal2 neq "="}selected="selected"{/if}> <= </option> |
0337d704 |
184 | </select> |
185 | <input type="text" name="promo2" size="4" maxlength="4" value="{$smarty.request.promo2}" /> |
186 | </td> |
187 | </tr> |
188 | <tr> |
189 | <td>Sexe</td> |
190 | <td> |
191 | <table> |
192 | <tr> |
193 | <td style="width:100px"> |
f6818108 |
194 | <input type="radio" name="woman" value="0" {if !$smarty.request.woman}checked="checked"{/if} id="woman0"/><label for="woman0">Indifférent</label> |
0337d704 |
195 | </td> |
196 | <td style="width:100px"> |
f6818108 |
197 | <input type="radio" name="woman" value="1" {if $smarty.request.woman eq 1}checked="checked"{/if} id="woman1"/><label for="woman1">Homme</label> |
0337d704 |
198 | </td> |
199 | <td style="width:100px"> |
f6818108 |
200 | <input type="radio" name="woman" value="2" {if $smarty.request.woman eq 2}checked="checked"{/if} id="woman2"/><label for="woman2">Femme</label> |
0337d704 |
201 | </td> |
202 | </tr> |
203 | </table> |
204 | </td> |
205 | </tr> |
206 | <tr> |
207 | <td>Sur polytechnique.org</td> |
208 | <td> |
209 | <table> |
210 | <tr> |
211 | <td style="width:100px"> |
f6818108 |
212 | <input type="radio" name="subscriber" value="0" {if !$smarty.request.subscriber}checked="checked"{/if} id="subscriber0"/><label for="subscriber0">Indifférent</label> |
0337d704 |
213 | </td> |
214 | <td style="width:100px"> |
f6818108 |
215 | <input type="radio" name="subscriber" value="1" {if $smarty.request.subscriber eq 1}checked="checked"{/if} id="subscriber1"/><label for="subscriber1">Inscrit</label> |
0337d704 |
216 | </td> |
217 | <td style="width:100px"> |
f6818108 |
218 | <input type="radio" name="subscriber" value="2" {if $smarty.request.subscriber eq 2}checked="checked"{/if} id="subscriber2"/><label for="subscriber2">Non inscrit</label> |
0337d704 |
219 | </td> |
220 | </tr> |
221 | </table> |
222 | </td> |
223 | </tr> |
224 | <tr> |
225 | <td>En vie</td> |
226 | <td> |
227 | <table> |
228 | <tr> |
229 | <td style="width:100px"> |
f6818108 |
230 | <input type="radio" name="alive" value="0" {if !$smarty.request.alive}checked="checked"{/if} id="alive0"/><label for="alive0">Indifférent</label> |
0337d704 |
231 | </td> |
232 | <td style="width:100px"> |
f6818108 |
233 | <input type="radio" name="alive" value="1" {if $smarty.request.alive eq 1}checked="checked"{/if} id="alive1"/><label for="alive1">Vivant</label> |
0337d704 |
234 | </td> |
235 | <td style="width:100px"> |
f6818108 |
236 | <input type="radio" name="alive" value="2" {if $smarty.request.alive eq 2}checked="checked"{/if} id="alive2"/><label for="alive2">Décédé</label> |
0337d704 |
237 | </td> |
238 | </tr> |
239 | </table> |
240 | </td> |
241 | </tr> |
242 | <tr> |
56670b6a |
243 | <td colspan="2"> |
b16476f7 |
244 | <input type="checkbox" name="with_soundex" value="1" {if $smarty.request.with_soundex}checked="checked"{/if} id="sdxn" /> |
245 | <label for="sdxn">étendre par proximité sonore (uniquement sur nom et prénom)</label> |
246 | </td> |
20ac3913 |
247 | </tr> |
b16476f7 |
248 | <tr> |
249 | <th colspan="2">Géographie</th> |
56670b6a |
250 | </tr> |
251 | <tr> |
0337d704 |
252 | <td>Ville</td> |
df87518a |
253 | <td><input type="text" class="autocomplete" name="city" size="32" value="{$smarty.request.city}" /></td> |
0337d704 |
254 | </tr> |
255 | <tr> |
256 | <td>Pays</td> |
257 | <td> |
66f2b6b3 |
258 | <input name="countryTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
259 | <input name="country" class="autocompleteTarget" type="hidden" value="{$smarty.request.country}"/> |
260 | <a href="country" class="autocompleteToSelect">{icon name="table" title="Tous les pays"}</a> |
0337d704 |
261 | </td> |
262 | </tr> |
263 | <tr> |
a7de4ef7 |
264 | <td>Région ou département</td> |
f6818108 |
265 | <td> |
266 | <input name="region" type="hidden" size="32" value="{$smarty.request.region}"/> |
0337d704 |
267 | </td> |
268 | </tr> |
269 | <tr> |
b16476f7 |
270 | <td colspan="2"> |
271 | <label for="only_current"><input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current} |
272 | checked="checked"{/if}/>chercher uniquement les adresses où les camarades sont actuellement.</label></td> |
273 | </tr> |
274 | <tr> |
a7de4ef7 |
275 | <th colspan="2">Activité</th> |
0337d704 |
276 | </tr> |
277 | <tr> |
278 | <td>Entreprise</td> |
838cc16a |
279 | <td><input type="text" class="autocomplete" name="entreprise" size="32" value="{$smarty.request.entreprise}" /></td> |
0337d704 |
280 | </tr> |
281 | <tr> |
282 | <td>Fonction</td> |
283 | <td> |
66f2b6b3 |
284 | <input name="fonctionTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
285 | <input name="fonction" class="autocompleteTarget" type="hidden" value="{$smarty.request.fonction}"/> |
286 | <a href="fonction" class="autocompleteToSelect">{icon name="table" title="Toutes les fonctions"}</a> |
0337d704 |
287 | </td> |
288 | </tr> |
289 | <tr> |
290 | <td>Poste</td> |
df87518a |
291 | <td><input type="text" class="autocomplete" name="poste" size="32" value="{$smarty.request.poste}" /></td> |
0337d704 |
292 | </tr> |
293 | <tr> |
294 | <td>Secteur</td> |
295 | <td> |
66f2b6b3 |
296 | <input name="secteurTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
297 | <input name="secteur" class="autocompleteTarget" type="hidden" value="{$smarty.request.secteur}"/> |
298 | <a href="secteur" class="autocompleteToSelect">{icon name="table" title="Tous les secteurs"}</a> |
0337d704 |
299 | </td> |
300 | </tr> |
301 | <tr> |
302 | <td>CV contient</td> |
303 | <td><input type="text" name="cv" size="32" value="{$smarty.request.cv}" /></td> |
304 | </tr> |
305 | <tr> |
306 | <td colspan="2"> |
f6818108 |
307 | <input type='checkbox' name='only_referent' {if $smarty.request.only_referent}checked='checked'{/if} id="only_referent"/> |
308 | <label for="only_referent">chercher uniquement parmi les camarades se proposant comme référents</label> |
0337d704 |
309 | </td> |
310 | </tr> |
311 | <tr> |
312 | <th colspan="2">Divers</th> |
313 | </tr> |
314 | <tr> |
a7de4ef7 |
315 | <td>Nationalité</td> |
0337d704 |
316 | <td> |
66f2b6b3 |
317 | <input name="nationaliteTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
318 | <input name="nationalite" class="autocompleteTarget" type="hidden" value="{$smarty.request.nationalite}"/> |
319 | <a href="nationalite" class="autocompleteToSelect">{icon name="table" title="Toutes les nationalités"}</a> |
0337d704 |
320 | </td> |
321 | </tr> |
322 | <tr> |
323 | <td>Binet</td> |
324 | <td> |
66f2b6b3 |
325 | <input name="binetTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
326 | <input name="binet" class="autocompleteTarget" type="hidden" value="{$smarty.request.binet}"/> |
327 | <a href="binet" class="autocompleteToSelect">{icon name="table" title="Tous les binets"}</a> |
0337d704 |
328 | </td> |
329 | </tr> |
330 | <tr> |
331 | <td>Groupe X</td> |
332 | <td> |
66f2b6b3 |
333 | <input name="groupexTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
334 | <input name="groupex" class="autocompleteTarget" type="hidden" value="{$smarty.request.groupex}"/> |
335 | <a href="groupex" class="autocompleteToSelect">{icon name="table" title="Tous les groupes X"}</a> |
0337d704 |
336 | </td> |
337 | </tr> |
338 | <tr> |
339 | <td>Section</td> |
340 | <td> |
66f2b6b3 |
341 | <input name="sectionTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
342 | <input name="section" class="autocompleteTarget" type="hidden" value="{$smarty.request.section}"/> |
343 | <a href="section" class="autocompleteToSelect">{icon name="table" title="Toutes les sections"}</a> |
0337d704 |
344 | </td> |
345 | </tr> |
346 | <tr> |
347 | <td>Formation</td> |
348 | <td> |
66f2b6b3 |
349 | <input name="schoolTxt" type="text" class="autocomplete" style="display:none" size="32"/> |
350 | <input name="school" class="autocompleteTarget" type="hidden" value="{$smarty.request.school}"/> |
351 | <a href="school" class="autocompleteToSelect">{icon name="table" title="Toutes les formations"}</a> |
0337d704 |
352 | </td> |
353 | </tr> |
354 | <tr> |
f6818108 |
355 | <td>Diplôme</td> |
356 | <td> |
357 | <input name="diploma" type="hidden" size="32" value="{$smarty.request.diploma}"/> |
0337d704 |
358 | </td> |
359 | </tr> |
360 | <tr> |
361 | <td>Commentaire contient</td> |
362 | <td><input type="text" name="free" size="32" value="{$smarty.request.free}" /></td> |
363 | </tr> |
1f17ab93 |
364 | <tr> |
365 | <td colspan="2" style="padding-top: 1.5em"> |
366 | <div style="float: right"> |
367 | <input type="button" value="Chercher" onclick="launch_form('search/adv')"/> |
368 | </div> |
369 | {if $smarty.session.auth ge AUTH_COOKIE} |
f6818108 |
370 | <input type='checkbox' name='order' value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} id="order"/> |
371 | <label for="order">mettre les fiches modifiées récemment en premier</label> |
1f17ab93 |
372 | {/if} |
373 | </td> |
374 | </tr> |
0337d704 |
375 | </table> |
cb4a0b71 |
376 | </form> |
377 | <p class="center"> |
a7de4ef7 |
378 | <input type="button" value="Voir les résultats sur une carte" onclick="launch_form('geoloc/')"/> |
cb4a0b71 |
379 | </p> |
0337d704 |
380 | <p> |
a7de4ef7 |
381 | <strong>N.B.</strong> Le caractère joker * peut remplacer une ou plusieurs lettres dans les recherches. |
0337d704 |
382 | </p> |
383 | |
a7de4ef7 |
384 | {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} |