X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fjavascript%2Fprofile.js;h=a173e4b96a2ef4208bedb4cb99f2aa55a0a3b237;hb=6fc390c771618c19a6af41c70ec5aa8f197e8bf0;hp=ef2c7efbee8e92a66aed144e173cc814d43a335a;hpb=f31c2a2484c122c1ed4928cb9d461917069e4418;p=platal.git diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index ef2c7ef..a173e4b 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -45,7 +45,7 @@ function wizPage_onLoad(id) } break; case 'emploi': - if ($('#job_0').find("[name='jobs[0][name]']").val() == '') { + if ($('#jobs_0').find("[name='jobs[0][name]']").val() == '') { registerEnterpriseAutocomplete(0); } break; @@ -58,6 +58,12 @@ var educationDegreeName; var subgrades; var names; +// Publicity follows the following ordering: private < ax < public. +var publicity = []; +publicity['private'] = 0; +publicity['ax'] = 1; +publicity['public'] = 2; + // Names {{{1 function toggleNamesAdvanced() @@ -161,7 +167,11 @@ function prepareType(id) var edu = $('.edu_' + id).find("[name='edus[" + id + "][eduid]']").val() - 1; var sel = $('.edu_' + id).find('[name=edu_' + id + '_tmp]').val(); var html = ''; - var length = educationDegree[edu].length; + if (educationDegree[edu]) { + var length = educationDegree[edu].length; + } else { + var length = 0; + } for (i = 0; i < length; ++i) { html += ''; } + // XXX: to be removed once SQL table profile_merge_issues is. + if (sel != '' && html == '') { + html += ''; + } $('.edu_' + id).find("[name='edus[" + id + "][degreeid]']").html(html); } @@ -319,11 +333,10 @@ function validGeoloc(prefid, id, geoloc) { if (geoloc == 1) { $('#' + prefid + '_cont').find('[name*=text]').val($('#' + prefid + '_cont').find('[name*=geocodedText]').val()); - $('#' + prefid + '_cont').find('[name*=postalText]').val($('#' + prefid + '_cont').find('[name*=geocodedPostalText]').val()); + $('#' + prefid + '_cont').find('[name*=postalText]').val(''); } if (geoloc > 0) { $('#' + prefid + '_cont').find("[name*='[geocodedText]']").remove(); - $('#' + prefid + '_cont').find("[name*='[geocodedPostalText]']").remove(); } $('#' + prefid + '_cont').find('[name*=text]').removeClass('error'); $('#' + prefid + '_cont').find('[name*=geocodeChosen]').val(geoloc); @@ -332,7 +345,7 @@ function validGeoloc(prefid, id, geoloc) // {{{1 Phones -function addTel(prefid, prefname) +function addTel(prefid, prefname, subField, mainField, mainId) { var i = 0; var prefix = prefid + '_'; @@ -340,7 +353,7 @@ function addTel(prefid, prefname) i++; } $('#' + prefix + 'add').before('
'); - Ajax.update_html(prefix + i, 'profile/ajax/tel/' + prefid + '/' + prefname + '/' + i); + Ajax.update_html(prefix + i, 'profile/ajax/tel/' + prefid + '/' + prefname + '/' + i + '/' + subField + '/' + mainField + '/' + mainId); } function removeTel(prefname, prefid, id) @@ -512,7 +525,7 @@ function makeAddJob(id) function addJob() { var i = 0; - while ($('#job_' + i).length != 0) { + while ($('#jobs_' + i).length != 0) { ++i; } $.get(platal_baseurl + 'profile/ajax/job/' + i, makeAddJob(i)); @@ -540,23 +553,23 @@ function addJobTerm(jobid, jtid, full_name) jobid = ''; formvarname = 'terms'; } else { - parentpath = '#job_'+jobid+' '; + parentpath = '#jobs_'+jobid+' '; formvarname = 'jobs['+jobid+'][terms]'; } - var lastJobTerm = $(parentpath + '.job_term:last'); + var lastJobTerm = $(parentpath + '.jobs_term:last'); if (lastJobTerm.length != 0) { termid = parseInt(lastJobTerm.children('input').attr('name').replace(/^(jobs\[[0-9]+\]\[terms\]|terms)\[([0-9]+)\]\[jtid\]/, '$2')) + 1; if ($('#job'+jobid+'_term'+jtid).length > 0) { return false; } } - var newdiv = '