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