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