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