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