X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fjavascript%2Fprofile.js;h=42921df789cbd32ab75aaa027b81612aeeebb572;hb=4f903ea683a964b6560afb76f55425297346e068;hp=315fc3854978f4030e44e42c6db9478391dd4aa4;hpb=1760b3f7f98eabdd4506211ce17be472734e6192;p=platal.git diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index 315fc38..42921df 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -29,6 +29,7 @@ function wizPage_onLoad(id) while ($('.' + prefix + i).length != 0) { i++; } + i--; for (var j = 0; j < i; j++) { prepareType(j); } @@ -50,6 +51,8 @@ function wizPage_onLoad(id) for (var i = 0 ; document.getElementById('job_' + i) != null ; ++i) { updateJobSecteur(i, 'job_' + i, 'jobs[' + i + ']', document.forms.prof_annu["jobs[" + i + "][ss_secteur]"].value); + updateJobSousSecteur(i, 'job_' + i, 'jobs[' + i + ']', + document.forms.prof_annu["jobs[" + i + "][sss_secteur]"].value); } setTimeout('registerEnterpriseAutocomplete(-1)', 100); break; @@ -349,8 +352,7 @@ function validGeoloc(id, pref) document.forms.prof_annu[pref + "[parsevalid]"].value = "1"; document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value; document.forms.prof_annu[pref + "[cityid]"].value = document.forms.prof_annu[pref + "[geoloc_cityid]"].value; - attachEvent(document.forms.prof_annu[pref + "[text]"], "click", - function() { document.forms.prof_annu[pref + "[text]"].blur(); }); + $(document.forms.prof_annu[pref + "[text]"]).click(function() { document.forms.prof_annu[pref + "[text]"].blur(); }); document.forms.prof_annu[pref + "[text]"].className = ''; } @@ -360,8 +362,7 @@ function validAddress(id, pref) document.getElementById(id + '_geoloc_error').style.display = 'none'; document.getElementById(id + '_geoloc_valid').style.display = 'none'; document.forms.prof_annu[pref + "[parsevalid]"].value = "1"; - attachEvent(document.forms.prof_annu[pref + "[text]"], "click", - function() { document.forms.prof_annu[pref + "[text]"].blur(); }); + $(document.forms.prof_annu[pref + "[text]"]).click(function() { document.forms.prof_annu[pref + "[text]"].blur(); }); document.forms.prof_annu[pref + "[text]"].className = ''; } @@ -503,7 +504,22 @@ function updateJobSecteur(nb, id, pref, sel) if (secteur == '') { secteur = '-1'; } - Ajax.update_html(id + '_ss_secteur', 'profile/ajax/secteur/' +nb + '/' + secteur + '/' + sel); + Ajax.update_html(id + '_ss_secteur', 'profile/ajax/secteur/' + nb + '/' + id + '/' + pref + '/' + secteur + '/' + sel); +} + +function updateJobSousSecteur(nb, id, pref, sel) +{ + var ssecteur = document.forms.prof_annu[pref + '[ss_secteur]'].value; + if (ssecteur == '') { + ssecteur = '-1'; + } + Ajax.update_html(id + '_sss_secteur', 'profile/ajax/ssecteur/' + nb + '/' + ssecteur + '/' + sel); +} + +function displayAllSector(id) +{ + $('.sector_text_' + id).remove(); + $('.sector_' + id).show(); } function makeAddJob(id) @@ -525,6 +541,10 @@ function addJob() $.get(platal_baseurl + 'profile/ajax/job/' + i, makeAddJob(i)); } +function addEntreprise(id) +{ + $('.entreprise_' + id).toggle(); +} // Skills @@ -619,13 +639,13 @@ function updateSecteur() document.getElementById('ss_secteur_sel').innerHTML = ''; return; } - $.get(platal_baseurl + 'profile/ajax/secteur/-1/' + secteur, + $.get(platal_baseurl + 'profile/ajax/secteur/-1/0/0/' + secteur, function(data) { - data = '' + data; - document.getElementById('ss_secteur_sel').innerHTML = data; - attachEvent(document.forms.prof_annu['jobs[-1][ss_secteur]'], 'change', updateSSecteur); + data = '' + data; + document.getElementById('ss_secteur_sel').innerHTML = data; + $(document.forms.prof_annu['jobs[-1][ss_secteur]']).change(updateSSecteur); }); } @@ -671,6 +691,20 @@ function registerEnterpriseAutocomplete(id) } } ); + + $(".sector_name").each( + function() { + if (id == -1 || this.name == "jobs[" + id + "][sss_secteur_name]") { + $(this).autocomplete(platal_baseurl + "search/autocomplete/sss_secteur", + { + selectOnly:1, + field:this.name, + matchSubset:0, + width:$(this).width() + }); + } + } + ); } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: