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