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