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