X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=templates%2Fsearch%2Fadv.form.tpl;h=ba7e7a540ba7d88fe7d8e43c09aec3425e7fde6f;hb=304cdf32d7c38afbd381909545021fc44c8a0e05;hp=ecc0301d591a20d2d7bff0b5f0210b459255d447;hpb=c2b36eadda10e7e4245013a88073e751e811a403;p=platal.git
diff --git a/templates/search/adv.form.tpl b/templates/search/adv.form.tpl
index ecc0301..ba7e7a5 100644
--- a/templates/search/adv.form.tpl
+++ b/templates/search/adv.form.tpl
@@ -51,50 +51,80 @@
};
}
- // when changing country, open up administrativearea 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 (j == 3) {
+ $('tr#locality_text').hide()
+ $("select[name='localityTxt']").attr('value', '');
+ }
- if (a2) {
- $(".autocomplete[name='countryTxt']").addClass('hidden_valid');
+ $("[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);
+ }
+ }
+ });
- $("[name='administrativearea']").parent().load(baseurl + 'list/administrativearea/', { country:a2 }, function() {
- if ($("select[name='administrativearea']").children("option").size() > 1) {
- $("select[name='administrativearea']").attr('value', '{/literal}{$smarty.request.administrativearea}{literal}');
+ }
- $("tr#administrativearea_list").show();
- } else {
- $("select[name='administrativearea']").attr('value', '');
+ 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';
- $("tr#administrativearea_list").hide();
- }
- });
- } else {
- $(".autocomplete[name='countryTxt']").removeClass('hidden_valid');
+ if (j == 3) {
+ $('tr#locality_text').hide()
+ $("select[name='localityTxt']").attr('value', '');
+ }
- $("select[name='administrativearea']").attr('value', '');
- $("select[name='subadministrativearea']").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);
+ }
+ }
+ });
+ }
+
+ 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#administrativearea_list").hide();
- $("tr#subadministrativearea_list").hide();
+ while (types[i] != type && i < 6) {
+ ++i;
}
- }
- // when changing administrativearea, open up subadministrativearea choice
- function changeAdministrativeArea(id) {
- if (id) {
- $("[name='subadministrativearea']").parent().load(baseurl + 'list/subadministrativearea/', { administrativearea:id }, function() {
- if ($("select[name='subadministrativearea']").children("option").size() > 1) {
- $("select[name='subadministrativearea']").attr('value', '{/literal}{$smarty.request.subadministrativearea}{literal}');
- $("tr#subadministrativearea_list").show();
- } else {
- $("select[name='subadministrativearea']").attr('value', '');
- $("tr#subadministrativearea_list").hide();
- }
- });
- } else {
- $("select[name='subadministrativearea']").attr('value', '');
- $("tr#subadministrativearea_list").hide();
+ 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);
}
}
@@ -113,6 +143,15 @@
});
}
+ // 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();
@@ -136,15 +175,20 @@
if (nameRealField == name)
return null;
- // if changing country, might want to open administrativearea 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) {
@@ -195,10 +239,23 @@
$(".autocomplete").change(function() { $(this).removeClass('hidden_valid'); });
- $(".autocomplete[name='countryTxt']").change(function() { changeCountry(''); });
-
- changeCountry({/literal}'{$smarty.request.country}'{literal});
- changeAdministrativeArea({/literal}'{$smarty.request.administrativearea}'{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(''); });
@@ -224,6 +281,9 @@
// 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 ];
@@ -264,6 +324,12 @@ function cleanForm(f) {
+
@@ -293,6 +359,11 @@ function cleanForm(f) {
et
+
@@ -332,6 +403,27 @@ function cleanForm(f) {
+ A une redirection active |
+
+
+ |
+
+
En vie |
@@ -359,10 +451,6 @@ function cleanForm(f) {
Géographie |
- Ville ou code postal |
- |
-
-
Pays |
{icon name="table" title="Tous les pays"}
|
-
+
Région, province, état… |
-
+
|
-
+
Département, comté… |
-
+
+ |
+
+
+ Canton… |
+
+
+ |
+
+
+ Ville |
+ |
+
+
+ Ville |
+
+
+ |
+
+
+ Arrondissement, quartier… |
+
+
|
@@ -400,7 +510,7 @@ function cleanForm(f) {
Description |
- |
+ |
Mots-clefs |
@@ -482,6 +592,36 @@ function cleanForm(f) {
+ Corps d'origine |
+
+
+ |
+
+
+ Corps actuel |
+
+
+ |
+
+
+ Grade |
+
+
+ |
+
+
Commentaire contient |
|
|