{**************************************************************************}
{* *}
-{* Copyright (C) 2003-2010 Polytechnique.org *}
+{* Copyright (C) 2003-2011 Polytechnique.org *}
{* http://opensource.polytechnique.org/ *}
{* *}
{* This program is free software; you can redistribute it and/or modify *}
<h1>Recherche dans l'annuaire</h1>
-{javascript name=jquery.form}
+{if hasPerm('edit_directory,admin') && t($suggestAddresses)}
+<p class="center"><strong>Voulez-vous télécharger le <a href="{$globals->baseurl}/search/adv/addresses{$plset_args}">tableau des adresses postales</a> pour la recette précédente ?</strong></p>
+{/if}
<script type="text/javascript">// <!--
- var baseurl = platal_baseurl + "search/";
+ var baseurl = $.plURL("search/");
{literal}
- String.prototype.htmlEntities = function () {
- return this.replace(/&/g,'&').replace(new RegExp('<','g'),'<').replace(/>/g,'>');
- };
+
// display an autocomplete row : blabla (nb of found matches)
function make_format_autocomplete(block) {
return function(row) {
};
}
- // when changing country, open up region choice
- function changeCountry(a2) {
- $(".autocompleteTarget[name='country']").attr('value',a2);
+ function setAddress(i, j, values)
+ {
+ var types = new Array('country', 'administrative_area_level_1', 'administrative_area_level_2', 'administrative_area_level_3', 'locality', 'sublocality');
+ var prev_type = types[i];
+ var next_type = types[j];
+ var next_list = next_type + '_list';
- if (a2) {
- $(".autocomplete[name='countryTxt']").addClass('hidden_valid');
+ if (j == 3) {
+ $('tr#locality_text').hide()
+ $("select[name='localityTxt']").attr('value', '');
+ }
- $("[name='region']").parent().load(baseurl + 'list/region/', { country:a2 }, function() {
- if ($("select[name='region']").children("option").size() > 1) {
- $("select[name='region']").attr('value', '{/literal}{$smarty.request.region}{literal}');
+ $("[name='" + next_type + "']").parent().load(baseurl + 'list/' + next_type, { previous:prev_type, value:values[i] }, function() {
+ if ($("select[name='" + next_type + "']").children("option").size() > 1) {
+ $("tr#" + next_list).show();
+ $("select[name='" + next_type + "']").attr('value', values[j]);
+ if (j < 6) {
+ setAddress(j, j + 1, values);
+ }
+ } else {
+ $("tr#" + next_list).hide();
+ $("select[name='" + next_type + "']").attr('value', '');
+ if (j < 6) {
+ setAddress(i, j + 1, values);
+ }
+ }
+ });
- $("tr#region_ln").show();
- } else {
- $("select[name='region']").attr('value', '');
+ }
- $("tr#region_ln").hide();
- }
- });
- } else {
- $(".autocomplete[name='countryTxt']").removeClass('hidden_valid');
+ function displayNextAddressComponent(i, j, value)
+ {
+ var types = new Array('country', 'administrative_area_level_1', 'administrative_area_level_2', 'administrative_area_level_3', 'locality', 'sublocality');
+ var prev_type = types[i];
+ var next_type = types[j];
+ var next_list = next_type + '_list';
+
+ if (j == 3) {
+ $('tr#locality_text').hide()
+ $("select[name='localityTxt']").attr('value', '');
+ }
+
+ $("[name='" + next_type + "']").parent().load(baseurl + 'list/' + next_type, { previous:prev_type, value:value }, function() {
+ $("select[name='" + next_type + "']").attr('value', '');
+ if ($("select[name='" + next_type + "']").children("option").size() > 1) {
+ $("tr#" + next_list).show();
+ } else {
+ $("tr#" + next_list).hide();
+ if (j < 6) {
+ displayNextAddressComponent(i, j + 1, value);
+ }
+ }
+ });
+ }
- $("select[name='region']").attr('value', '');
+ function changeAddressComponents(type, value)
+ {
+ var types = new Array('country', 'administrative_area_level_1', 'administrative_area_level_2', 'administrative_area_level_3', 'locality', 'sublocality');
+ var i = 0, j = 0;
- $("tr#region_ln").hide();
+ while (types[i] != type && i < 6) {
+ ++i;
+ }
+
+ j = i + 1;
+ while (j < 6) {
+ $("select[name='" + types[j] + "']").attr('value', '');
+ $("tr#" + types[j] + "_list").hide();
+ ++j;
+ }
+
+ if (value != '' && i < 5) {
+ $("select[name='" + type + "']").attr('value', value);
+ displayNextAddressComponent(i, i + 1, value);
}
}
});
}
+ // when checking/unchecking "only_referent", disable/enable some fields
+ function changeOnlyReferent() {
+ if ($("#only_referent").is(':checked')) {
+ $("input[name='entreprise']").attr('disabled', true);
+ } else {
+ $("input[name='entreprise']").removeAttr('disabled');
+ }
+ }
+
// when choosing a job term in tree, hide tree and set job term field
function searchForJobTerm(treeid, jtid, full_name) {
$(".term_tree").remove();
if (nameRealField == name)
return null;
- // if changing country, might want to open region choice
- if (nameRealField == 'country')
+ // When changing country or locality, open next address component.
+ if (nameRealField == 'country' || nameRealField == 'locality') {
return function(i) {
+ nameRealField = name.replace(/Txt$/, '');
if (i.extra[0] < 0) {
- cancel_autocomplete('countryTxt', 'country');
+ cancel_autocomplete(name, nameRealField);
i.extra[1] = '';
}
- changeCountry(i.extra[1]);
+ $("[name='" + nameRealField + "']").parent().load(baseurl + 'list/' + nameRealField, function() {
+ $("select[name='" + nameRealField + "']").attr('value', i.extra[1]);
+ });
+ changeAddressComponents(nameRealField, i.extra[1]);
}
+ }
if (nameRealField == 'school')
return function(i) {
}
}
- $(document).ready(function() {
+ $(function() {
$(".autocompleteTarget").hide();
$(".autocomplete").show().each(function() {
targeted = $("../.autocompleteTarget",this)[0];
$(".autocomplete").change(function() { $(this).removeClass('hidden_valid'); });
- $(".autocomplete[name='countryTxt']").change(function() { changeCountry(''); });
-
- changeCountry({/literal}'{$smarty.request.country}'{literal});
+ if ({/literal}'{$smarty.request.country}'{literal} != '') {
+ $("[name='country']").parent().load(baseurl + 'list/country', function() {
+ $("select[name='country']").attr('value', {/literal}'{$smarty.request.country}'{literal});
+ });
+ setAddress(0, 1, new Array({/literal}'{$smarty.request.country}'{literal},
+ {/literal}'{$smarty.request.administrative_area_level_1}'{literal},
+ {/literal}'{$smarty.request.administrative_area_level_2}'{literal},
+ {/literal}'{$smarty.request.administrative_area_level_3}'{literal},
+ {/literal}'{$smarty.request.locality}'{literal},
+ {/literal}'{$smarty.request.sublocality}'{literal})
+ );
+ } else {
+ var types = new Array('administrative_area_level_1', 'administrative_area_level_2', 'administrative_area_level_3', 'locality', 'sublocality');
+ for (var i = 0; i < 5; ++i) {
+ $("tr#" + types[i] + '_list').hide();
+ }
+ }
$(".autocomplete[name='schoolTxt']").change(function() { changeSchool(''); });
// to ensure that, we unset it
$(this).parent().find('.autocompleteTarget').val('');
});
+
+ $("#only_referent").change(function() { changeOnlyReferent(); });
+
});
/** Regexps to wipe out from search queries */
var default_form_values = [ /&woman=0(&|$)/, /&subscriber=0(&|$)/, /&alive=0(&|$)/, /&egal[12]=[^&]*&promo[12]=(&|$)/g, /&networking_type=0(&|$)/, /&[^&=]+=(&|$)/g ];
<input type="hidden" name="rechercher" value="Chercher"/>
<input type="submit" style="display:none"/>
<input type="text" name="name" size="32" value="{$smarty.request.name}" />
+ <select name="name_type">
+ <option value="" {if $smarty.request.name_type eq ''}selected="selected"{/if}> - </option>
+ <option value="lastname" {if $smarty.request.name_type eq 'lastname'}selected="selected"{/if}>nom</option>
+ <option value="firstname" {if $smarty.request.name_type eq 'firstname'}selected="selected"{/if}>prénom</option>
+ <option value="nickname" {if $smarty.request.name_type eq 'nickname'}selected="selected"{/if}>surnom</option>
+ </select>
</td>
</tr>
<tr>
<td>Promotion</td>
<td>
- <script type="text/javascript">/*<![CDATA[*/
- {literal}
- function updatepromofields(egal1) {
- var f = egal1.form;
- f.egal2.disabled = f.promo2.disabled = egal1.value == '=';
- f.egal2.readOnly = true;
- if (f.egal1.value == '>=') {
- f.egal2.value = '<=';
- } else {
- f.egal2.value = '>=';
- }
- }
- $(document).ready(function() { updatepromofields($('select[name=egal1]')[0]); });
- {/literal}
- /*]]>*/</script>
- <select name="egal1" onchange="updatepromofields(this)" style="text-align:center">
- <option value="=" {if $smarty.request.egal1 eq "="}selected="selected"{/if}> = </option>
- <option value=">=" {if $smarty.request.egal1 eq ">="}selected="selected"{/if}> >= </option>
- <option value="<=" {if $smarty.request.egal1 eq "<="}selected="selected"{/if}> <= </option>
- </select>
- <input type="text" name="promo1" size="4" maxlength="4" value="{$smarty.request.promo1}" />
- et
- <input type="text" name="egal2" size="1" style="text-align:center" value="{if t($smarty.request.egal2) eq '<'}<{else}>{/if}" readonly="readonly" />
- <input type="text" name="promo2" size="4" maxlength="4" value="{$smarty.request.promo2}" />
+ {include file="include/select_promo.tpl" promo_data=$smarty.request egal1="egal1" egal2="egal2" promo1="promo1" promo2="promo2" edu_type="edu_type"}
</td>
</tr>
<tr>
</td>
</tr>
<tr>
+ <td>A une redirection active</td>
+ <td>
+ <table>
+ <tr>
+ <td style="width:100px">
+ <input type="radio" name="has_email_redirect" value="0" {if !$smarty.request.has_email_redirect}checked="checked"{/if}
+ id="has_email_redirect0" /><label for="has_email_redirect0">indifférent</label>
+ </td>
+ <td style="width:100px">
+ <input type="radio" name="has_email_redirect" value="1" {if $smarty.request.has_email_redirect eq 1}checked="checked"{/if}
+ id="has_email_redirect1" /><label for="has_email_redirect1">oui</label>
+ </td>
+ <td style="width:100px">
+ <input type="radio" name="has_email_redirect" value="2" {if $smarty.request.has_email_redirect eq 2}checked="checked"{/if}
+ id="has_email_redirect2" /><label for="has_email_redirect2">non</label>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
<td>En vie</td>
<td>
<table>
<th colspan="2">Géographie</th>
</tr>
<tr>
- <td>Ville ou code postal</td>
- <td><input type="text" class="autocomplete" name="city" size="32" value="{$smarty.request.city}" /></td>
- </tr>
- <tr>
<td>Pays</td>
<td>
<input name="countryTxt" type="text" class="autocomplete" style="display:none" size="32"
<a href="country" class="autocompleteToSelect">{icon name="table" title="Tous les pays"}</a>
</td>
</tr>
- <tr id="region_ln">
- <td>Région ou département</td>
+ <tr id="administrative_area_level_1_list">
+ <td>Région, province, état…</td>
+ <td>
+ <input name="administrative_area_level_1" type="hidden" size="32" value="{$smarty.request.administrative_area_level_1}" />
+ </td>
+ </tr>
+ <tr id="administrative_area_level_2_list">
+ <td>Département, comté…</td>
+ <td>
+ <input name="administrative_area_level_2" type="hidden" size="32" value="{$smarty.request.administrative_area_level_2}" />
+ </td>
+ </tr>
+ <tr id="administrative_area_level_3_list">
+ <td>Canton…</td>
<td>
- <input name="region" type="hidden" size="32" value="{$smarty.request.region}"/>
+ <input name="administrative_area_level_3" type="hidden" size="32" value="{$smarty.request.administrative_area_level_3}" />
+ </td>
+ </tr>
+ <tr id="locality_text">
+ <td>Ville</td>
+ <td><input type="text" class="autocomplete" name="localityTxt" size="32" value="{$smarty.request.localityTxt}" /></td>
+ </tr>
+ <tr id="locality_list">
+ <td>Ville</td>
+ <td>
+ <input name="locality" type="hidden" size="32" value="{$smarty.request.locality}" />
+ </td>
+ </tr>
+ <tr id="sublocality_list">
+ <td>Arrondissement, quartier…</td>
+ <td>
+ <input name="sublocality" type="hidden" size="32" value="{$smarty.request.sublocality}" />
</td>
</tr>
<tr>
</tr>
<tr>
<td>Description</td>
- <td><input type="text" class="autocomplete" name="description" size="32" value="{$smarty.request.description}" /></td>
+ <td><input type="text" class="autocomplete" name="jobdescription" size="32" value="{$smarty.request.jobdescription}" /></td>
</tr>
<tr>
<td>Mots-clefs</td>
</td>
</tr>
<tr>
+ <td>Corps d'origine</td>
+ <td>
+ <select name="origin_corps">
+ {foreach from=$origin_corps_list key=id item=corps}
+ <option value="{$id}" {if $smarty.request.origin_corps eq $id}selected="selected"{/if}>{$corps}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Corps actuel</td>
+ <td>
+ <select name="current_corps">
+ {foreach from=$current_corps_list key=id item=corps}
+ <option value="{$id}" {if $smarty.request.current_corps eq $id}selected="selected"{/if}>{$corps}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Grade</td>
+ <td>
+ <select name="corps_rank">
+ {foreach from=$corps_rank_list key=id item=corps}
+ <option value="{$id}" {if $smarty.request.corps_rank eq $id}selected="selected"{/if}>{$corps}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
<td>Commentaire contient</td>
<td><input type="text" name="free" size="32" value="{$smarty.request.free}" /></td>
</tr>
</table>
</td>
</tr>
+ {if hasPerm('admin,edit_directory')}
+ <tr>
+ <td>Matricule AX</td>
+ <td>
+ <textarea name="schoolid_ax" rows="10" cols="12">{$smarty.request.schoolid_ax}</textarea>
+ <br />
+ <i>Entrer une liste de matricules AX (un par ligne)</i>
+ </td>
+ {/if}
{if $smarty.session.auth ge AUTH_COOKIE}
+ </tr>
<tr>
<td colspan="2">
<input type='checkbox' name='order' value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} id="order"/>