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