X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fjavascript%2Fprofile.js;h=cafaba92b6af7c93bf90b248784d5beeb70e1acd;hb=0b6c8b36e62b950d1b24088e98c4026a54efe9d0;hp=4b215f631c4008fe3c38f79bdaa1691777587e5a;hpb=323b972dd4faf56b46a433255a0178bff6664744;p=platal.git diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index 4b215f6..cafaba9 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -67,13 +67,13 @@ function toggleNamesAdvanced() $('.names_advanced').toggle(); } -function addSearchName() +function addSearchName(isFemale) { var i = 0; while ($('#search_name_' + i).length != 0) { i++; } - Ajax.update_html('search_name_' + i, 'profile/ajax/searchname/' + i, function(data){ + Ajax.update_html('search_name_' + i, 'profile/ajax/searchname/' + i + '/' + isFemale, function(data){ $('#searchname').before(data); changeNameFlag(i); }); @@ -140,7 +140,7 @@ function togglePromotionEdition() function delNationality(i) { - $('#nationalite' + i).hide().find('select').val(''); + $('#nationality' + i).hide().find('select').val(''); } function addNationality() @@ -344,9 +344,16 @@ function addTel(prefid, prefname) Ajax.update_html(prefix + i, 'profile/ajax/tel/' + prefid + '/' + prefname + '/' + i); } -function removeTel(id) +function removeTel(prefname, prefid, id) { - $('#' + id).remove(); + var total = 0; + while ($('#' + prefid + '_' + total).length != 0) { + ++total; + } + $('#' + prefid + '_' + id).remove(); + for (var i = parseInt(id) + 1; i < total; ++i) { + renumberPhone(prefname, prefid, i); + } } function addPhoneComment(id) @@ -362,6 +369,27 @@ function removePhoneComment(id, pref) $('#' + id + '_addComment').show(); } +function renumberPhone(prefname, prefid, i) +{ + var telid = i - 1; + var telprefOld = prefname + '[' + i + ']'; + var telpref = prefname + '[' + telid + ']'; + var idOld = prefid + '_' + i; + var id = prefid + '_' + telid; + + $('#' + idOld).attr('id', id); + $('#' + id).find('div.titre').html('N°' + i); + $('#' + id).find('a.removeTel').attr('href', 'javascript:removeTel(\'' + prefname + '\',\'' + prefid + '\',' + telid + ')'); + $('#' + id).find('select').attr('name', telpref + '[type]'); + $('#' + id).find("[name='" + telprefOld + "[display]']").attr('name', telpref + '[display]'); + $('#' + id).find("[name='" + telprefOld + "[comment]']").attr('name', telpref + '[comment]'); + $('#' + id).find('a.removePhoneComment').attr('href', 'javascript:removePhoneComment(' + id + ',' + telpref + ')'); + $('#' + id).find('#' + idOld + '_addComment').attr('id', id + '_addComment'); + $('#' + id).find('#' + id + '_addComment').attr('href', 'javascript:addPhoneComment(' + id + ')'); + $('#' + id).find('#' + idOld + '_comment').attr('id', id + '_comment'); + $('#' + id).find("[name='" + telprefOld + "[pub]']").attr('name', telpref + '[pub]'); +} + // {{{1 Groups function addBinet() @@ -499,6 +527,16 @@ function updateJobAlternates(id) } } +function emptyJobSubSector(id) +{ + Ajax.update_html('job_' + id + '_subSubSector', 'profile/ajax/sub_sector/' + id + '/-1/-1'); +} + +function emptyJobAlternates(id) +{ + Ajax.update_html('job_' + id + '_alternates', 'profile/ajax/alternates/' + id + '/-1'); +} + function displayAllSector(id) { $('.sector_text_' + id).remove();